@@ -242,7 +242,7 @@ |
||
242 | 242 | * @since 1.0 |
243 | 243 | * @access public |
244 | 244 | * |
245 | - * @return bool |
|
245 | + * @return boolean|null |
|
246 | 246 | */ |
247 | 247 | public function check_for_token() { |
248 | 248 |
@@ -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 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | public function __construct() { |
107 | 107 | |
108 | 108 | // get it started |
109 | - add_action( 'init', array( $this, 'init' ) ); |
|
109 | + add_action('init', array($this, 'init')); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -122,28 +122,28 @@ discard block |
||
122 | 122 | public function init() { |
123 | 123 | |
124 | 124 | // Bail Out, if user is logged in. |
125 | - if ( is_user_logged_in() ) { |
|
125 | + if (is_user_logged_in()) { |
|
126 | 126 | return; |
127 | 127 | } |
128 | 128 | |
129 | 129 | // Are db columns setup? |
130 | - $column_exists = Give()->donors->does_column_exist( 'token' ); |
|
131 | - if ( ! $column_exists ) { |
|
130 | + $column_exists = Give()->donors->does_column_exist('token'); |
|
131 | + if ( ! $column_exists) { |
|
132 | 132 | $this->create_columns(); |
133 | 133 | } |
134 | 134 | |
135 | 135 | // Timeouts. |
136 | - $this->verify_throttle = apply_filters( 'give_nl_verify_throttle', 300 ); |
|
137 | - $this->limit_throttle = apply_filters( 'give_nl_limit_throttle', 3 ); |
|
138 | - $this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 ); |
|
136 | + $this->verify_throttle = apply_filters('give_nl_verify_throttle', 300); |
|
137 | + $this->limit_throttle = apply_filters('give_nl_limit_throttle', 3); |
|
138 | + $this->token_expiration = apply_filters('give_nl_token_expiration', 7200); |
|
139 | 139 | |
140 | 140 | // Setup login. |
141 | 141 | $this->check_for_token(); |
142 | 142 | |
143 | - if ( $this->token_exists ) { |
|
144 | - add_filter( 'give_can_view_receipt', '__return_true' ); |
|
145 | - add_filter( 'give_user_pending_verification', '__return_false' ); |
|
146 | - add_filter( 'give_get_users_donations_args', array( $this, 'users_donations_args' ) ); |
|
143 | + if ($this->token_exists) { |
|
144 | + add_filter('give_can_view_receipt', '__return_true'); |
|
145 | + add_filter('give_user_pending_verification', '__return_false'); |
|
146 | + add_filter('give_get_users_donations_args', array($this, 'users_donations_args')); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | } |
@@ -158,23 +158,23 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @return bool |
160 | 160 | */ |
161 | - public function can_send_email( $donor_id ) { |
|
161 | + public function can_send_email($donor_id) { |
|
162 | 162 | |
163 | - $donor = Give()->donors->get_donor_by( 'id', $donor_id ); |
|
163 | + $donor = Give()->donors->get_donor_by('id', $donor_id); |
|
164 | 164 | |
165 | - if ( is_object( $donor ) ) { |
|
165 | + if (is_object($donor)) { |
|
166 | 166 | |
167 | - $email_throttle_count = (int) give_get_meta( $donor_id, '_give_email_throttle_count', true ); |
|
167 | + $email_throttle_count = (int) give_get_meta($donor_id, '_give_email_throttle_count', true); |
|
168 | 168 | |
169 | 169 | $cache_key = "give_cache_email_throttle_limit_exhausted_{$donor_id}"; |
170 | 170 | if ( |
171 | 171 | $email_throttle_count < $this->limit_throttle && |
172 | - true !== Give_Cache::get( $cache_key ) |
|
172 | + true !== Give_Cache::get($cache_key) |
|
173 | 173 | ) { |
174 | - give_update_meta( $donor_id, '_give_email_throttle_count', $email_throttle_count + 1 ); |
|
174 | + give_update_meta($donor_id, '_give_email_throttle_count', $email_throttle_count + 1); |
|
175 | 175 | } else { |
176 | - give_update_meta( $donor_id, '_give_email_throttle_count', 0 ); |
|
177 | - Give_Cache::set( $cache_key, true, $this->verify_throttle ); |
|
176 | + give_update_meta($donor_id, '_give_email_throttle_count', 0); |
|
177 | + Give_Cache::set($cache_key, true, $this->verify_throttle); |
|
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | * |
195 | 195 | * @return bool |
196 | 196 | */ |
197 | - public function send_email( $donor_id, $email ) { |
|
198 | - return apply_filters( 'give_email-access_email_notification', $donor_id, $email ); |
|
197 | + public function send_email($donor_id, $email) { |
|
198 | + return apply_filters('give_email-access_email_notification', $donor_id, $email); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -208,28 +208,28 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function check_for_token() { |
210 | 210 | |
211 | - $token = isset( $_GET['give_nl'] ) ? give_clean( $_GET['give_nl'] ) : ''; |
|
211 | + $token = isset($_GET['give_nl']) ? give_clean($_GET['give_nl']) : ''; |
|
212 | 212 | |
213 | 213 | // Check for cookie. |
214 | - if ( empty( $token ) ) { |
|
215 | - $token = isset( $_COOKIE['give_nl'] ) ? give_clean( $_COOKIE['give_nl'] ) : ''; |
|
214 | + if (empty($token)) { |
|
215 | + $token = isset($_COOKIE['give_nl']) ? give_clean($_COOKIE['give_nl']) : ''; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | // Must have a token. |
219 | - if ( ! empty( $token ) ) { |
|
219 | + if ( ! empty($token)) { |
|
220 | 220 | |
221 | - if ( ! $this->is_valid_token( $token ) ) { |
|
222 | - if ( ! $this->is_valid_verify_key( $token ) ) { |
|
221 | + if ( ! $this->is_valid_token($token)) { |
|
222 | + if ( ! $this->is_valid_verify_key($token)) { |
|
223 | 223 | return false; |
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | 227 | // Set Receipt Access Session. |
228 | - Give()->session->set( 'receipt_access', true ); |
|
228 | + Give()->session->set('receipt_access', true); |
|
229 | 229 | $this->token_exists = true; |
230 | 230 | // Set cookie. |
231 | - $lifetime = current_time( 'timestamp' ) + Give()->session->set_expiration_time(); |
|
232 | - @setcookie( 'give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
231 | + $lifetime = current_time('timestamp') + Give()->session->set_expiration_time(); |
|
232 | + @setcookie('give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
233 | 233 | |
234 | 234 | return true; |
235 | 235 | } |
@@ -245,26 +245,26 @@ discard block |
||
245 | 245 | * |
246 | 246 | * @return bool |
247 | 247 | */ |
248 | - public function is_valid_token( $token ) { |
|
248 | + public function is_valid_token($token) { |
|
249 | 249 | |
250 | 250 | global $wpdb; |
251 | 251 | |
252 | 252 | // Make sure token isn't expired. |
253 | - $expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration ); |
|
253 | + $expires = date('Y-m-d H:i:s', time() - $this->token_expiration); |
|
254 | 254 | |
255 | 255 | $email = $wpdb->get_var( |
256 | - $wpdb->prepare( "SELECT email FROM {$wpdb->donors} WHERE verify_key = %s AND verify_throttle >= %s LIMIT 1", $token, $expires ) |
|
256 | + $wpdb->prepare("SELECT email FROM {$wpdb->donors} WHERE verify_key = %s AND verify_throttle >= %s LIMIT 1", $token, $expires) |
|
257 | 257 | ); |
258 | 258 | |
259 | - if ( ! empty( $email ) ) { |
|
259 | + if ( ! empty($email)) { |
|
260 | 260 | $this->token_email = $email; |
261 | 261 | $this->token = $token; |
262 | 262 | return true; |
263 | 263 | } |
264 | 264 | |
265 | 265 | // Set error only if email access form isn't being submitted. |
266 | - if ( ! isset( $_POST['give_email'] ) && ! isset( $_POST['_wpnonce'] ) ) { |
|
267 | - give_set_error( 'give_email_token_expired', apply_filters( 'give_email_token_expired_message', __( 'Your access token has expired. Please request a new one below:', 'give' ) ) ); |
|
266 | + if ( ! isset($_POST['give_email']) && ! isset($_POST['_wpnonce'])) { |
|
267 | + give_set_error('give_email_token_expired', apply_filters('give_email_token_expired_message', __('Your access token has expired. Please request a new one below:', 'give'))); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | return false; |
@@ -283,25 +283,25 @@ discard block |
||
283 | 283 | * |
284 | 284 | * @return void |
285 | 285 | */ |
286 | - public function set_verify_key( $donor_id, $email, $verify_key ) { |
|
286 | + public function set_verify_key($donor_id, $email, $verify_key) { |
|
287 | 287 | global $wpdb; |
288 | 288 | |
289 | - $now = date( 'Y-m-d H:i:s' ); |
|
289 | + $now = date('Y-m-d H:i:s'); |
|
290 | 290 | |
291 | 291 | // Insert or update? |
292 | 292 | $row_id = (int) $wpdb->get_var( |
293 | - $wpdb->prepare( "SELECT id FROM {$wpdb->donors} WHERE id = %d LIMIT 1", $donor_id ) |
|
293 | + $wpdb->prepare("SELECT id FROM {$wpdb->donors} WHERE id = %d LIMIT 1", $donor_id) |
|
294 | 294 | ); |
295 | 295 | |
296 | 296 | // Update. |
297 | - if ( ! empty( $row_id ) ) { |
|
297 | + if ( ! empty($row_id)) { |
|
298 | 298 | $wpdb->query( |
299 | - $wpdb->prepare( "UPDATE {$wpdb->donors} SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id ) |
|
299 | + $wpdb->prepare("UPDATE {$wpdb->donors} SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id) |
|
300 | 300 | ); |
301 | 301 | } // Insert. |
302 | 302 | else { |
303 | 303 | $wpdb->query( |
304 | - $wpdb->prepare( "INSERT INTO {$wpdb->donors} ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now ) |
|
304 | + $wpdb->prepare("INSERT INTO {$wpdb->donors} ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now) |
|
305 | 305 | ); |
306 | 306 | } |
307 | 307 | } |
@@ -316,21 +316,21 @@ discard block |
||
316 | 316 | * |
317 | 317 | * @return bool |
318 | 318 | */ |
319 | - public function is_valid_verify_key( $token ) { |
|
319 | + public function is_valid_verify_key($token) { |
|
320 | 320 | /* @var WPDB $wpdb */ |
321 | 321 | global $wpdb; |
322 | 322 | |
323 | 323 | // See if the verify_key exists. |
324 | 324 | $row = $wpdb->get_row( |
325 | - $wpdb->prepare( "SELECT id, email FROM {$wpdb->donors} WHERE verify_key = %s LIMIT 1", $token ) |
|
325 | + $wpdb->prepare("SELECT id, email FROM {$wpdb->donors} WHERE verify_key = %s LIMIT 1", $token) |
|
326 | 326 | ); |
327 | 327 | |
328 | - $now = date( 'Y-m-d H:i:s' ); |
|
328 | + $now = date('Y-m-d H:i:s'); |
|
329 | 329 | |
330 | 330 | // Set token and remove verify key. |
331 | - if ( ! empty( $row ) ) { |
|
331 | + if ( ! empty($row)) { |
|
332 | 332 | $wpdb->query( |
333 | - $wpdb->prepare( "UPDATE {$wpdb->donors} SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id ) |
|
333 | + $wpdb->prepare("UPDATE {$wpdb->donors} SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id) |
|
334 | 334 | ); |
335 | 335 | |
336 | 336 | $this->token_email = $row->email; |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * |
355 | 355 | * @return mixed |
356 | 356 | */ |
357 | - public function users_donations_args( $args ) { |
|
357 | + public function users_donations_args($args) { |
|
358 | 358 | $args['user'] = $this->token_email; |
359 | 359 | |
360 | 360 | return $args; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | global $wpdb; |
376 | 376 | |
377 | 377 | // Create columns in donors table. |
378 | - $wpdb->query( "ALTER TABLE {$wpdb->donors} ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`" ); |
|
378 | + $wpdb->query("ALTER TABLE {$wpdb->donors} ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`"); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * @param string $user_login Username |
181 | 181 | * @param string $user_pass Password |
182 | 182 | * |
183 | - * @return bool |
|
183 | + * @return false|null |
|
184 | 184 | */ |
185 | 185 | function give_log_user_in( $user_id, $user_login, $user_pass ) { |
186 | 186 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @param array $data Data sent from the register form |
223 | 223 | * |
224 | - * @return bool |
|
224 | + * @return false|null |
|
225 | 225 | */ |
226 | 226 | function give_process_register_form( $data ) { |
227 | 227 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * |
308 | 308 | * @since 1.8.17 |
309 | 309 | * |
310 | - * @return bool |
|
310 | + * @return boolean|null |
|
311 | 311 | */ |
312 | 312 | function give_email_access_login() { |
313 | 313 |
@@ -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 | |
@@ -26,24 +26,24 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return string Login form |
28 | 28 | */ |
29 | -function give_login_form( $login_redirect = '', $logout_redirect = '' ) { |
|
29 | +function give_login_form($login_redirect = '', $logout_redirect = '') { |
|
30 | 30 | |
31 | - if ( empty( $login_redirect ) ) { |
|
32 | - $login_redirect = add_query_arg( 'give-login-success', 'true', give_get_history_page_uri() ); |
|
31 | + if (empty($login_redirect)) { |
|
32 | + $login_redirect = add_query_arg('give-login-success', 'true', give_get_history_page_uri()); |
|
33 | 33 | } |
34 | 34 | |
35 | - if ( empty( $logout_redirect ) ) { |
|
36 | - $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() ); |
|
35 | + if (empty($logout_redirect)) { |
|
36 | + $logout_redirect = add_query_arg('give-logout-success', 'true', give_get_current_page_url()); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // Add user_logout action to logout url. |
40 | 40 | $logout_redirect = add_query_arg( |
41 | 41 | array( |
42 | 42 | 'give_action' => 'user_logout', |
43 | - 'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ), |
|
44 | - 'give_logout_redirect' => urlencode( $logout_redirect ), |
|
43 | + 'give_logout_nonce' => wp_create_nonce('give-logout-nonce'), |
|
44 | + 'give_logout_redirect' => urlencode($logout_redirect), |
|
45 | 45 | ), |
46 | - home_url( '/' ) |
|
46 | + home_url('/') |
|
47 | 47 | ); |
48 | 48 | |
49 | 49 | ob_start(); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | ) |
57 | 57 | ); |
58 | 58 | |
59 | - return apply_filters( 'give_login_form', ob_get_clean() ); |
|
59 | + return apply_filters('give_login_form', ob_get_clean()); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return string Register form |
71 | 71 | */ |
72 | -function give_register_form( $redirect = '' ) { |
|
73 | - if ( empty( $redirect ) ) { |
|
72 | +function give_register_form($redirect = '') { |
|
73 | + if (empty($redirect)) { |
|
74 | 74 | $redirect = give_get_current_page_url(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | ob_start(); |
78 | 78 | |
79 | - if ( ! is_user_logged_in() ) { |
|
79 | + if ( ! is_user_logged_in()) { |
|
80 | 80 | give_get_template( |
81 | 81 | 'shortcode-register', |
82 | 82 | array( |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ); |
86 | 86 | } |
87 | 87 | |
88 | - return apply_filters( 'give_register_form', ob_get_clean() ); |
|
88 | + return apply_filters('give_register_form', ob_get_clean()); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -97,40 +97,40 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @return void |
99 | 99 | */ |
100 | -function give_process_login_form( $data ) { |
|
101 | - if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) { |
|
100 | +function give_process_login_form($data) { |
|
101 | + if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) { |
|
102 | 102 | |
103 | 103 | // Set Receipt Access Session. |
104 | - if ( ! empty( $_GET['payment_key'] ) ) { |
|
105 | - Give()->session->set( 'receipt_access', true ); |
|
104 | + if ( ! empty($_GET['payment_key'])) { |
|
105 | + Give()->session->set('receipt_access', true); |
|
106 | 106 | } |
107 | 107 | |
108 | - $user_data = get_user_by( 'login', $data['give_user_login'] ); |
|
109 | - if ( ! $user_data ) { |
|
110 | - $user_data = get_user_by( 'email', $data['give_user_login'] ); |
|
108 | + $user_data = get_user_by('login', $data['give_user_login']); |
|
109 | + if ( ! $user_data) { |
|
110 | + $user_data = get_user_by('email', $data['give_user_login']); |
|
111 | 111 | } |
112 | - if ( $user_data ) { |
|
112 | + if ($user_data) { |
|
113 | 113 | $user_ID = $user_data->ID; |
114 | 114 | $user_email = $user_data->user_email; |
115 | - if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_ID ) ) { |
|
116 | - give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] ); |
|
115 | + if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_ID)) { |
|
116 | + give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']); |
|
117 | 117 | } else { |
118 | - give_set_error( 'password_incorrect', __( 'The password you entered is incorrect.', 'give' ) ); |
|
118 | + give_set_error('password_incorrect', __('The password you entered is incorrect.', 'give')); |
|
119 | 119 | } |
120 | 120 | } else { |
121 | - give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) ); |
|
121 | + give_set_error('username_incorrect', __('The username you entered does not exist.', 'give')); |
|
122 | 122 | } |
123 | 123 | // Check for errors and redirect if none present |
124 | 124 | $errors = give_get_errors(); |
125 | - if ( ! $errors ) { |
|
126 | - $redirect = apply_filters( 'give_login_redirect', $data['give_login_redirect'], $user_ID ); |
|
127 | - wp_redirect( $redirect ); |
|
125 | + if ( ! $errors) { |
|
126 | + $redirect = apply_filters('give_login_redirect', $data['give_login_redirect'], $user_ID); |
|
127 | + wp_redirect($redirect); |
|
128 | 128 | give_die(); |
129 | 129 | } |
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | -add_action( 'give_user_login', 'give_process_login_form' ); |
|
133 | +add_action('give_user_login', 'give_process_login_form'); |
|
134 | 134 | |
135 | 135 | |
136 | 136 | /** |
@@ -142,18 +142,18 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @return void |
144 | 144 | */ |
145 | -function give_process_user_logout( $data ) { |
|
146 | - if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
145 | +function give_process_user_logout($data) { |
|
146 | + if (wp_verify_nonce($data['give_logout_nonce'], 'give-logout-nonce') && is_user_logged_in()) { |
|
147 | 147 | |
148 | 148 | // Prevent occurring of any custom action on wp_logout. |
149 | - remove_all_actions( 'wp_logout' ); |
|
149 | + remove_all_actions('wp_logout'); |
|
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Fires before processing user logout. |
153 | 153 | * |
154 | 154 | * @since 1.0 |
155 | 155 | */ |
156 | - do_action( 'give_before_user_logout' ); |
|
156 | + do_action('give_before_user_logout'); |
|
157 | 157 | |
158 | 158 | // Logout user. |
159 | 159 | wp_logout(); |
@@ -163,14 +163,14 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @since 1.0 |
165 | 165 | */ |
166 | - do_action( 'give_after_user_logout' ); |
|
166 | + do_action('give_after_user_logout'); |
|
167 | 167 | |
168 | - wp_redirect( $data['give_logout_redirect'] ); |
|
168 | + wp_redirect($data['give_logout_redirect']); |
|
169 | 169 | give_die(); |
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
173 | -add_action( 'give_user_logout', 'give_process_user_logout' ); |
|
173 | +add_action('give_user_logout', 'give_process_user_logout'); |
|
174 | 174 | |
175 | 175 | /** |
176 | 176 | * Log User In |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @return bool |
185 | 185 | */ |
186 | -function give_log_user_in( $user_id, $user_login, $user_pass ) { |
|
186 | +function give_log_user_in($user_id, $user_login, $user_pass) { |
|
187 | 187 | |
188 | - if ( $user_id < 1 ) { |
|
188 | + if ($user_id < 1) { |
|
189 | 189 | return false; |
190 | 190 | } |
191 | 191 | |
192 | - wp_set_auth_cookie( $user_id ); |
|
193 | - wp_set_current_user( $user_id, $user_login ); |
|
192 | + wp_set_auth_cookie($user_id); |
|
193 | + wp_set_current_user($user_id, $user_login); |
|
194 | 194 | |
195 | 195 | /** |
196 | 196 | * Fires after the user has successfully logged in. |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @param string $user_login Username. |
201 | 201 | * @param WP_User $$user WP_User object of the logged-in user. |
202 | 202 | */ |
203 | - do_action( 'wp_login', $user_login, get_userdata( $user_id ) ); |
|
203 | + do_action('wp_login', $user_login, get_userdata($user_id)); |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Fires after give user has successfully logged in. |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * @param string $user_login Username. |
212 | 212 | * @param string $user_pass User password. |
213 | 213 | */ |
214 | - do_action( 'give_log_user_in', $user_id, $user_login, $user_pass ); |
|
214 | + do_action('give_log_user_in', $user_id, $user_login, $user_pass); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | |
@@ -224,13 +224,13 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @return bool |
226 | 226 | */ |
227 | -function give_process_register_form( $data ) { |
|
227 | +function give_process_register_form($data) { |
|
228 | 228 | |
229 | - if ( is_user_logged_in() ) { |
|
229 | + if (is_user_logged_in()) { |
|
230 | 230 | return false; |
231 | 231 | } |
232 | 232 | |
233 | - if ( empty( $_POST['give_register_submit'] ) ) { |
|
233 | + if (empty($_POST['give_register_submit'])) { |
|
234 | 234 | return false; |
235 | 235 | } |
236 | 236 | |
@@ -239,38 +239,38 @@ discard block |
||
239 | 239 | * |
240 | 240 | * @since 1.0 |
241 | 241 | */ |
242 | - do_action( 'give_pre_process_register_form' ); |
|
242 | + do_action('give_pre_process_register_form'); |
|
243 | 243 | |
244 | - if ( empty( $data['give_user_login'] ) ) { |
|
245 | - give_set_error( 'empty_username', esc_html__( 'Invalid username.', 'give' ) ); |
|
244 | + if (empty($data['give_user_login'])) { |
|
245 | + give_set_error('empty_username', esc_html__('Invalid username.', 'give')); |
|
246 | 246 | } |
247 | 247 | |
248 | - if ( username_exists( $data['give_user_login'] ) ) { |
|
249 | - give_set_error( 'username_unavailable', esc_html__( 'Username already taken.', 'give' ) ); |
|
248 | + if (username_exists($data['give_user_login'])) { |
|
249 | + give_set_error('username_unavailable', esc_html__('Username already taken.', 'give')); |
|
250 | 250 | } |
251 | 251 | |
252 | - if ( ! validate_username( $data['give_user_login'] ) ) { |
|
253 | - give_set_error( 'username_invalid', esc_html__( 'Invalid username.', 'give' ) ); |
|
252 | + if ( ! validate_username($data['give_user_login'])) { |
|
253 | + give_set_error('username_invalid', esc_html__('Invalid username.', 'give')); |
|
254 | 254 | } |
255 | 255 | |
256 | - if ( email_exists( $data['give_user_email'] ) ) { |
|
257 | - give_set_error( 'email_unavailable', esc_html__( 'Email address already taken.', 'give' ) ); |
|
256 | + if (email_exists($data['give_user_email'])) { |
|
257 | + give_set_error('email_unavailable', esc_html__('Email address already taken.', 'give')); |
|
258 | 258 | } |
259 | 259 | |
260 | - if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) { |
|
261 | - give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) ); |
|
260 | + if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) { |
|
261 | + give_set_error('email_invalid', esc_html__('Invalid email.', 'give')); |
|
262 | 262 | } |
263 | 263 | |
264 | - if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) { |
|
265 | - give_set_error( 'payment_email_invalid', esc_html__( 'Invalid payment email.', 'give' ) ); |
|
264 | + if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) { |
|
265 | + give_set_error('payment_email_invalid', esc_html__('Invalid payment email.', 'give')); |
|
266 | 266 | } |
267 | 267 | |
268 | - if ( empty( $_POST['give_user_pass'] ) ) { |
|
269 | - give_set_error( 'empty_password', esc_html__( 'Please enter a password.', 'give' ) ); |
|
268 | + if (empty($_POST['give_user_pass'])) { |
|
269 | + give_set_error('empty_password', esc_html__('Please enter a password.', 'give')); |
|
270 | 270 | } |
271 | 271 | |
272 | - if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) { |
|
273 | - give_set_error( 'password_mismatch', esc_html__( 'Passwords don\'t match.', 'give' ) ); |
|
272 | + if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) { |
|
273 | + give_set_error('password_mismatch', esc_html__('Passwords don\'t match.', 'give')); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | /** |
@@ -278,29 +278,29 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @since 1.0 |
280 | 280 | */ |
281 | - do_action( 'give_process_register_form' ); |
|
281 | + do_action('give_process_register_form'); |
|
282 | 282 | |
283 | 283 | // Check for errors and redirect if none present |
284 | 284 | $errors = give_get_errors(); |
285 | 285 | |
286 | - if ( empty( $errors ) ) { |
|
286 | + if (empty($errors)) { |
|
287 | 287 | |
288 | - $redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] ); |
|
288 | + $redirect = apply_filters('give_register_redirect', $data['give_redirect']); |
|
289 | 289 | |
290 | - give_register_and_login_new_user( array( |
|
290 | + give_register_and_login_new_user(array( |
|
291 | 291 | 'user_login' => $data['give_user_login'], |
292 | 292 | 'user_pass' => $data['give_user_pass'], |
293 | 293 | 'user_email' => $data['give_user_email'], |
294 | - 'user_registered' => date( 'Y-m-d H:i:s' ), |
|
295 | - 'role' => get_option( 'default_role' ), |
|
296 | - ) ); |
|
294 | + 'user_registered' => date('Y-m-d H:i:s'), |
|
295 | + 'role' => get_option('default_role'), |
|
296 | + )); |
|
297 | 297 | |
298 | - wp_redirect( $redirect ); |
|
298 | + wp_redirect($redirect); |
|
299 | 299 | give_die(); |
300 | 300 | } |
301 | 301 | } |
302 | 302 | |
303 | -add_action( 'give_user_register', 'give_process_register_form' ); |
|
303 | +add_action('give_user_register', 'give_process_register_form'); |
|
304 | 304 | |
305 | 305 | |
306 | 306 | /** |
@@ -313,24 +313,24 @@ discard block |
||
313 | 313 | function give_email_access_login() { |
314 | 314 | |
315 | 315 | // Verify nonce. |
316 | - if ( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'give' ) ) { |
|
316 | + if ( ! isset($_POST['_wpnonce']) || ! wp_verify_nonce($_POST['_wpnonce'], 'give')) { |
|
317 | 317 | return false; |
318 | 318 | } |
319 | 319 | |
320 | 320 | // Need email to proceed. |
321 | - $email = isset( $_POST['give_email'] ) ? give_clean( $_POST['give_email'] ) : ''; |
|
322 | - if ( empty( $email ) ) { |
|
323 | - give_set_error( 'give_empty_email', __( 'Please enter the email address you used for your donation.', 'give' ) ); |
|
321 | + $email = isset($_POST['give_email']) ? give_clean($_POST['give_email']) : ''; |
|
322 | + if (empty($email)) { |
|
323 | + give_set_error('give_empty_email', __('Please enter the email address you used for your donation.', 'give')); |
|
324 | 324 | } |
325 | 325 | |
326 | - $recaptcha_key = give_get_option( 'recaptcha_key' ); |
|
327 | - $recaptcha_secret = give_get_option( 'recaptcha_secret' ); |
|
326 | + $recaptcha_key = give_get_option('recaptcha_key'); |
|
327 | + $recaptcha_secret = give_get_option('recaptcha_secret'); |
|
328 | 328 | |
329 | - $enable_recaptcha = ( give_is_setting_enabled( give_get_option( 'enable_recaptcha' ) ) ) && ! empty( $recaptcha_key ) && ! empty( $recaptcha_secret ) ? true : false; |
|
330 | - $access_token = ! empty( $_GET['payment_key'] ) ? $_GET['payment_key'] : ''; |
|
329 | + $enable_recaptcha = (give_is_setting_enabled(give_get_option('enable_recaptcha'))) && ! empty($recaptcha_key) && ! empty($recaptcha_secret) ? true : false; |
|
330 | + $access_token = ! empty($_GET['payment_key']) ? $_GET['payment_key'] : ''; |
|
331 | 331 | |
332 | 332 | // Use reCAPTCHA. |
333 | - if ( $enable_recaptcha ) { |
|
333 | + if ($enable_recaptcha) { |
|
334 | 334 | |
335 | 335 | $args = array( |
336 | 336 | 'secret' => $recaptcha_secret, |
@@ -338,43 +338,43 @@ discard block |
||
338 | 338 | 'remoteip' => $_POST['give_ip'], |
339 | 339 | ); |
340 | 340 | |
341 | - if ( ! empty( $args['response'] ) ) { |
|
342 | - $request = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', array( |
|
341 | + if ( ! empty($args['response'])) { |
|
342 | + $request = wp_remote_post('https://www.google.com/recaptcha/api/siteverify', array( |
|
343 | 343 | 'body' => $args, |
344 | - ) ); |
|
345 | - if ( ! is_wp_error( $request ) || 200 == wp_remote_retrieve_response_code( $request ) ) { |
|
344 | + )); |
|
345 | + if ( ! is_wp_error($request) || 200 == wp_remote_retrieve_response_code($request)) { |
|
346 | 346 | |
347 | - $response = json_decode( $request['body'], true ); |
|
347 | + $response = json_decode($request['body'], true); |
|
348 | 348 | |
349 | 349 | // reCAPTCHA fail. |
350 | - if ( ! $response['success'] ) { |
|
351 | - give_set_error( 'give_recaptcha_test_failed', apply_filters( 'give_recaptcha_test_failed_message', __( 'reCAPTCHA test failed.', 'give' ) ) ); |
|
350 | + if ( ! $response['success']) { |
|
351 | + give_set_error('give_recaptcha_test_failed', apply_filters('give_recaptcha_test_failed_message', __('reCAPTCHA test failed.', 'give'))); |
|
352 | 352 | } |
353 | 353 | } else { |
354 | 354 | |
355 | 355 | // Connection issue. |
356 | - give_set_error( 'give_recaptcha_connection_issue', apply_filters( 'give_recaptcha_connection_issue_message', __( 'Unable to connect to reCAPTCHA server.', 'give' ) ) ); |
|
356 | + give_set_error('give_recaptcha_connection_issue', apply_filters('give_recaptcha_connection_issue_message', __('Unable to connect to reCAPTCHA server.', 'give'))); |
|
357 | 357 | |
358 | 358 | } // End if(). |
359 | 359 | } else { |
360 | 360 | |
361 | - give_set_error( 'give_recaptcha_failed', apply_filters( 'give_recaptcha_failed_message', __( 'It looks like the reCAPTCHA test has failed.', 'give' ) ) ); |
|
361 | + give_set_error('give_recaptcha_failed', apply_filters('give_recaptcha_failed_message', __('It looks like the reCAPTCHA test has failed.', 'give'))); |
|
362 | 362 | |
363 | 363 | } // End if(). |
364 | 364 | } // End if(). |
365 | 365 | |
366 | 366 | // If no errors or only expired token key error - then send email. |
367 | - if ( ! give_get_errors() ) { |
|
367 | + if ( ! give_get_errors()) { |
|
368 | 368 | |
369 | - $donor = Give()->donors->get_donor_by( 'email', $email ); |
|
369 | + $donor = Give()->donors->get_donor_by('email', $email); |
|
370 | 370 | |
371 | 371 | Give()->email_access->init(); |
372 | 372 | |
373 | 373 | // Verify that donor object is present and donor is connected with its user profile or not. |
374 | - if ( is_object( $donor ) ) { |
|
374 | + if (is_object($donor)) { |
|
375 | 375 | |
376 | 376 | // Verify that email can be sent. |
377 | - if ( ! Give()->email_access->can_send_email( $donor->id ) ) { |
|
377 | + if ( ! Give()->email_access->can_send_email($donor->id)) { |
|
378 | 378 | |
379 | 379 | $_POST['email-access-exhausted'] = true; |
380 | 380 | |
@@ -382,10 +382,10 @@ discard block |
||
382 | 382 | |
383 | 383 | } else { |
384 | 384 | // Send the email. Requests not |
385 | - $email_sent = Give()->email_access->send_email( $donor->id, $donor->email ); |
|
385 | + $email_sent = Give()->email_access->send_email($donor->id, $donor->email); |
|
386 | 386 | |
387 | - if ( ! $email_sent ) { |
|
388 | - give_set_error( 'give_email_access_send_issue', __( 'Unable to send email. Please try again.', 'give' ) ); |
|
387 | + if ( ! $email_sent) { |
|
388 | + give_set_error('give_email_access_send_issue', __('Unable to send email. Please try again.', 'give')); |
|
389 | 389 | return false; |
390 | 390 | } |
391 | 391 | |
@@ -395,11 +395,11 @@ discard block |
||
395 | 395 | } |
396 | 396 | } else { |
397 | 397 | |
398 | - give_set_error( 'give-no-donations', __( 'We were unable to find any donations associated with the email address provided. Please try again using another email.', 'give' ) ); |
|
398 | + give_set_error('give-no-donations', __('We were unable to find any donations associated with the email address provided. Please try again using another email.', 'give')); |
|
399 | 399 | |
400 | 400 | } |
401 | 401 | } // End if(). |
402 | 402 | |
403 | 403 | } |
404 | 404 | |
405 | -add_action( 'give_email_access_form_login', 'give_email_access_login' ); |
|
405 | +add_action('give_email_access_form_login', 'give_email_access_login'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,49 +23,49 @@ discard block |
||
23 | 23 | function give_setup_post_types() { |
24 | 24 | |
25 | 25 | // Give Forms single post and archive options. |
26 | - $give_forms_singular = give_is_setting_enabled( give_get_option( 'forms_singular' ) ); |
|
27 | - $give_forms_archives = give_is_setting_enabled( give_get_option( 'forms_archives' ) ); |
|
26 | + $give_forms_singular = give_is_setting_enabled(give_get_option('forms_singular')); |
|
27 | + $give_forms_archives = give_is_setting_enabled(give_get_option('forms_archives')); |
|
28 | 28 | |
29 | 29 | // Enable/Disable give_forms links if form is saving. |
30 | - if ( Give_Admin_Settings::is_saving_settings() ) { |
|
31 | - if ( isset( $_POST['forms_singular'] ) ) { |
|
32 | - $give_forms_singular = give_is_setting_enabled( give_clean( $_POST['forms_singular'] ) ); |
|
30 | + if (Give_Admin_Settings::is_saving_settings()) { |
|
31 | + if (isset($_POST['forms_singular'])) { |
|
32 | + $give_forms_singular = give_is_setting_enabled(give_clean($_POST['forms_singular'])); |
|
33 | 33 | flush_rewrite_rules(); |
34 | 34 | } |
35 | 35 | |
36 | - if ( isset( $_POST['forms_archives'] ) ) { |
|
37 | - $give_forms_archives = give_is_setting_enabled( give_clean( $_POST['forms_archives'] ) ); |
|
36 | + if (isset($_POST['forms_archives'])) { |
|
37 | + $give_forms_archives = give_is_setting_enabled(give_clean($_POST['forms_archives'])); |
|
38 | 38 | flush_rewrite_rules(); |
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | - $give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations'; |
|
42 | + $give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations'; |
|
43 | 43 | // Support for old 'GIVE_FORMS_SLUG' constant |
44 | - if ( defined( 'GIVE_FORMS_SLUG' ) ) { |
|
44 | + if (defined('GIVE_FORMS_SLUG')) { |
|
45 | 45 | $give_forms_slug = GIVE_FORMS_SLUG; |
46 | 46 | } |
47 | 47 | |
48 | - $give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
48 | + $give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
49 | 49 | 'slug' => $give_forms_slug, |
50 | 50 | 'with_front' => false, |
51 | 51 | ); |
52 | 52 | |
53 | - $give_forms_labels = apply_filters( 'give_forms_labels', array( |
|
54 | - 'name' => __( 'Donation Forms', 'give' ), |
|
55 | - 'singular_name' => __( 'Form', 'give' ), |
|
56 | - 'add_new' => __( 'Add Form', 'give' ), |
|
57 | - 'add_new_item' => __( 'Add New Donation Form', 'give' ), |
|
58 | - 'edit_item' => __( 'Edit Donation Form', 'give' ), |
|
59 | - 'new_item' => __( 'New Form', 'give' ), |
|
60 | - 'all_items' => __( 'All Forms', 'give' ), |
|
61 | - 'view_item' => __( 'View Form', 'give' ), |
|
62 | - 'search_items' => __( 'Search Forms', 'give' ), |
|
63 | - 'not_found' => __( 'No forms found.', 'give' ), |
|
64 | - 'not_found_in_trash' => __( 'No forms found in Trash.', 'give' ), |
|
53 | + $give_forms_labels = apply_filters('give_forms_labels', array( |
|
54 | + 'name' => __('Donation Forms', 'give'), |
|
55 | + 'singular_name' => __('Form', 'give'), |
|
56 | + 'add_new' => __('Add Form', 'give'), |
|
57 | + 'add_new_item' => __('Add New Donation Form', 'give'), |
|
58 | + 'edit_item' => __('Edit Donation Form', 'give'), |
|
59 | + 'new_item' => __('New Form', 'give'), |
|
60 | + 'all_items' => __('All Forms', 'give'), |
|
61 | + 'view_item' => __('View Form', 'give'), |
|
62 | + 'search_items' => __('Search Forms', 'give'), |
|
63 | + 'not_found' => __('No forms found.', 'give'), |
|
64 | + 'not_found_in_trash' => __('No forms found in Trash.', 'give'), |
|
65 | 65 | 'parent_item_colon' => '', |
66 | - 'menu_name' => apply_filters( 'give_menu_name', __( 'Donations', 'give' ) ), |
|
67 | - 'name_admin_bar' => apply_filters( 'give_name_admin_bar_name', __( 'Donation Form', 'give' ) ), |
|
68 | - ) ); |
|
66 | + 'menu_name' => apply_filters('give_menu_name', __('Donations', 'give')), |
|
67 | + 'name_admin_bar' => apply_filters('give_name_admin_bar_name', __('Donation Form', 'give')), |
|
68 | + )); |
|
69 | 69 | |
70 | 70 | // Default give_forms supports. |
71 | 71 | $give_form_supports = array( |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | ); |
78 | 78 | |
79 | 79 | // Has the user disabled the excerpt? |
80 | - if ( ! give_is_setting_enabled( give_get_option( 'forms_excerpt' ) ) ) { |
|
81 | - unset( $give_form_supports[2] ); |
|
80 | + if ( ! give_is_setting_enabled(give_get_option('forms_excerpt'))) { |
|
81 | + unset($give_form_supports[2]); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // Has user disabled the featured image? |
85 | - if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
86 | - unset( $give_form_supports[1] ); |
|
87 | - remove_action( 'give_before_single_form_summary', 'give_show_form_images' ); |
|
85 | + if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
86 | + unset($give_form_supports[1]); |
|
87 | + remove_action('give_before_single_form_summary', 'give_show_form_images'); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | $give_forms_args = array( |
@@ -99,42 +99,42 @@ discard block |
||
99 | 99 | 'has_archive' => $give_forms_archives, |
100 | 100 | 'menu_icon' => 'dashicons-give', |
101 | 101 | 'hierarchical' => false, |
102 | - 'supports' => apply_filters( 'give_forms_supports', $give_form_supports ), |
|
102 | + 'supports' => apply_filters('give_forms_supports', $give_form_supports), |
|
103 | 103 | ); |
104 | - register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) ); |
|
104 | + register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args)); |
|
105 | 105 | |
106 | 106 | /** Donation Post Type */ |
107 | 107 | $payment_labels = array( |
108 | - 'name' => _x( 'Donations', 'post type general name', 'give' ), |
|
109 | - 'singular_name' => _x( 'Donation', 'post type singular name', 'give' ), |
|
110 | - 'add_new' => __( 'Add New', 'give' ), |
|
111 | - 'add_new_item' => __( 'Add New Donation', 'give' ), |
|
112 | - 'edit_item' => __( 'Edit Donation', 'give' ), |
|
113 | - 'new_item' => __( 'New Donation', 'give' ), |
|
114 | - 'all_items' => __( 'All Donations', 'give' ), |
|
115 | - 'view_item' => __( 'View Donation', 'give' ), |
|
116 | - 'search_items' => __( 'Search Donations', 'give' ), |
|
117 | - 'not_found' => __( 'No donations found.', 'give' ), |
|
118 | - 'not_found_in_trash' => __( 'No donations found in Trash.', 'give' ), |
|
108 | + 'name' => _x('Donations', 'post type general name', 'give'), |
|
109 | + 'singular_name' => _x('Donation', 'post type singular name', 'give'), |
|
110 | + 'add_new' => __('Add New', 'give'), |
|
111 | + 'add_new_item' => __('Add New Donation', 'give'), |
|
112 | + 'edit_item' => __('Edit Donation', 'give'), |
|
113 | + 'new_item' => __('New Donation', 'give'), |
|
114 | + 'all_items' => __('All Donations', 'give'), |
|
115 | + 'view_item' => __('View Donation', 'give'), |
|
116 | + 'search_items' => __('Search Donations', 'give'), |
|
117 | + 'not_found' => __('No donations found.', 'give'), |
|
118 | + 'not_found_in_trash' => __('No donations found in Trash.', 'give'), |
|
119 | 119 | 'parent_item_colon' => '', |
120 | - 'menu_name' => __( 'Donations', 'give' ), |
|
120 | + 'menu_name' => __('Donations', 'give'), |
|
121 | 121 | ); |
122 | 122 | |
123 | 123 | $payment_args = array( |
124 | - 'labels' => apply_filters( 'give_payment_labels', $payment_labels ), |
|
124 | + 'labels' => apply_filters('give_payment_labels', $payment_labels), |
|
125 | 125 | 'public' => false, |
126 | 126 | 'query_var' => false, |
127 | 127 | 'rewrite' => false, |
128 | 128 | 'map_meta_cap' => true, |
129 | 129 | 'capability_type' => 'give_payment', |
130 | - 'supports' => array( 'title' ), |
|
130 | + 'supports' => array('title'), |
|
131 | 131 | 'can_export' => true, |
132 | 132 | ); |
133 | - register_post_type( 'give_payment', $payment_args ); |
|
133 | + register_post_type('give_payment', $payment_args); |
|
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | -add_action( 'init', 'give_setup_post_types', 1 ); |
|
137 | +add_action('init', 'give_setup_post_types', 1); |
|
138 | 138 | |
139 | 139 | |
140 | 140 | /** |
@@ -147,30 +147,30 @@ discard block |
||
147 | 147 | */ |
148 | 148 | function give_setup_taxonomies() { |
149 | 149 | |
150 | - $slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations'; |
|
150 | + $slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations'; |
|
151 | 151 | |
152 | 152 | /** Categories */ |
153 | 153 | $category_labels = array( |
154 | - 'name' => _x( 'Form Categories', 'taxonomy general name', 'give' ), |
|
155 | - 'singular_name' => _x( 'Category', 'taxonomy singular name', 'give' ), |
|
156 | - 'search_items' => __( 'Search Categories', 'give' ), |
|
157 | - 'all_items' => __( 'All Categories', 'give' ), |
|
158 | - 'parent_item' => __( 'Parent Category', 'give' ), |
|
159 | - 'parent_item_colon' => __( 'Parent Category:', 'give' ), |
|
160 | - 'edit_item' => __( 'Edit Category', 'give' ), |
|
161 | - 'update_item' => __( 'Update Category', 'give' ), |
|
162 | - 'add_new_item' => __( 'Add New Category', 'give' ), |
|
163 | - 'new_item_name' => __( 'New Category Name', 'give' ), |
|
164 | - 'menu_name' => __( 'Categories', 'give' ), |
|
154 | + 'name' => _x('Form Categories', 'taxonomy general name', 'give'), |
|
155 | + 'singular_name' => _x('Category', 'taxonomy singular name', 'give'), |
|
156 | + 'search_items' => __('Search Categories', 'give'), |
|
157 | + 'all_items' => __('All Categories', 'give'), |
|
158 | + 'parent_item' => __('Parent Category', 'give'), |
|
159 | + 'parent_item_colon' => __('Parent Category:', 'give'), |
|
160 | + 'edit_item' => __('Edit Category', 'give'), |
|
161 | + 'update_item' => __('Update Category', 'give'), |
|
162 | + 'add_new_item' => __('Add New Category', 'give'), |
|
163 | + 'new_item_name' => __('New Category Name', 'give'), |
|
164 | + 'menu_name' => __('Categories', 'give'), |
|
165 | 165 | ); |
166 | 166 | |
167 | - $category_args = apply_filters( 'give_forms_category_args', array( |
|
167 | + $category_args = apply_filters('give_forms_category_args', array( |
|
168 | 168 | 'hierarchical' => true, |
169 | - 'labels' => apply_filters( 'give_forms_category_labels', $category_labels ), |
|
169 | + 'labels' => apply_filters('give_forms_category_labels', $category_labels), |
|
170 | 170 | 'show_ui' => true, |
171 | 171 | 'query_var' => 'give_forms_category', |
172 | 172 | 'rewrite' => array( |
173 | - 'slug' => $slug . '/category', |
|
173 | + 'slug' => $slug.'/category', |
|
174 | 174 | 'with_front' => false, |
175 | 175 | 'hierarchical' => true, |
176 | 176 | ), |
@@ -185,26 +185,26 @@ discard block |
||
185 | 185 | |
186 | 186 | /** Tags */ |
187 | 187 | $tag_labels = array( |
188 | - 'name' => _x( 'Form Tags', 'taxonomy general name', 'give' ), |
|
189 | - 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'give' ), |
|
190 | - 'search_items' => __( 'Search Tags', 'give' ), |
|
191 | - 'all_items' => __( 'All Tags', 'give' ), |
|
192 | - 'parent_item' => __( 'Parent Tag', 'give' ), |
|
193 | - 'parent_item_colon' => __( 'Parent Tag:', 'give' ), |
|
194 | - 'edit_item' => __( 'Edit Tag', 'give' ), |
|
195 | - 'update_item' => __( 'Update Tag', 'give' ), |
|
196 | - 'add_new_item' => __( 'Add New Tag', 'give' ), |
|
197 | - 'new_item_name' => __( 'New Tag Name', 'give' ), |
|
198 | - 'menu_name' => __( 'Tags', 'give' ), |
|
199 | - 'choose_from_most_used' => __( 'Choose from most used tags.', 'give' ), |
|
188 | + 'name' => _x('Form Tags', 'taxonomy general name', 'give'), |
|
189 | + 'singular_name' => _x('Tag', 'taxonomy singular name', 'give'), |
|
190 | + 'search_items' => __('Search Tags', 'give'), |
|
191 | + 'all_items' => __('All Tags', 'give'), |
|
192 | + 'parent_item' => __('Parent Tag', 'give'), |
|
193 | + 'parent_item_colon' => __('Parent Tag:', 'give'), |
|
194 | + 'edit_item' => __('Edit Tag', 'give'), |
|
195 | + 'update_item' => __('Update Tag', 'give'), |
|
196 | + 'add_new_item' => __('Add New Tag', 'give'), |
|
197 | + 'new_item_name' => __('New Tag Name', 'give'), |
|
198 | + 'menu_name' => __('Tags', 'give'), |
|
199 | + 'choose_from_most_used' => __('Choose from most used tags.', 'give'), |
|
200 | 200 | ); |
201 | 201 | |
202 | - $tag_args = apply_filters( 'give_forms_tag_args', array( |
|
202 | + $tag_args = apply_filters('give_forms_tag_args', array( |
|
203 | 203 | 'hierarchical' => false, |
204 | - 'labels' => apply_filters( 'give_forms_tag_labels', $tag_labels ), |
|
204 | + 'labels' => apply_filters('give_forms_tag_labels', $tag_labels), |
|
205 | 205 | 'show_ui' => true, |
206 | 206 | 'query_var' => 'give_forms_tag', |
207 | - 'rewrite' => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ), |
|
207 | + 'rewrite' => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true), |
|
208 | 208 | 'capabilities' => array( |
209 | 209 | 'manage_terms' => 'manage_give_form_terms', |
210 | 210 | 'edit_terms' => 'edit_give_form_terms', |
@@ -215,36 +215,36 @@ discard block |
||
215 | 215 | ); |
216 | 216 | |
217 | 217 | // Does the user want category? |
218 | - $enable_category = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ); |
|
218 | + $enable_category = give_is_setting_enabled(give_get_option('categories', 'disabled')); |
|
219 | 219 | |
220 | 220 | // Does the user want tag? |
221 | - $enable_tag = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ); |
|
221 | + $enable_tag = give_is_setting_enabled(give_get_option('tags', 'disabled')); |
|
222 | 222 | |
223 | 223 | // Enable/Disable category and tag if form is saving. |
224 | - if ( Give_Admin_Settings::is_saving_settings() ) { |
|
225 | - if ( isset( $_POST['categories'] ) ) { |
|
226 | - $enable_category = give_is_setting_enabled( give_clean( $_POST['categories'] ) ); |
|
224 | + if (Give_Admin_Settings::is_saving_settings()) { |
|
225 | + if (isset($_POST['categories'])) { |
|
226 | + $enable_category = give_is_setting_enabled(give_clean($_POST['categories'])); |
|
227 | 227 | flush_rewrite_rules(); |
228 | 228 | } |
229 | 229 | |
230 | - if ( isset( $_POST['tags'] ) ) { |
|
231 | - $enable_tag = give_is_setting_enabled( give_clean( $_POST['tags'] ) ); |
|
230 | + if (isset($_POST['tags'])) { |
|
231 | + $enable_tag = give_is_setting_enabled(give_clean($_POST['tags'])); |
|
232 | 232 | flush_rewrite_rules(); |
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | - if ( $enable_category ) { |
|
237 | - register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args ); |
|
238 | - register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' ); |
|
236 | + if ($enable_category) { |
|
237 | + register_taxonomy('give_forms_category', array('give_forms'), $category_args); |
|
238 | + register_taxonomy_for_object_type('give_forms_category', 'give_forms'); |
|
239 | 239 | } |
240 | 240 | |
241 | - if ( $enable_tag ) { |
|
242 | - register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args ); |
|
243 | - register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' ); |
|
241 | + if ($enable_tag) { |
|
242 | + register_taxonomy('give_forms_tag', array('give_forms'), $tag_args); |
|
243 | + register_taxonomy_for_object_type('give_forms_tag', 'give_forms'); |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
247 | -add_action( 'init', 'give_setup_taxonomies', 0 ); |
|
247 | +add_action('init', 'give_setup_taxonomies', 0); |
|
248 | 248 | |
249 | 249 | |
250 | 250 | /** |
@@ -255,11 +255,11 @@ discard block |
||
255 | 255 | */ |
256 | 256 | function give_get_default_form_labels() { |
257 | 257 | $defaults = array( |
258 | - 'singular' => __( 'Form', 'give' ), |
|
259 | - 'plural' => __( 'Forms', 'give' ), |
|
258 | + 'singular' => __('Form', 'give'), |
|
259 | + 'plural' => __('Forms', 'give'), |
|
260 | 260 | ); |
261 | 261 | |
262 | - return apply_filters( 'give_default_form_name', $defaults ); |
|
262 | + return apply_filters('give_default_form_name', $defaults); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @return string $defaults['singular'] Singular label |
273 | 273 | */ |
274 | -function give_get_forms_label_singular( $lowercase = false ) { |
|
274 | +function give_get_forms_label_singular($lowercase = false) { |
|
275 | 275 | $defaults = give_get_default_form_labels(); |
276 | 276 | |
277 | - return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular']; |
|
277 | + return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular']; |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -283,10 +283,10 @@ discard block |
||
283 | 283 | * @since 1.0 |
284 | 284 | * @return string $defaults['plural'] Plural label |
285 | 285 | */ |
286 | -function give_get_forms_label_plural( $lowercase = false ) { |
|
286 | +function give_get_forms_label_plural($lowercase = false) { |
|
287 | 287 | $defaults = give_get_default_form_labels(); |
288 | 288 | |
289 | - return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural']; |
|
289 | + return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural']; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
@@ -298,24 +298,24 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @return string $title New placeholder text |
300 | 300 | */ |
301 | -function give_change_default_title( $title ) { |
|
301 | +function give_change_default_title($title) { |
|
302 | 302 | // If a frontend plugin uses this filter (check extensions before changing this function) |
303 | - if ( ! is_admin() ) { |
|
304 | - $title = __( 'Enter form title here', 'give' ); |
|
303 | + if ( ! is_admin()) { |
|
304 | + $title = __('Enter form title here', 'give'); |
|
305 | 305 | |
306 | 306 | return $title; |
307 | 307 | } |
308 | 308 | |
309 | 309 | $screen = get_current_screen(); |
310 | 310 | |
311 | - if ( 'give_forms' == $screen->post_type ) { |
|
312 | - $title = __( 'Enter form title here', 'give' ); |
|
311 | + if ('give_forms' == $screen->post_type) { |
|
312 | + $title = __('Enter form title here', 'give'); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | return $title; |
316 | 316 | } |
317 | 317 | |
318 | -add_filter( 'enter_title_here', 'give_change_default_title' ); |
|
318 | +add_filter('enter_title_here', 'give_change_default_title'); |
|
319 | 319 | |
320 | 320 | /** |
321 | 321 | * Registers Custom Post Statuses which are used by the Payments |
@@ -325,67 +325,67 @@ discard block |
||
325 | 325 | */ |
326 | 326 | function give_register_post_type_statuses() { |
327 | 327 | // Payment Statuses |
328 | - register_post_status( 'refunded', array( |
|
329 | - 'label' => __( 'Refunded', 'give' ), |
|
328 | + register_post_status('refunded', array( |
|
329 | + 'label' => __('Refunded', 'give'), |
|
330 | 330 | 'public' => true, |
331 | 331 | 'exclude_from_search' => false, |
332 | 332 | 'show_in_admin_all_list' => true, |
333 | 333 | 'show_in_admin_status_list' => true, |
334 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ), |
|
335 | - ) ); |
|
336 | - register_post_status( 'failed', array( |
|
337 | - 'label' => __( 'Failed', 'give' ), |
|
334 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give'), |
|
335 | + )); |
|
336 | + register_post_status('failed', array( |
|
337 | + 'label' => __('Failed', 'give'), |
|
338 | 338 | 'public' => true, |
339 | 339 | 'exclude_from_search' => false, |
340 | 340 | 'show_in_admin_all_list' => true, |
341 | 341 | 'show_in_admin_status_list' => true, |
342 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ), |
|
343 | - ) ); |
|
344 | - register_post_status( 'revoked', array( |
|
345 | - 'label' => __( 'Revoked', 'give' ), |
|
342 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give'), |
|
343 | + )); |
|
344 | + register_post_status('revoked', array( |
|
345 | + 'label' => __('Revoked', 'give'), |
|
346 | 346 | 'public' => true, |
347 | 347 | 'exclude_from_search' => false, |
348 | 348 | 'show_in_admin_all_list' => true, |
349 | 349 | 'show_in_admin_status_list' => true, |
350 | - 'label_count' => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ), |
|
351 | - ) ); |
|
352 | - register_post_status( 'cancelled', array( |
|
353 | - 'label' => __( 'Cancelled', 'give' ), |
|
350 | + 'label_count' => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give'), |
|
351 | + )); |
|
352 | + register_post_status('cancelled', array( |
|
353 | + 'label' => __('Cancelled', 'give'), |
|
354 | 354 | 'public' => true, |
355 | 355 | 'exclude_from_search' => false, |
356 | 356 | 'show_in_admin_all_list' => true, |
357 | 357 | 'show_in_admin_status_list' => true, |
358 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ), |
|
359 | - ) ); |
|
360 | - register_post_status( 'abandoned', array( |
|
361 | - 'label' => __( 'Abandoned', 'give' ), |
|
358 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give'), |
|
359 | + )); |
|
360 | + register_post_status('abandoned', array( |
|
361 | + 'label' => __('Abandoned', 'give'), |
|
362 | 362 | 'public' => true, |
363 | 363 | 'exclude_from_search' => false, |
364 | 364 | 'show_in_admin_all_list' => true, |
365 | 365 | 'show_in_admin_status_list' => true, |
366 | - 'label_count' => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ), |
|
367 | - ) ); |
|
368 | - register_post_status( 'processing', array( |
|
369 | - 'label' => _x( 'Processing', 'Processing payment status', 'give' ), |
|
366 | + 'label_count' => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give'), |
|
367 | + )); |
|
368 | + register_post_status('processing', array( |
|
369 | + 'label' => _x('Processing', 'Processing payment status', 'give'), |
|
370 | 370 | 'public' => true, |
371 | 371 | 'exclude_from_search' => false, |
372 | 372 | 'show_in_admin_all_list' => true, |
373 | 373 | 'show_in_admin_status_list' => true, |
374 | - 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'give' ) |
|
375 | - ) ); |
|
374 | + 'label_count' => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'give') |
|
375 | + )); |
|
376 | 376 | |
377 | - register_post_status( 'preapproval', array( |
|
378 | - 'label' => _x( 'Preapproval', 'Preapproval payment status', 'give' ), |
|
377 | + register_post_status('preapproval', array( |
|
378 | + 'label' => _x('Preapproval', 'Preapproval payment status', 'give'), |
|
379 | 379 | 'public' => true, |
380 | 380 | 'exclude_from_search' => false, |
381 | 381 | 'show_in_admin_all_list' => true, |
382 | 382 | 'show_in_admin_status_list' => true, |
383 | - 'label_count' => _n_noop( 'Preapproval <span class="count">(%s)</span>', 'Preapproval <span class="count">(%s)</span>', 'give' ), |
|
384 | - ) ); |
|
383 | + 'label_count' => _n_noop('Preapproval <span class="count">(%s)</span>', 'Preapproval <span class="count">(%s)</span>', 'give'), |
|
384 | + )); |
|
385 | 385 | |
386 | 386 | } |
387 | 387 | |
388 | -add_action( 'init', 'give_register_post_type_statuses' ); |
|
388 | +add_action('init', 'give_register_post_type_statuses'); |
|
389 | 389 | |
390 | 390 | /** |
391 | 391 | * Updated Messages |
@@ -398,27 +398,27 @@ discard block |
||
398 | 398 | * |
399 | 399 | * @return array $messages New post updated messages |
400 | 400 | */ |
401 | -function give_updated_messages( $messages ) { |
|
401 | +function give_updated_messages($messages) { |
|
402 | 402 | global $post, $post_ID; |
403 | 403 | |
404 | - if ( ! give_is_setting_enabled( give_get_option( 'forms_singular' ) ) ) { |
|
404 | + if ( ! give_is_setting_enabled(give_get_option('forms_singular'))) { |
|
405 | 405 | |
406 | 406 | $messages['give_forms'] = array( |
407 | - 1 => __( 'Form updated.', 'give' ), |
|
408 | - 4 => __( 'Form updated.', 'give' ), |
|
409 | - 6 => __( 'Form published.', 'give' ), |
|
410 | - 7 => __( 'Form saved.', 'give' ), |
|
411 | - 8 => __( 'Form submitted.', 'give' ), |
|
407 | + 1 => __('Form updated.', 'give'), |
|
408 | + 4 => __('Form updated.', 'give'), |
|
409 | + 6 => __('Form published.', 'give'), |
|
410 | + 7 => __('Form saved.', 'give'), |
|
411 | + 8 => __('Form submitted.', 'give'), |
|
412 | 412 | ); |
413 | 413 | |
414 | 414 | } else { |
415 | 415 | |
416 | 416 | $messages['give_forms'] = array( |
417 | - 1 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
418 | - 4 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
419 | - 6 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form published.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
420 | - 7 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form saved.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
421 | - 8 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form submitted.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
417 | + 1 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form updated.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
418 | + 4 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form updated.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
419 | + 6 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form published.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
420 | + 7 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form saved.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
421 | + 8 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form submitted.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
422 | 422 | ); |
423 | 423 | |
424 | 424 | } |
@@ -426,24 +426,24 @@ discard block |
||
426 | 426 | return $messages; |
427 | 427 | } |
428 | 428 | |
429 | -add_filter( 'post_updated_messages', 'give_updated_messages' ); |
|
429 | +add_filter('post_updated_messages', 'give_updated_messages'); |
|
430 | 430 | |
431 | 431 | /** |
432 | 432 | * Ensure post thumbnail support is turned on |
433 | 433 | */ |
434 | 434 | function give_add_thumbnail_support() { |
435 | - if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
435 | + if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
436 | 436 | return; |
437 | 437 | } |
438 | 438 | |
439 | - if ( ! current_theme_supports( 'post-thumbnails' ) ) { |
|
440 | - add_theme_support( 'post-thumbnails' ); |
|
439 | + if ( ! current_theme_supports('post-thumbnails')) { |
|
440 | + add_theme_support('post-thumbnails'); |
|
441 | 441 | } |
442 | 442 | |
443 | - add_post_type_support( 'give_forms', 'thumbnail' ); |
|
443 | + add_post_type_support('give_forms', 'thumbnail'); |
|
444 | 444 | } |
445 | 445 | |
446 | -add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 ); |
|
446 | +add_action('after_setup_theme', 'give_add_thumbnail_support', 10); |
|
447 | 447 | |
448 | 448 | /** |
449 | 449 | * Give Sidebars |
@@ -454,21 +454,21 @@ discard block |
||
454 | 454 | |
455 | 455 | // Single Give Forms (disabled if single turned off in settings) |
456 | 456 | if ( |
457 | - give_is_setting_enabled( give_get_option( 'forms_singular' ) ) |
|
458 | - && give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) |
|
457 | + give_is_setting_enabled(give_get_option('forms_singular')) |
|
458 | + && give_is_setting_enabled(give_get_option('form_sidebar')) |
|
459 | 459 | ) { |
460 | 460 | |
461 | - register_sidebar( apply_filters( 'give_forms_single_sidebar', array( |
|
462 | - 'name' => __( 'Give Single Form Sidebar', 'give' ), |
|
461 | + register_sidebar(apply_filters('give_forms_single_sidebar', array( |
|
462 | + 'name' => __('Give Single Form Sidebar', 'give'), |
|
463 | 463 | 'id' => 'give-forms-sidebar', |
464 | - 'description' => __( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ), |
|
464 | + 'description' => __('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'), |
|
465 | 465 | 'before_widget' => '<div id="%1$s" class="widget %2$s">', |
466 | 466 | 'after_widget' => '</div>', |
467 | 467 | 'before_title' => '<h3 class="widgettitle widget-title">', |
468 | 468 | 'after_title' => '</h3>', |
469 | - ) ) ); |
|
469 | + ))); |
|
470 | 470 | |
471 | 471 | } |
472 | 472 | } |
473 | 473 | |
474 | -add_action( 'widgets_init', 'give_widgets_init', 999 ); |
|
474 | +add_action('widgets_init', 'give_widgets_init', 999); |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Earnings_Report' ) ) : |
|
16 | +if ( ! class_exists('Give_Earnings_Report')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Earnings_Report. |
@@ -35,16 +35,16 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | 37 | $this->id = 'earnings'; |
38 | - $this->label = esc_html__( 'Income', 'give' ); |
|
38 | + $this->label = esc_html__('Income', 'give'); |
|
39 | 39 | |
40 | 40 | parent::__construct(); |
41 | 41 | |
42 | - add_action( 'give_admin_field_report_earnings', array( $this, 'render_report_earnings_field' ), 10, 2 ); |
|
42 | + add_action('give_admin_field_report_earnings', array($this, 'render_report_earnings_field'), 10, 2); |
|
43 | 43 | |
44 | 44 | // Do not use main form for this tab. |
45 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
46 | - add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
47 | - add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
45 | + if (give_get_current_setting_tab() === $this->id) { |
|
46 | + add_action('give-reports_open_form', '__return_empty_string'); |
|
47 | + add_action('give-reports_close_form', '__return_empty_string'); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param array $settings |
65 | 65 | */ |
66 | 66 | $settings = apply_filters( |
67 | - 'give_get_settings_' . $this->id, |
|
67 | + 'give_get_settings_'.$this->id, |
|
68 | 68 | array( |
69 | 69 | array( |
70 | 70 | 'id' => 'give_tools_earnings', |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | 'id' => 'earnings', |
76 | - 'name' => esc_html__( 'Income', 'give' ), |
|
76 | + 'name' => esc_html__('Income', 'give'), |
|
77 | 77 | 'type' => 'report_earnings', |
78 | 78 | ), |
79 | 79 | array( |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | * @param $field |
98 | 98 | * @param $option_value |
99 | 99 | */ |
100 | - public function render_report_earnings_field( $field, $option_value ) { |
|
101 | - do_action( 'give_reports_view_earnings' ); |
|
100 | + public function render_report_earnings_field($field, $option_value) { |
|
101 | + do_action('give_reports_view_earnings'); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Forms_Report' ) ) : |
|
16 | +if ( ! class_exists('Give_Forms_Report')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Forms_Report. |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | 36 | $this->id = 'forms'; |
37 | - $this->label = esc_html__( 'Forms', 'give' ); |
|
37 | + $this->label = esc_html__('Forms', 'give'); |
|
38 | 38 | |
39 | 39 | parent::__construct(); |
40 | 40 | |
41 | - add_action( 'give_admin_field_report_forms', array( $this, 'render_report_forms_field' ), 10, 2 ); |
|
41 | + add_action('give_admin_field_report_forms', array($this, 'render_report_forms_field'), 10, 2); |
|
42 | 42 | |
43 | 43 | // Do not use main form for this tab. |
44 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
45 | - add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
46 | - add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
44 | + if (give_get_current_setting_tab() === $this->id) { |
|
45 | + add_action('give-reports_open_form', '__return_empty_string'); |
|
46 | + add_action('give-reports_close_form', '__return_empty_string'); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param array $settings |
64 | 64 | */ |
65 | 65 | $settings = apply_filters( |
66 | - 'give_get_settings_' . $this->id, |
|
66 | + 'give_get_settings_'.$this->id, |
|
67 | 67 | array( |
68 | 68 | array( |
69 | 69 | 'id' => 'give_reports_forms', |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | ), |
73 | 73 | array( |
74 | 74 | 'id' => 'forms', |
75 | - 'name' => esc_html__( 'Forms', 'give' ), |
|
75 | + 'name' => esc_html__('Forms', 'give'), |
|
76 | 76 | 'type' => 'report_forms', |
77 | 77 | ), |
78 | 78 | array( |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | * @param $field |
97 | 97 | * @param $option_value |
98 | 98 | */ |
99 | - public function render_report_forms_field( $field, $option_value ) { |
|
100 | - do_action( 'give_reports_view_forms' ); |
|
99 | + public function render_report_forms_field($field, $option_value) { |
|
100 | + do_action('give_reports_view_forms'); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Gateways_Report' ) ) : |
|
16 | +if ( ! class_exists('Give_Gateways_Report')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Gateways_Report. |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | 36 | $this->id = 'gateways'; |
37 | - $this->label = esc_html__( 'Donation Methods', 'give' ); |
|
37 | + $this->label = esc_html__('Donation Methods', 'give'); |
|
38 | 38 | |
39 | 39 | parent::__construct(); |
40 | 40 | |
41 | - add_action( 'give_admin_field_report_gateways', array( $this, 'render_report_gateways_field' ), 10, 2 ); |
|
41 | + add_action('give_admin_field_report_gateways', array($this, 'render_report_gateways_field'), 10, 2); |
|
42 | 42 | |
43 | 43 | // Do not use main form for this tab. |
44 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
45 | - add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
46 | - add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
44 | + if (give_get_current_setting_tab() === $this->id) { |
|
45 | + add_action('give-reports_open_form', '__return_empty_string'); |
|
46 | + add_action('give-reports_close_form', '__return_empty_string'); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param array $settings |
76 | 76 | */ |
77 | 77 | $settings = apply_filters( |
78 | - 'give_get_settings_' . $this->id, |
|
78 | + 'give_get_settings_'.$this->id, |
|
79 | 79 | array( |
80 | 80 | array( |
81 | 81 | 'id' => 'give_reports_gateways', |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | ), |
85 | 85 | array( |
86 | 86 | 'id' => 'gateways', |
87 | - 'name' => esc_html__( 'Gateways', 'give' ), |
|
87 | + 'name' => esc_html__('Gateways', 'give'), |
|
88 | 88 | 'type' => 'report_gateways', |
89 | 89 | ), |
90 | 90 | array( |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * @param $field |
109 | 109 | * @param $option_value |
110 | 110 | */ |
111 | - public function render_report_gateways_field( $field, $option_value ) { |
|
112 | - do_action( 'give_reports_view_gateways' ); |
|
111 | + public function render_report_gateways_field($field, $option_value) { |
|
112 | + do_action('give_reports_view_gateways'); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | global $status, $page; |
57 | 57 | |
58 | 58 | // Set parent defaults |
59 | - parent::__construct( array( |
|
60 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
61 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
59 | + parent::__construct(array( |
|
60 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
61 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
62 | 62 | 'ajax' => false // Does this table support ajax? |
63 | - ) ); |
|
63 | + )); |
|
64 | 64 | |
65 | - add_action( 'give_report_view_actions', array( $this, 'category_filter' ) ); |
|
65 | + add_action('give_report_view_actions', array($this, 'category_filter')); |
|
66 | 66 | $this->query(); |
67 | 67 | |
68 | 68 | } |
@@ -78,32 +78,32 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return string Column Name |
80 | 80 | */ |
81 | - public function column_default( $item, $column_name ) { |
|
82 | - switch ( $column_name ) { |
|
81 | + public function column_default($item, $column_name) { |
|
82 | + switch ($column_name) { |
|
83 | 83 | case 'title': |
84 | - $title = empty( $item['title'] ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item['ID'] ) : $item['title']; |
|
84 | + $title = empty($item['title']) ? sprintf(__('Untitled (#%s)', 'give'), $item['ID']) : $item['title']; |
|
85 | 85 | |
86 | 86 | return sprintf( |
87 | 87 | '<a href="%s">%s</a>', |
88 | - get_edit_post_link( $item['ID'] ), |
|
88 | + get_edit_post_link($item['ID']), |
|
89 | 89 | $title |
90 | 90 | ); |
91 | 91 | case 'sales': |
92 | 92 | return sprintf( |
93 | 93 | '<a href="%s">%s</a>', |
94 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . urlencode( $item['ID'] ) ), |
|
94 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.urlencode($item['ID'])), |
|
95 | 95 | $item['sales'] |
96 | 96 | ); |
97 | 97 | case 'earnings' : |
98 | - return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); |
|
98 | + return give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false))); |
|
99 | 99 | case 'average_sales' : |
100 | - return round( $item[ $column_name ] ); |
|
100 | + return round($item[$column_name]); |
|
101 | 101 | case 'average_earnings' : |
102 | - return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); |
|
102 | + return give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false))); |
|
103 | 103 | case 'details' : |
104 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $item['ID'] ) . '">' . esc_html__( 'View Detailed Report', 'give' ) . '</a>'; |
|
104 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$item['ID']).'">'.esc_html__('View Detailed Report', 'give').'</a>'; |
|
105 | 105 | default: |
106 | - return $item[ $column_name ]; |
|
106 | + return $item[$column_name]; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function get_columns() { |
119 | 119 | $columns = array( |
120 | - 'title' => esc_html__( 'Form', 'give' ), |
|
121 | - 'sales' => esc_html__( 'Donations', 'give' ), |
|
122 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
123 | - 'average_sales' => esc_html__( 'Monthly Average Donations', 'give' ), |
|
124 | - 'average_earnings' => esc_html__( 'Monthly Average Income', 'give' ), |
|
125 | - 'details' => esc_html__( 'Detailed Report', 'give' ) |
|
120 | + 'title' => esc_html__('Form', 'give'), |
|
121 | + 'sales' => esc_html__('Donations', 'give'), |
|
122 | + 'earnings' => esc_html__('Income', 'give'), |
|
123 | + 'average_sales' => esc_html__('Monthly Average Donations', 'give'), |
|
124 | + 'average_earnings' => esc_html__('Monthly Average Income', 'give'), |
|
125 | + 'details' => esc_html__('Detailed Report', 'give') |
|
126 | 126 | ); |
127 | 127 | |
128 | 128 | return $columns; |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function get_sortable_columns() { |
140 | 140 | return array( |
141 | - 'title' => array( 'title', true ), |
|
142 | - 'sales' => array( 'sales', false ), |
|
143 | - 'earnings' => array( 'earnings', false ), |
|
141 | + 'title' => array('title', true), |
|
142 | + 'sales' => array('sales', false), |
|
143 | + 'earnings' => array('earnings', false), |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @return int Current page number |
154 | 154 | */ |
155 | 155 | public function get_paged() { |
156 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
156 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @return int Category ID |
166 | 166 | */ |
167 | 167 | public function get_category() { |
168 | - return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0; |
|
168 | + return isset($_GET['category']) ? absint($_GET['category']) : 0; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @return void |
178 | 178 | */ |
179 | - public function bulk_actions( $which = '' ) { |
|
179 | + public function bulk_actions($which = '') { |
|
180 | 180 | |
181 | 181 | } |
182 | 182 | |
@@ -188,27 +188,27 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @param string $which |
190 | 190 | */ |
191 | - protected function display_tablenav( $which ) { |
|
191 | + protected function display_tablenav($which) { |
|
192 | 192 | |
193 | - if ( 'top' === $which ) { |
|
194 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
193 | + if ('top' === $which) { |
|
194 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
195 | 195 | } |
196 | 196 | ?> |
197 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
197 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
198 | 198 | |
199 | - <?php if ( 'top' === $which ) { ?> |
|
199 | + <?php if ('top' === $which) { ?> |
|
200 | 200 | <h2 class="alignleft reports-earnings-title screen-reader-text"> |
201 | - <?php _e( 'Donation Forms Report', 'give' ); ?> |
|
201 | + <?php _e('Donation Forms Report', 'give'); ?> |
|
202 | 202 | </h2> |
203 | 203 | <?php } ?> |
204 | 204 | |
205 | 205 | <div class="alignright tablenav-right"> |
206 | 206 | <div class="actions bulkactions"> |
207 | - <?php $this->bulk_actions( $which ); ?> |
|
207 | + <?php $this->bulk_actions($which); ?> |
|
208 | 208 | </div> |
209 | 209 | <?php |
210 | - $this->extra_tablenav( $which ); |
|
211 | - $this->pagination( $which ); |
|
210 | + $this->extra_tablenav($which); |
|
211 | + $this->pagination($which); |
|
212 | 212 | ?> |
213 | 213 | </div> |
214 | 214 | |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function category_filter() { |
230 | 230 | |
231 | - $categories = get_terms( 'form_category' ); |
|
232 | - if ( $categories && ! is_wp_error( $categories ) ) { |
|
233 | - echo Give()->html->category_dropdown( 'category', $this->get_category() ); |
|
231 | + $categories = get_terms('form_category'); |
|
232 | + if ($categories && ! is_wp_error($categories)) { |
|
233 | + echo Give()->html->category_dropdown('category', $this->get_category()); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function query() { |
246 | 246 | |
247 | - $orderby = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title'; |
|
248 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
247 | + $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'title'; |
|
248 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
249 | 249 | $category = $this->get_category(); |
250 | 250 | |
251 | 251 | $args = array( |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | 'suppress_filters' => true |
259 | 259 | ); |
260 | 260 | |
261 | - if ( ! empty( $category ) ) { |
|
261 | + if ( ! empty($category)) { |
|
262 | 262 | $args['tax_query'] = array( |
263 | 263 | array( |
264 | 264 | 'taxonomy' => 'form_category', |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | ); |
268 | 268 | } |
269 | 269 | |
270 | - switch ( $orderby ) : |
|
270 | + switch ($orderby) : |
|
271 | 271 | case 'title' : |
272 | 272 | $args['orderby'] = 'title'; |
273 | 273 | break; |
@@ -283,9 +283,9 @@ discard block |
||
283 | 283 | break; |
284 | 284 | endswitch; |
285 | 285 | |
286 | - $args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this ); |
|
286 | + $args = apply_filters('give_form_reports_prepare_items_args', $args, $this); |
|
287 | 287 | |
288 | - $this->donation_forms = new WP_Query( $args ); |
|
288 | + $this->donation_forms = new WP_Query($args); |
|
289 | 289 | |
290 | 290 | // Store total number of donation forms count. |
291 | 291 | $this->count = $this->donation_forms->found_posts; |
@@ -305,15 +305,15 @@ discard block |
||
305 | 305 | |
306 | 306 | $give_forms = $this->donation_forms->posts; |
307 | 307 | |
308 | - if ( $give_forms ) { |
|
309 | - foreach ( $give_forms as $form ) { |
|
308 | + if ($give_forms) { |
|
309 | + foreach ($give_forms as $form) { |
|
310 | 310 | $reports_data[] = array( |
311 | 311 | 'ID' => $form, |
312 | - 'title' => get_the_title( $form ), |
|
313 | - 'sales' => give_get_form_sales_stats( $form ), |
|
314 | - 'earnings' => give_get_form_earnings_stats( $form ), |
|
315 | - 'average_sales' => give_get_average_monthly_form_sales( $form ), |
|
316 | - 'average_earnings' => give_get_average_monthly_form_earnings( $form ) |
|
312 | + 'title' => get_the_title($form), |
|
313 | + 'sales' => give_get_form_sales_stats($form), |
|
314 | + 'earnings' => give_get_form_earnings_stats($form), |
|
315 | + 'average_sales' => give_get_average_monthly_form_sales($form), |
|
316 | + 'average_earnings' => give_get_average_monthly_form_earnings($form) |
|
317 | 317 | ); |
318 | 318 | } |
319 | 319 | } |
@@ -338,14 +338,14 @@ discard block |
||
338 | 338 | $columns = $this->get_columns(); |
339 | 339 | $hidden = array(); // No hidden columns |
340 | 340 | $sortable = $this->get_sortable_columns(); |
341 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
341 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
342 | 342 | $this->items = $this->reports_data(); |
343 | 343 | $total_items = $this->count; |
344 | 344 | |
345 | - $this->set_pagination_args( array( |
|
345 | + $this->set_pagination_args(array( |
|
346 | 346 | 'total_items' => $total_items, |
347 | 347 | 'per_page' => $this->per_page, |
348 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
348 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
349 | 349 | ) |
350 | 350 | ); |
351 | 351 | } |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_API' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_API')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_API. |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | 36 | $this->id = 'api'; |
37 | - $this->label = esc_html__( 'API', 'give' ); |
|
37 | + $this->label = esc_html__('API', 'give'); |
|
38 | 38 | |
39 | 39 | parent::__construct(); |
40 | 40 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function get_settings() { |
49 | 49 | // Get settings. |
50 | - $settings = apply_filters( 'give_settings_api', array( |
|
50 | + $settings = apply_filters('give_settings_api', array( |
|
51 | 51 | array( |
52 | 52 | 'id' => 'give_tools_api', |
53 | 53 | 'type' => 'title', |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | ), |
56 | 56 | array( |
57 | 57 | 'id' => 'api', |
58 | - 'name' => esc_html__( 'API', 'give' ), |
|
58 | + 'name' => esc_html__('API', 'give'), |
|
59 | 59 | 'type' => 'api', |
60 | 60 | ), |
61 | 61 | array( |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @since 1.8 |
72 | 72 | * @param array $settings |
73 | 73 | */ |
74 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
74 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
75 | 75 | |
76 | 76 | // Output. |
77 | 77 | return $settings; |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Data' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Data')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Data. |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | 37 | $this->id = 'data'; |
38 | - $this->label = esc_html__( 'Data', 'give' ); |
|
38 | + $this->label = esc_html__('Data', 'give'); |
|
39 | 39 | |
40 | 40 | parent::__construct(); |
41 | 41 | |
42 | 42 | // Do not use main form for this tab. |
43 | - if( give_get_current_setting_tab() === $this->id ) { |
|
44 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
45 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
43 | + if (give_get_current_setting_tab() === $this->id) { |
|
44 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
45 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function get_settings() { |
56 | 56 | // Get settings. |
57 | - $settings = apply_filters( 'give_settings_data', array( |
|
57 | + $settings = apply_filters('give_settings_data', array( |
|
58 | 58 | array( |
59 | 59 | 'id' => 'give_tools_tools', |
60 | 60 | 'type' => 'title', |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | ), |
63 | 63 | array( |
64 | 64 | 'id' => 'api', |
65 | - 'name' => esc_html__( 'Tools', 'give' ), |
|
65 | + 'name' => esc_html__('Tools', 'give'), |
|
66 | 66 | 'type' => 'data', |
67 | 67 | ), |
68 | 68 | array( |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @since 1.8 |
79 | 79 | * @param array $settings |
80 | 80 | */ |
81 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
81 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
82 | 82 | |
83 | 83 | // Output. |
84 | 84 | return $settings; |