@@ -7,21 +7,21 @@ discard block |
||
7 | 7 | * @copyright Copyright (c) 2016, WordImpress |
8 | 8 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
9 | 9 | */ |
10 | -$current_user = wp_get_current_user(); |
|
10 | +$current_user = wp_get_current_user(); |
|
11 | 11 | |
12 | -if ( is_user_logged_in() ) : |
|
12 | +if (is_user_logged_in()) : |
|
13 | 13 | $user_id = get_current_user_id(); |
14 | - $first_name = get_user_meta( $user_id, 'first_name', true ); |
|
15 | - $last_name = get_user_meta( $user_id, 'last_name', true ); |
|
14 | + $first_name = get_user_meta($user_id, 'first_name', true); |
|
15 | + $last_name = get_user_meta($user_id, 'last_name', true); |
|
16 | 16 | $display_name = $current_user->display_name; |
17 | - $address = give_get_donor_address( $user_id, array( 'address_type' => 'personal' ) ); |
|
17 | + $address = give_get_donor_address($user_id, array('address_type' => 'personal')); |
|
18 | 18 | |
19 | - if ( isset( $_GET['updated'] ) && 'true' === $_GET['updated'] && ! give_get_errors() ) : |
|
20 | - if ( isset( $_GET['update_code'] ) ) :?> |
|
19 | + if (isset($_GET['updated']) && 'true' === $_GET['updated'] && ! give_get_errors()) : |
|
20 | + if (isset($_GET['update_code'])) :?> |
|
21 | 21 | <?php |
22 | - switch ( $_GET['update_code'] ) { |
|
22 | + switch ($_GET['update_code']) { |
|
23 | 23 | case '1': |
24 | - printf( '<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__( 'Success:', 'give' ), esc_html__( 'Your profile has been updated.', 'give' ) ); |
|
24 | + printf('<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__('Success:', 'give'), esc_html__('Your profile has been updated.', 'give')); |
|
25 | 25 | break; |
26 | 26 | } |
27 | 27 | ?> |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | <?php endif; ?> |
30 | 30 | <?php endif; ?> |
31 | 31 | |
32 | - <?php Give()->notices->render_frontend_notices( 0 ); ?> |
|
32 | + <?php Give()->notices->render_frontend_notices(0); ?> |
|
33 | 33 | |
34 | 34 | <?php |
35 | 35 | /** |
@@ -39,42 +39,42 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @since 1.0 |
41 | 41 | */ |
42 | - do_action( 'give_profile_editor_before' ); |
|
42 | + do_action('give_profile_editor_before'); |
|
43 | 43 | ?> |
44 | 44 | |
45 | 45 | <form id="give_profile_editor_form" class="give-form" action="<?php echo give_get_current_page_url(); ?>" method="post"> |
46 | 46 | |
47 | 47 | <fieldset> |
48 | - <legend id="give_profile_name_label"><?php _e( 'Profile', 'give' ); ?></legend> |
|
48 | + <legend id="give_profile_name_label"><?php _e('Profile', 'give'); ?></legend> |
|
49 | 49 | |
50 | - <h3 id="give_personal_information_label" class="give-section-break"><?php _e( 'Change your Name', 'give' ); ?></h3> |
|
50 | + <h3 id="give_personal_information_label" class="give-section-break"><?php _e('Change your Name', 'give'); ?></h3> |
|
51 | 51 | |
52 | 52 | <p id="give_profile_first_name_wrap" class="form-row form-row-first form-row-responsive"> |
53 | 53 | <label for="give_first_name"> |
54 | - <?php _e( 'First Name', 'give' ); ?> |
|
54 | + <?php _e('First Name', 'give'); ?> |
|
55 | 55 | <span class="give-required-indicator ">*</span> |
56 | 56 | </label> |
57 | - <input name="give_first_name" id="give_first_name" class="text give-input" type="text" value="<?php echo esc_attr( $first_name ); ?>"/> |
|
57 | + <input name="give_first_name" id="give_first_name" class="text give-input" type="text" value="<?php echo esc_attr($first_name); ?>"/> |
|
58 | 58 | </p> |
59 | 59 | |
60 | 60 | <p id="give_profile_last_name_wrap" class="form-row form-row-last form-row-responsive"> |
61 | - <label for="give_last_name"><?php _e( 'Last Name', 'give' ); ?></label> |
|
62 | - <input name="give_last_name" id="give_last_name" class="text give-input" type="text" value="<?php echo esc_attr( $last_name ); ?>"/> |
|
61 | + <label for="give_last_name"><?php _e('Last Name', 'give'); ?></label> |
|
62 | + <input name="give_last_name" id="give_last_name" class="text give-input" type="text" value="<?php echo esc_attr($last_name); ?>"/> |
|
63 | 63 | </p> |
64 | 64 | |
65 | 65 | <p id="give_profile_display_name_wrap" class="form-row form-row-first form-row-responsive"> |
66 | - <label for="give_display_name"><?php _e( 'Display Name', 'give' ); ?></label> |
|
66 | + <label for="give_display_name"><?php _e('Display Name', 'give'); ?></label> |
|
67 | 67 | <select name="give_display_name" id="give_display_name" class="select give-select"> |
68 | - <?php if ( ! empty( $current_user->first_name ) ): ?> |
|
69 | - <option <?php selected( $display_name, $current_user->first_name ); ?> value="<?php echo esc_attr( $current_user->first_name ); ?>"><?php echo esc_html( $current_user->first_name ); ?></option> |
|
68 | + <?php if ( ! empty($current_user->first_name)): ?> |
|
69 | + <option <?php selected($display_name, $current_user->first_name); ?> value="<?php echo esc_attr($current_user->first_name); ?>"><?php echo esc_html($current_user->first_name); ?></option> |
|
70 | 70 | <?php endif; ?> |
71 | - <option <?php selected( $display_name, $current_user->user_nicename ); ?> value="<?php echo esc_attr( $current_user->user_nicename ); ?>"><?php echo esc_html( $current_user->user_nicename ); ?></option> |
|
72 | - <?php if ( ! empty( $current_user->last_name ) ): ?> |
|
73 | - <option <?php selected( $display_name, $current_user->last_name ); ?> value="<?php echo esc_attr( $current_user->last_name ); ?>"><?php echo esc_html( $current_user->last_name ); ?></option> |
|
71 | + <option <?php selected($display_name, $current_user->user_nicename); ?> value="<?php echo esc_attr($current_user->user_nicename); ?>"><?php echo esc_html($current_user->user_nicename); ?></option> |
|
72 | + <?php if ( ! empty($current_user->last_name)): ?> |
|
73 | + <option <?php selected($display_name, $current_user->last_name); ?> value="<?php echo esc_attr($current_user->last_name); ?>"><?php echo esc_html($current_user->last_name); ?></option> |
|
74 | 74 | <?php endif; ?> |
75 | - <?php if ( ! empty( $current_user->first_name ) && ! empty( $current_user->last_name ) ): ?> |
|
76 | - <option <?php selected( $display_name, $current_user->first_name . ' ' . $current_user->last_name ); ?> value="<?php echo esc_attr( $current_user->first_name . ' ' . $current_user->last_name ); ?>"><?php echo esc_html( $current_user->first_name . ' ' . $current_user->last_name ); ?></option> |
|
77 | - <option <?php selected( $display_name, $current_user->last_name . ' ' . $current_user->first_name ); ?> value="<?php echo esc_attr( $current_user->last_name . ' ' . $current_user->first_name ); ?>"><?php echo esc_html( $current_user->last_name . ' ' . $current_user->first_name ); ?></option> |
|
75 | + <?php if ( ! empty($current_user->first_name) && ! empty($current_user->last_name)): ?> |
|
76 | + <option <?php selected($display_name, $current_user->first_name.' '.$current_user->last_name); ?> value="<?php echo esc_attr($current_user->first_name.' '.$current_user->last_name); ?>"><?php echo esc_html($current_user->first_name.' '.$current_user->last_name); ?></option> |
|
77 | + <option <?php selected($display_name, $current_user->last_name.' '.$current_user->first_name); ?> value="<?php echo esc_attr($current_user->last_name.' '.$current_user->first_name); ?>"><?php echo esc_html($current_user->last_name.' '.$current_user->first_name); ?></option> |
|
78 | 78 | <?php endif; ?> |
79 | 79 | </select> |
80 | 80 | <?php |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @since 1.0 |
87 | 87 | */ |
88 | - do_action( 'give_profile_editor_name' ); |
|
88 | + do_action('give_profile_editor_name'); |
|
89 | 89 | ?> |
90 | 90 | </p> |
91 | 91 | |
@@ -97,15 +97,15 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @since 1.0 |
99 | 99 | */ |
100 | - do_action( 'give_profile_editor_after_name' ); |
|
100 | + do_action('give_profile_editor_after_name'); |
|
101 | 101 | ?> |
102 | 102 | |
103 | 103 | <p class="form-row form-row-last form-row-responsive"> |
104 | 104 | <label for="give_email"> |
105 | - <?php _e( 'Email Address', 'give' ); ?> |
|
105 | + <?php _e('Email Address', 'give'); ?> |
|
106 | 106 | <span class="give-required-indicator ">*</span> |
107 | 107 | </label> |
108 | - <input name="give_email" id="give_email" class="text give-input required" type="email" value="<?php echo esc_attr( $current_user->user_email ); ?>" required aria-required="true"/> |
|
108 | + <input name="give_email" id="give_email" class="text give-input required" type="email" value="<?php echo esc_attr($current_user->user_email); ?>" required aria-required="true"/> |
|
109 | 109 | <?php |
110 | 110 | /** |
111 | 111 | * Fires in the profile editor shortcode, to the email section. |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @since 1.0 |
116 | 116 | */ |
117 | - do_action( 'give_profile_editor_email' ); |
|
117 | + do_action('give_profile_editor_email'); |
|
118 | 118 | ?> |
119 | 119 | </p> |
120 | 120 | |
@@ -126,19 +126,19 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @since 1.0 |
128 | 128 | */ |
129 | - do_action( 'give_profile_editor_after_email' ); |
|
129 | + do_action('give_profile_editor_after_email'); |
|
130 | 130 | ?> |
131 | 131 | |
132 | - <h3 id="give_profile_password_label" class="give-section-break"><?php _e( 'Change your Password', 'give' ); ?></h3> |
|
132 | + <h3 id="give_profile_password_label" class="give-section-break"><?php _e('Change your Password', 'give'); ?></h3> |
|
133 | 133 | |
134 | 134 | <div id="give_profile_password_wrap" class="give-clearfix"> |
135 | 135 | <p id="give_profile_password_wrap_1" class="form-row form-row-first form-row-responsive"> |
136 | - <label for="give_new_user_pass1"><?php _e( 'New Password', 'give' ); ?></label> |
|
136 | + <label for="give_new_user_pass1"><?php _e('New Password', 'give'); ?></label> |
|
137 | 137 | <input name="give_new_user_pass1" id="give_new_user_pass1" class="password give-input" type="password"/> |
138 | 138 | </p> |
139 | 139 | |
140 | 140 | <p id="give_profile_password_wrap_2" class="form-row form-row-last form-row-responsive"> |
141 | - <label for="give_new_user_pass2"><?php _e( 'Re-enter Password', 'give' ); ?></label> |
|
141 | + <label for="give_new_user_pass2"><?php _e('Re-enter Password', 'give'); ?></label> |
|
142 | 142 | <input name="give_new_user_pass2" id="give_new_user_pass2" class="password give-input" type="password"/> |
143 | 143 | <?php |
144 | 144 | /** |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @since 1.0 |
150 | 150 | */ |
151 | - do_action( 'give_profile_editor_password' ); |
|
151 | + do_action('give_profile_editor_password'); |
|
152 | 152 | ?> |
153 | 153 | </p> |
154 | 154 | </div> |
155 | 155 | |
156 | - <p class="give_password_change_notice"><?php _e( 'Please note after changing your password, you must log back in.', 'give' ); ?></p> |
|
156 | + <p class="give_password_change_notice"><?php _e('Please note after changing your password, you must log back in.', 'give'); ?></p> |
|
157 | 157 | |
158 | 158 | <?php |
159 | 159 | /** |
@@ -163,14 +163,14 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @since 1.0 |
165 | 165 | */ |
166 | - do_action( 'give_profile_editor_after_password' ); |
|
166 | + do_action('give_profile_editor_after_password'); |
|
167 | 167 | ?> |
168 | 168 | |
169 | 169 | <p id="give_profile_submit_wrap"> |
170 | - <input type="hidden" name="give_profile_editor_nonce" value="<?php echo wp_create_nonce( 'give-profile-editor-nonce' ); ?>"/> |
|
170 | + <input type="hidden" name="give_profile_editor_nonce" value="<?php echo wp_create_nonce('give-profile-editor-nonce'); ?>"/> |
|
171 | 171 | <input type="hidden" name="give_action" value="edit_user_profile"/> |
172 | - <input type="hidden" name="give_redirect" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/> |
|
173 | - <input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" class="give_submit" value="<?php _e( 'Save Changes', 'give' ); ?>"/> |
|
172 | + <input type="hidden" name="give_redirect" value="<?php echo esc_url(give_get_current_page_url()); ?>"/> |
|
173 | + <input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" class="give_submit" value="<?php _e('Save Changes', 'give'); ?>"/> |
|
174 | 174 | </p> |
175 | 175 | |
176 | 176 | </fieldset> |
@@ -185,23 +185,23 @@ discard block |
||
185 | 185 | * |
186 | 186 | * @since 1.0 |
187 | 187 | */ |
188 | - do_action( 'give_profile_editor_after' ); |
|
188 | + do_action('give_profile_editor_after'); |
|
189 | 189 | ?> |
190 | 190 | |
191 | 191 | <?php |
192 | 192 | else : |
193 | - if ( isset( $_GET['updated'] ) && 'true' === $_GET['updated'] && ! give_get_errors() ) { |
|
194 | - if ( isset( $_GET['update_code'] ) ) { |
|
195 | - switch ( $_GET['update_code'] ) { |
|
193 | + if (isset($_GET['updated']) && 'true' === $_GET['updated'] && ! give_get_errors()) { |
|
194 | + if (isset($_GET['update_code'])) { |
|
195 | + switch ($_GET['update_code']) { |
|
196 | 196 | case '2': |
197 | - printf( '<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__( 'Success:', 'give' ), esc_html__( 'Your profile and password has been updated.', 'give' ) ); |
|
198 | - _e( 'Login with your new credentials.', 'give' ); |
|
197 | + printf('<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__('Success:', 'give'), esc_html__('Your profile and password has been updated.', 'give')); |
|
198 | + _e('Login with your new credentials.', 'give'); |
|
199 | 199 | echo give_login_form(); |
200 | 200 | break; |
201 | 201 | |
202 | 202 | case '3': |
203 | - printf( '<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__( 'Success:', 'give' ), esc_html__( 'Your password has been updated.', 'give' ) ); |
|
204 | - _e( 'Login with your new credentials.', 'give' ); |
|
203 | + printf('<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__('Success:', 'give'), esc_html__('Your password has been updated.', 'give')); |
|
204 | + _e('Login with your new credentials.', 'give'); |
|
205 | 205 | echo give_login_form(); |
206 | 206 | break; |
207 | 207 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | } |
211 | 211 | } |
212 | 212 | } else { |
213 | - _e( 'You need to login to edit your profile.', 'give' ); |
|
213 | + _e('You need to login to edit your profile.', 'give'); |
|
214 | 214 | echo give_login_form(); |
215 | 215 | } |
216 | 216 | endif; |
@@ -189,12 +189,14 @@ |
||
189 | 189 | ?> |
190 | 190 | |
191 | 191 | <?php |
192 | -else : |
|
192 | +else { |
|
193 | + : |
|
193 | 194 | if ( isset( $_GET['updated'] ) && 'true' === $_GET['updated'] && ! give_get_errors() ) { |
194 | 195 | if ( isset( $_GET['update_code'] ) ) { |
195 | 196 | switch ( $_GET['update_code'] ) { |
196 | 197 | case '2': |
197 | 198 | printf( '<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__( 'Success:', 'give' ), esc_html__( 'Your profile and password has been updated.', 'give' ) ); |
199 | +} |
|
198 | 200 | _e( 'Login with your new credentials.', 'give' ); |
199 | 201 | echo give_login_form(); |
200 | 202 | break; |
@@ -9,27 +9,27 @@ discard block |
||
9 | 9 | global $give_access_form_outputted; |
10 | 10 | |
11 | 11 | // Only output the form once. |
12 | -if ( $give_access_form_outputted ) { |
|
12 | +if ($give_access_form_outputted) { |
|
13 | 13 | return; |
14 | 14 | } |
15 | 15 | |
16 | -$recaptcha_key = give_get_option( 'recaptcha_key' ); |
|
17 | -$recaptcha_secret = give_get_option( 'recaptcha_secret' ); |
|
16 | +$recaptcha_key = give_get_option('recaptcha_key'); |
|
17 | +$recaptcha_secret = give_get_option('recaptcha_secret'); |
|
18 | 18 | |
19 | -$enable_recaptcha = ( give_is_setting_enabled( give_get_option( 'enable_recaptcha' ) ) ) && ! empty( $recaptcha_key ) && ! empty( $recaptcha_secret ) ? true : false; |
|
19 | +$enable_recaptcha = (give_is_setting_enabled(give_get_option('enable_recaptcha'))) && ! empty($recaptcha_key) && ! empty($recaptcha_secret) ? true : false; |
|
20 | 20 | |
21 | 21 | // Email already sent? |
22 | -if ( isset( $_POST['email-access-sent'] ) ) { |
|
23 | - Give()->notices->print_frontend_notice( __( 'Please check your email and click on the link to access your complete donation history.', 'give' ), true, 'success' ); |
|
22 | +if (isset($_POST['email-access-sent'])) { |
|
23 | + Give()->notices->print_frontend_notice(__('Please check your email and click on the link to access your complete donation history.', 'give'), true, 'success'); |
|
24 | 24 | |
25 | 25 | return; |
26 | -} elseif ( isset( $_POST['email-access-exhausted'] ) ) { |
|
26 | +} elseif (isset($_POST['email-access-exhausted'])) { |
|
27 | 27 | |
28 | 28 | // Too many emails sent? |
29 | 29 | Give()->notices->print_frontend_notice( |
30 | 30 | sprintf( |
31 | - __( 'Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give' ), |
|
32 | - sprintf( _n( '%s minute', '%s minutes', Give()->email_access->verify_throttle / 60, 'give' ), Give()->email_access->verify_throttle / 60 ) |
|
31 | + __('Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give'), |
|
32 | + sprintf(_n('%s minute', '%s minutes', Give()->email_access->verify_throttle / 60, 'give'), Give()->email_access->verify_throttle / 60) |
|
33 | 33 | ), |
34 | 34 | true, |
35 | 35 | 'error' |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @since 1.8.17 |
46 | 46 | */ |
47 | -do_action( 'give_email_access_form_login' ); |
|
47 | +do_action('give_email_access_form_login'); |
|
48 | 48 | |
49 | 49 | // Print any other messages & errors. |
50 | 50 | Give()->notices->render_frontend_notices(); |
@@ -52,17 +52,17 @@ discard block |
||
52 | 52 | ?> |
53 | 53 | <div class="give-form"> |
54 | 54 | <form method="post" id="give-email-access-form"> |
55 | - <p><?php echo apply_filters( 'give_email_access_welcome_message', __( 'Please verify your email to access your donation history.', 'give' ) ); ?></p> |
|
55 | + <p><?php echo apply_filters('give_email_access_welcome_message', __('Please verify your email to access your donation history.', 'give')); ?></p> |
|
56 | 56 | |
57 | - <label for="give-email"><?php _e( 'Donation Email:', 'give' ); ?></label> |
|
57 | + <label for="give-email"><?php _e('Donation Email:', 'give'); ?></label> |
|
58 | 58 | <input id="give-email" type="email" name="give_email" value="" |
59 | - placeholder="<?php _e( 'Email Address', 'give' ); ?>"/> |
|
60 | - <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'give' ); ?>"/> |
|
59 | + placeholder="<?php _e('Email Address', 'give'); ?>"/> |
|
60 | + <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('give'); ?>"/> |
|
61 | 61 | <input type="hidden" name="give_action" value="email_access_form_login"/> |
62 | 62 | |
63 | 63 | <?php |
64 | 64 | // Enable reCAPTCHA? |
65 | - if ( $enable_recaptcha ) : |
|
65 | + if ($enable_recaptcha) : |
|
66 | 66 | ?> |
67 | 67 | <script> |
68 | 68 | // IP verify for reCAPTCHA. |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | <input type="hidden" name="give_ip" class="give_ip" value=""/> |
81 | 81 | <?php endif; ?> |
82 | 82 | |
83 | - <input type="submit" class="give-submit" value="<?php _e( 'Verify Email', 'give' ); ?>"/> |
|
83 | + <input type="submit" class="give-submit" value="<?php _e('Verify Email', 'give'); ?>"/> |
|
84 | 84 | </form> |
85 | 85 | </div> |
86 | 86 | <?php |
@@ -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,26 +25,26 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_load_scripts() { |
27 | 27 | |
28 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
29 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
30 | - $scripts_footer = ( give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ) ? true : false; |
|
28 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
29 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
30 | + $scripts_footer = (give_is_setting_enabled(give_get_option('scripts_footer'))) ? true : false; |
|
31 | 31 | |
32 | 32 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
33 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
33 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
34 | 34 | |
35 | 35 | // Localize / PHP to AJAX vars. |
36 | - $localize_give_vars = apply_filters( 'give_global_script_vars', array( |
|
36 | + $localize_give_vars = apply_filters('give_global_script_vars', array( |
|
37 | 37 | 'ajaxurl' => give_get_ajax_url(), |
38 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), // Do not use this nonce. Its deprecated. |
|
38 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), // Do not use this nonce. Its deprecated. |
|
39 | 39 | 'currency' => give_get_currency(), |
40 | - 'currency_sign' => give_currency_filter( '' ), |
|
40 | + 'currency_sign' => give_currency_filter(''), |
|
41 | 41 | 'currency_pos' => give_get_currency_position(), |
42 | 42 | 'thousands_separator' => give_get_price_thousand_separator(), |
43 | 43 | 'decimal_separator' => give_get_price_decimal_separator(), |
44 | - 'no_gateway' => __( 'Please select a payment method.', 'give' ), |
|
45 | - 'bad_minimum' => __( 'The minimum custom donation amount for this form is', 'give' ), |
|
46 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
47 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
44 | + 'no_gateway' => __('Please select a payment method.', 'give'), |
|
45 | + 'bad_minimum' => __('The minimum custom donation amount for this form is', 'give'), |
|
46 | + 'general_loading' => __('Loading...', 'give'), |
|
47 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
48 | 48 | 'number_decimals' => give_get_price_decimals(), |
49 | 49 | 'give_version' => GIVE_VERSION, |
50 | 50 | 'magnific_options' => apply_filters( |
@@ -58,83 +58,83 @@ discard block |
||
58 | 58 | 'give_form_translation_js', |
59 | 59 | array( |
60 | 60 | // Field name Validation message. |
61 | - 'payment-mode' => __( 'Please select payment mode.', 'give' ), |
|
62 | - 'give_first' => __( 'Please enter your first name.', 'give' ), |
|
63 | - 'give_email' => __( 'Please enter a valid email address.', 'give' ), |
|
64 | - 'give_user_login' => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
|
65 | - 'give_user_pass' => __( 'Enter a password.', 'give' ), |
|
66 | - 'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ), |
|
67 | - 'give_agree_to_terms' => __( 'You must agree to the terms and conditions.', 'give' ), |
|
61 | + 'payment-mode' => __('Please select payment mode.', 'give'), |
|
62 | + 'give_first' => __('Please enter your first name.', 'give'), |
|
63 | + 'give_email' => __('Please enter a valid email address.', 'give'), |
|
64 | + 'give_user_login' => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'), |
|
65 | + 'give_user_pass' => __('Enter a password.', 'give'), |
|
66 | + 'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'), |
|
67 | + 'give_agree_to_terms' => __('You must agree to the terms and conditions.', 'give'), |
|
68 | 68 | ) |
69 | 69 | ), |
70 | - 'confirm_email_sent_message' => __( 'Please check your email and click on the link to access your complete donation history.', 'give' ), |
|
71 | - ) ); |
|
70 | + 'confirm_email_sent_message' => __('Please check your email and click on the link to access your complete donation history.', 'give'), |
|
71 | + )); |
|
72 | 72 | |
73 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
73 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
74 | 74 | 'ajaxurl' => give_get_ajax_url(), |
75 | - 'ajaxNonce' => wp_create_nonce( 'give_ajax_nonce' ), |
|
76 | - 'loading' => __( 'Loading', 'give' ), |
|
75 | + 'ajaxNonce' => wp_create_nonce('give_ajax_nonce'), |
|
76 | + 'loading' => __('Loading', 'give'), |
|
77 | 77 | // General loading message. |
78 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
78 | + 'select_option' => __('Please select an option', 'give'), |
|
79 | 79 | // Variable pricing error with multi-donation option enabled. |
80 | - 'default_gateway' => give_get_default_gateway( null ), |
|
81 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
80 | + 'default_gateway' => give_get_default_gateway(null), |
|
81 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
82 | 82 | 'number_decimals' => give_get_price_decimals(), |
83 | - ) ); |
|
83 | + )); |
|
84 | 84 | |
85 | 85 | // DEBUG is On. |
86 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
86 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
87 | 87 | |
88 | - if ( give_is_cc_verify_enabled() ) { |
|
89 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
90 | - wp_enqueue_script( 'give-cc-validator' ); |
|
88 | + if (give_is_cc_verify_enabled()) { |
|
89 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
90 | + wp_enqueue_script('give-cc-validator'); |
|
91 | 91 | } |
92 | 92 | |
93 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
94 | - wp_enqueue_script( 'give-float-labels' ); |
|
93 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
94 | + wp_enqueue_script('give-float-labels'); |
|
95 | 95 | |
96 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
97 | - wp_enqueue_script( 'give-blockui' ); |
|
96 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
97 | + wp_enqueue_script('give-blockui'); |
|
98 | 98 | |
99 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
100 | - wp_enqueue_script( 'give-accounting' ); |
|
99 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
100 | + wp_enqueue_script('give-accounting'); |
|
101 | 101 | |
102 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
103 | - wp_enqueue_script( 'give-magnific' ); |
|
102 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
103 | + wp_enqueue_script('give-magnific'); |
|
104 | 104 | |
105 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-donations' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
106 | - wp_enqueue_script( 'give-checkout-global' ); |
|
105 | + wp_register_script('give-checkout-global', $js_dir.'give-donations'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
106 | + wp_enqueue_script('give-checkout-global'); |
|
107 | 107 | |
108 | - wp_register_script( 'give-hint.css', $js_plugins . 'give-hint.css' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
109 | - wp_enqueue_script( 'give-hint.css' ); |
|
108 | + wp_register_script('give-hint.css', $js_plugins.'give-hint.css'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
109 | + wp_enqueue_script('give-hint.css'); |
|
110 | 110 | |
111 | 111 | // General scripts. |
112 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
113 | - wp_enqueue_script( 'give-scripts' ); |
|
112 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
113 | + wp_enqueue_script('give-scripts'); |
|
114 | 114 | |
115 | 115 | // Load AJAX scripts, if enabled. |
116 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
117 | - wp_enqueue_script( 'give-ajax' ); |
|
116 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
117 | + wp_enqueue_script('give-ajax'); |
|
118 | 118 | |
119 | 119 | // Localize / Pass AJAX vars from PHP, |
120 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars ); |
|
121 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
120 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars); |
|
121 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
122 | 122 | |
123 | 123 | } else { |
124 | 124 | |
125 | 125 | // DEBUG is OFF (one JS file to rule them all!). |
126 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
127 | - wp_enqueue_script( 'give' ); |
|
126 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
127 | + wp_enqueue_script('give'); |
|
128 | 128 | |
129 | 129 | // Localize / Pass AJAX vars from PHP. |
130 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
|
131 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
130 | + wp_localize_script('give', 'give_global_vars', $localize_give_vars); |
|
131 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
132 | 132 | |
133 | 133 | } |
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
137 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
138 | 138 | |
139 | 139 | /** |
140 | 140 | * Register styles. |
@@ -147,16 +147,16 @@ discard block |
||
147 | 147 | */ |
148 | 148 | function give_register_styles() { |
149 | 149 | |
150 | - if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
|
150 | + if ( ! give_is_setting_enabled(give_get_option('css'))) { |
|
151 | 151 | return; |
152 | 152 | } |
153 | 153 | |
154 | - wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
155 | - wp_enqueue_style( 'give-styles' ); |
|
154 | + wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
155 | + wp_enqueue_style('give-styles'); |
|
156 | 156 | |
157 | 157 | } |
158 | 158 | |
159 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
159 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
160 | 160 | |
161 | 161 | |
162 | 162 | /** |
@@ -169,19 +169,19 @@ discard block |
||
169 | 169 | function give_get_stylesheet_uri() { |
170 | 170 | |
171 | 171 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
172 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
172 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
173 | 173 | |
174 | 174 | // LTR or RTL files. |
175 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
175 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
176 | 176 | |
177 | - $file = 'give' . $direction . $suffix . '.css'; |
|
177 | + $file = 'give'.$direction.$suffix.'.css'; |
|
178 | 178 | $templates_dir = give_get_theme_template_dir_name(); |
179 | 179 | |
180 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
181 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
182 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
183 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
184 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
180 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
181 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css'; |
|
182 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
183 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css'; |
|
184 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
185 | 185 | |
186 | 186 | $uri = false; |
187 | 187 | |
@@ -191,23 +191,23 @@ discard block |
||
191 | 191 | * followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
192 | 192 | * This allows users to copy just give.css to their theme. |
193 | 193 | */ |
194 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
195 | - if ( ! empty( $nonmin ) ) { |
|
196 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
194 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
195 | + if ( ! empty($nonmin)) { |
|
196 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
197 | 197 | } else { |
198 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
198 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
199 | 199 | } |
200 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
201 | - if ( ! empty( $nonmin ) ) { |
|
202 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
200 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
201 | + if ( ! empty($nonmin)) { |
|
202 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
203 | 203 | } else { |
204 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
204 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
205 | 205 | } |
206 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
207 | - $uri = trailingslashit( give_get_templates_url() ) . $file; |
|
206 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
207 | + $uri = trailingslashit(give_get_templates_url()).$file; |
|
208 | 208 | } |
209 | 209 | |
210 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
210 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
211 | 211 | |
212 | 212 | } |
213 | 213 | |
@@ -224,80 +224,80 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @return void |
226 | 226 | */ |
227 | -function give_load_admin_scripts( $hook ) { |
|
227 | +function give_load_admin_scripts($hook) { |
|
228 | 228 | |
229 | 229 | global $post, $post_type; |
230 | 230 | |
231 | 231 | $give_options = give_get_settings(); |
232 | 232 | |
233 | 233 | // Directories of assets. |
234 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
235 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
236 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
234 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
235 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
236 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
237 | 237 | |
238 | 238 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
239 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
239 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
240 | 240 | |
241 | 241 | // LTR or RTL files. |
242 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
242 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
243 | 243 | |
244 | 244 | // Global Admin. |
245 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
246 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
245 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
246 | + wp_enqueue_style('give-admin-bar-notification'); |
|
247 | 247 | |
248 | 248 | // Give Admin Only. |
249 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
249 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
250 | 250 | return; |
251 | 251 | } |
252 | 252 | |
253 | 253 | // CSS. |
254 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
255 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
256 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION ); |
|
257 | - wp_enqueue_style( 'give-admin' ); |
|
258 | - wp_enqueue_style( 'thickbox' ); |
|
259 | - wp_enqueue_style( 'wp-color-picker' ); |
|
254 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
255 | + wp_enqueue_style('jquery-ui-css'); |
|
256 | + wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', array(), GIVE_VERSION); |
|
257 | + wp_enqueue_style('give-admin'); |
|
258 | + wp_enqueue_style('thickbox'); |
|
259 | + wp_enqueue_style('wp-color-picker'); |
|
260 | 260 | |
261 | 261 | |
262 | 262 | // JS. |
263 | - wp_register_script( 'give-selector-cache', $js_plugins . 'selector-cache' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
264 | - wp_enqueue_script( 'give-selector-cache' ); |
|
263 | + wp_register_script('give-selector-cache', $js_plugins.'selector-cache'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
264 | + wp_enqueue_script('give-selector-cache'); |
|
265 | 265 | |
266 | - wp_register_script( 'give-ajaxify-fields', $js_plugins . 'give-ajaxify-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
267 | - wp_enqueue_script( 'give-ajaxify-fields' ); |
|
266 | + wp_register_script('give-ajaxify-fields', $js_plugins.'give-ajaxify-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
267 | + wp_enqueue_script('give-ajaxify-fields'); |
|
268 | 268 | |
269 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
270 | - wp_enqueue_script( 'jquery-chosen' ); |
|
269 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
270 | + wp_enqueue_script('jquery-chosen'); |
|
271 | 271 | |
272 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
273 | - wp_enqueue_script( 'give-accounting' ); |
|
272 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
273 | + wp_enqueue_script('give-accounting'); |
|
274 | 274 | |
275 | - wp_enqueue_script( 'wp-color-picker' ); |
|
276 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
277 | - wp_enqueue_script( 'thickbox' ); |
|
275 | + wp_enqueue_script('wp-color-picker'); |
|
276 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
277 | + wp_enqueue_script('thickbox'); |
|
278 | 278 | |
279 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query' ), GIVE_VERSION, false ); |
|
280 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
279 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query'), GIVE_VERSION, false); |
|
280 | + wp_enqueue_script('give-admin-scripts'); |
|
281 | 281 | |
282 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
283 | - wp_enqueue_script( 'jquery-flot' ); |
|
282 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
283 | + wp_enqueue_script('jquery-flot'); |
|
284 | 284 | |
285 | - wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
286 | - wp_enqueue_script( 'give-repeatable-fields' ); |
|
285 | + wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
286 | + wp_enqueue_script('give-repeatable-fields'); |
|
287 | 287 | |
288 | - wp_register_script( 'give-hint.css', $js_plugins . 'give-hint.css' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
289 | - wp_enqueue_script( 'give-hint.css' ); |
|
288 | + wp_register_script('give-hint.css', $js_plugins.'give-hint.css'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
289 | + wp_enqueue_script('give-hint.css'); |
|
290 | 290 | |
291 | 291 | // Forms CPT Script. |
292 | - if ( $post_type === 'give_forms' ) { |
|
293 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
294 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
292 | + if ($post_type === 'give_forms') { |
|
293 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
294 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | // Settings Scripts. |
298 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) { |
|
299 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
300 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
298 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
299 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
300 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | // Price Separators. |
@@ -305,91 +305,91 @@ discard block |
||
305 | 305 | $decimal_separator = give_get_price_decimal_separator(); |
306 | 306 | |
307 | 307 | // Localize strings & variables for JS. |
308 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
309 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
308 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
309 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
310 | 310 | 'give_version' => GIVE_VERSION, |
311 | 311 | 'thousands_separator' => $thousand_separator, |
312 | 312 | 'decimal_separator' => $decimal_separator, |
313 | - 'quick_edit_warning' => __( 'Not available for variable priced forms.', 'give' ), |
|
314 | - 'delete_payment' => __( 'Are you sure you want to delete this payment?', 'give' ), |
|
315 | - 'delete_payment_note' => __( 'Are you sure you want to delete this note?', 'give' ), |
|
316 | - 'revoke_api_key' => __( 'Are you sure you want to revoke this API key?', 'give' ), |
|
317 | - 'regenerate_api_key' => __( 'Are you sure you want to regenerate this API key?', 'give' ), |
|
318 | - 'resend_receipt' => __( 'Are you sure you want to resend the donation receipt?', 'give' ), |
|
319 | - 'disconnect_user' => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ), |
|
320 | - 'one_option' => __( 'Choose a form', 'give' ), |
|
321 | - 'one_or_more_option' => __( 'Choose one or more forms', 'give' ), |
|
322 | - 'currency_sign' => give_currency_filter( '' ), |
|
323 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
313 | + 'quick_edit_warning' => __('Not available for variable priced forms.', 'give'), |
|
314 | + 'delete_payment' => __('Are you sure you want to delete this payment?', 'give'), |
|
315 | + 'delete_payment_note' => __('Are you sure you want to delete this note?', 'give'), |
|
316 | + 'revoke_api_key' => __('Are you sure you want to revoke this API key?', 'give'), |
|
317 | + 'regenerate_api_key' => __('Are you sure you want to regenerate this API key?', 'give'), |
|
318 | + 'resend_receipt' => __('Are you sure you want to resend the donation receipt?', 'give'), |
|
319 | + 'disconnect_user' => __('Are you sure you want to disconnect the user from this donor?', 'give'), |
|
320 | + 'one_option' => __('Choose a form', 'give'), |
|
321 | + 'one_or_more_option' => __('Choose one or more forms', 'give'), |
|
322 | + 'currency_sign' => give_currency_filter(''), |
|
323 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
324 | 324 | 'currency_decimals' => give_get_price_decimals(), |
325 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
326 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
327 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
328 | - 'delete_test_donor' => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ), |
|
329 | - 'delete_import_donor' => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ), |
|
330 | - 'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
|
325 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
326 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
327 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
328 | + 'delete_test_donor' => __('Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give'), |
|
329 | + 'delete_import_donor' => __('Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give'), |
|
330 | + 'price_format_guide' => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator), |
|
331 | 331 | /* translators : %s: Donation form options metabox */ |
332 | - 'confirm_before_remove_row_text' => __( 'Do you want to delete this item?', 'give' ), |
|
333 | - 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
334 | - 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
335 | - 'search_placeholder' => __( 'Type to search all forms', 'give' ), |
|
336 | - 'search_placeholder_donor' => __( 'Type to search all donors', 'give' ), |
|
337 | - 'search_placeholder_country' => __( 'Type to search all countries', 'give' ), |
|
338 | - 'search_placeholder_state' => __( 'Type to search all states/provinces', 'give' ), |
|
339 | - 'unlock_donor_fields' => __( 'To edit first name and last name, please go to user profile of the donor.', 'give' ), |
|
340 | - 'remove_from_bulk_delete' => __( 'Remove from Bulk Delete', 'give' ), |
|
332 | + 'confirm_before_remove_row_text' => __('Do you want to delete this item?', 'give'), |
|
333 | + 'matched_success_failure_page' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
334 | + 'dismiss_notice_text' => __('Dismiss this notice.', 'give'), |
|
335 | + 'search_placeholder' => __('Type to search all forms', 'give'), |
|
336 | + 'search_placeholder_donor' => __('Type to search all donors', 'give'), |
|
337 | + 'search_placeholder_country' => __('Type to search all countries', 'give'), |
|
338 | + 'search_placeholder_state' => __('Type to search all states/provinces', 'give'), |
|
339 | + 'unlock_donor_fields' => __('To edit first name and last name, please go to user profile of the donor.', 'give'), |
|
340 | + 'remove_from_bulk_delete' => __('Remove from Bulk Delete', 'give'), |
|
341 | 341 | 'donors_bulk_action' => array( |
342 | - 'no_donor_selected' => __( 'You must choose at least one or more donors to delete.', 'give' ), |
|
343 | - 'no_action_selected' => __( 'You must select a bulk action to proceed.', 'give' ), |
|
342 | + 'no_donor_selected' => __('You must choose at least one or more donors to delete.', 'give'), |
|
343 | + 'no_action_selected' => __('You must select a bulk action to proceed.', 'give'), |
|
344 | 344 | ), |
345 | 345 | 'donations_bulk_action' => array( |
346 | 346 | 'delete' => array( |
347 | - 'zero' => __( 'You must choose at least one or more donations to delete.', 'give' ), |
|
348 | - 'single' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
|
349 | - 'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
|
347 | + 'zero' => __('You must choose at least one or more donations to delete.', 'give'), |
|
348 | + 'single' => __('Are you sure you want to permanently delete this donation?', 'give'), |
|
349 | + 'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'), |
|
350 | 350 | ), |
351 | 351 | 'resend-receipt' => array( |
352 | - 'zero' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
|
353 | - 'single' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
|
354 | - 'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
|
352 | + 'zero' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'), |
|
353 | + 'single' => __('Are you sure you want to resend the email receipt to this recipient?', 'give'), |
|
354 | + 'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'), |
|
355 | 355 | ), |
356 | 356 | 'set-to-status' => array( |
357 | - 'zero' => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ), |
|
358 | - 'single' => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ), |
|
359 | - 'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ), |
|
357 | + 'zero' => __('You must choose at least one or more donations to set status to {status}.', 'give'), |
|
358 | + 'single' => __('Are you sure you want to set status of this donation to {status}?', 'give'), |
|
359 | + 'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'), |
|
360 | 360 | ), |
361 | 361 | ), |
362 | 362 | 'updates' => array( |
363 | - 'ajax_error' => __( 'Please reload this page and try again', 'give' ) |
|
363 | + 'ajax_error' => __('Please reload this page and try again', 'give') |
|
364 | 364 | ), |
365 | 365 | 'metabox_fields' => array( |
366 | 366 | 'media' => array( |
367 | - 'button_title' => __( 'Choose Image', 'give' ), |
|
367 | + 'button_title' => __('Choose Image', 'give'), |
|
368 | 368 | ), |
369 | 369 | 'file' => array( |
370 | - 'button_title' => __( 'Choose File', 'give' ), |
|
370 | + 'button_title' => __('Choose File', 'give'), |
|
371 | 371 | ), |
372 | 372 | ), |
373 | 373 | 'chosen' => array( |
374 | - 'no_results_msg' => __( 'No results match {search_term}', 'give' ), |
|
375 | - 'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ), |
|
374 | + 'no_results_msg' => __('No results match {search_term}', 'give'), |
|
375 | + 'ajax_search_msg' => __('Searching results for match {search_term}', 'give'), |
|
376 | 376 | ), |
377 | - 'db_update_confirmation_msg_button' => __( 'Run Updates', 'give' ), |
|
378 | - 'db_update_confirmation_msg' => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ), |
|
379 | - 'error_message' => __( 'Something went wrong kindly try again!', 'give' ), |
|
377 | + 'db_update_confirmation_msg_button' => __('Run Updates', 'give'), |
|
378 | + 'db_update_confirmation_msg' => __('The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give'), |
|
379 | + 'error_message' => __('Something went wrong kindly try again!', 'give'), |
|
380 | 380 | 'give_donation_import' => 'give_donation_import', |
381 | 381 | 'core_settings_import' => 'give_core_settings_import', |
382 | - 'setting_not_save_message' => __( 'Changes you made may not be saved.', 'give' ), |
|
383 | - ) ); |
|
382 | + 'setting_not_save_message' => __('Changes you made may not be saved.', 'give'), |
|
383 | + )); |
|
384 | 384 | |
385 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) { |
|
385 | + if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) { |
|
386 | 386 | // call for new media manager. |
387 | 387 | wp_enqueue_media(); |
388 | 388 | } |
389 | 389 | |
390 | 390 | } |
391 | 391 | |
392 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
392 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
393 | 393 | |
394 | 394 | /** |
395 | 395 | * Admin Give Icon |
@@ -404,13 +404,13 @@ discard block |
||
404 | 404 | ?> |
405 | 405 | <style type="text/css" media="screen"> |
406 | 406 | |
407 | - <?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?> |
|
407 | + <?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?> |
|
408 | 408 | @font-face { |
409 | 409 | font-family: 'give-icomoon'; |
410 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
411 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
412 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
413 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
410 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
411 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
412 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
413 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
414 | 414 | font-weight: normal; |
415 | 415 | font-style: normal; |
416 | 416 | } |
@@ -429,4 +429,4 @@ discard block |
||
429 | 429 | <?php |
430 | 430 | } |
431 | 431 | |
432 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
432 | +add_action('admin_head', 'give_admin_icon'); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | /** |
280 | 280 | * Rename query clauses for new meta table |
281 | 281 | * |
282 | - * @param $clause |
|
282 | + * @param string $clause |
|
283 | 283 | * @param $filter |
284 | 284 | * |
285 | 285 | * @return mixed |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | * @since 2.0.4 |
514 | 514 | * @access public |
515 | 515 | * |
516 | - * @return string |
|
516 | + * @return boolean |
|
517 | 517 | */ |
518 | 518 | public function get_meta_type(){ |
519 | 519 | return $this->meta_type; |
@@ -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 | |
@@ -77,40 +77,40 @@ discard block |
||
77 | 77 | parent::__construct(); |
78 | 78 | |
79 | 79 | // Bailout. |
80 | - if ( empty( $this->supports ) || ! $this->is_custom_meta_table_active() ) { |
|
80 | + if (empty($this->supports) || ! $this->is_custom_meta_table_active()) { |
|
81 | 81 | return; |
82 | 82 | } |
83 | 83 | |
84 | - if ( in_array( 'add_post_metadata', $this->supports ) ) { |
|
85 | - add_filter( 'add_post_metadata', array( $this, '__add_meta' ), 0, 5 ); |
|
84 | + if (in_array('add_post_metadata', $this->supports)) { |
|
85 | + add_filter('add_post_metadata', array($this, '__add_meta'), 0, 5); |
|
86 | 86 | } |
87 | 87 | |
88 | - if ( in_array( 'get_post_metadata', $this->supports ) ) { |
|
89 | - add_filter( 'get_post_metadata', array( $this, '__get_meta' ), 0, 4 ); |
|
88 | + if (in_array('get_post_metadata', $this->supports)) { |
|
89 | + add_filter('get_post_metadata', array($this, '__get_meta'), 0, 4); |
|
90 | 90 | } |
91 | 91 | |
92 | - if ( in_array( 'update_post_metadata', $this->supports ) ) { |
|
93 | - add_filter( 'update_post_metadata', array( $this, '__update_meta' ), 0, 5 ); |
|
92 | + if (in_array('update_post_metadata', $this->supports)) { |
|
93 | + add_filter('update_post_metadata', array($this, '__update_meta'), 0, 5); |
|
94 | 94 | } |
95 | 95 | |
96 | - if ( in_array( 'delete_post_metadata', $this->supports ) ) { |
|
97 | - add_filter( 'delete_post_metadata', array( $this, '__delete_meta' ), 0, 5 ); |
|
96 | + if (in_array('delete_post_metadata', $this->supports)) { |
|
97 | + add_filter('delete_post_metadata', array($this, '__delete_meta'), 0, 5); |
|
98 | 98 | } |
99 | 99 | |
100 | - if ( in_array( 'posts_where', $this->supports ) ) { |
|
101 | - add_filter( 'posts_where', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 ); |
|
100 | + if (in_array('posts_where', $this->supports)) { |
|
101 | + add_filter('posts_where', array($this, '__rename_meta_table_name_in_query'), 99999, 2); |
|
102 | 102 | } |
103 | 103 | |
104 | - if ( in_array( 'posts_join', $this->supports ) ) { |
|
105 | - add_filter( 'posts_join', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 ); |
|
104 | + if (in_array('posts_join', $this->supports)) { |
|
105 | + add_filter('posts_join', array($this, '__rename_meta_table_name_in_query'), 99999, 2); |
|
106 | 106 | } |
107 | 107 | |
108 | - if ( in_array( 'posts_groupby', $this->supports ) ) { |
|
109 | - add_filter( 'posts_groupby', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 ); |
|
108 | + if (in_array('posts_groupby', $this->supports)) { |
|
109 | + add_filter('posts_groupby', array($this, '__rename_meta_table_name_in_query'), 99999, 2); |
|
110 | 110 | } |
111 | 111 | |
112 | - if ( in_array( 'posts_orderby', $this->supports ) ) { |
|
113 | - add_filter( 'posts_orderby', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 ); |
|
112 | + if (in_array('posts_orderby', $this->supports)) { |
|
113 | + add_filter('posts_orderby', array($this, '__rename_meta_table_name_in_query'), 99999, 2); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
@@ -128,16 +128,16 @@ discard block |
||
128 | 128 | * @return mixed Will be an array if $single is false. Will be value of meta data field if $single |
129 | 129 | * is true. |
130 | 130 | */ |
131 | - public function get_meta( $id = 0, $meta_key = '', $single = false ) { |
|
132 | - $id = $this->sanitize_id( $id ); |
|
131 | + public function get_meta($id = 0, $meta_key = '', $single = false) { |
|
132 | + $id = $this->sanitize_id($id); |
|
133 | 133 | |
134 | 134 | // Bailout. |
135 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
135 | + if ( ! $this->is_valid_post_type($id)) { |
|
136 | 136 | return $this->check; |
137 | 137 | } |
138 | 138 | |
139 | - if ( $this->raw_result ) { |
|
140 | - if ( ! ( $value = get_metadata( $this->meta_type, $id, $meta_key, false ) ) ) { |
|
139 | + if ($this->raw_result) { |
|
140 | + if ( ! ($value = get_metadata($this->meta_type, $id, $meta_key, false))) { |
|
141 | 141 | $value = ''; |
142 | 142 | } |
143 | 143 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $this->raw_result = false; |
146 | 146 | |
147 | 147 | } else { |
148 | - $value = get_metadata( $this->meta_type, $id, $meta_key, $single ); |
|
148 | + $value = get_metadata($this->meta_type, $id, $meta_key, $single); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | return $value; |
@@ -167,18 +167,18 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @return int|bool False for failure. True for success. |
169 | 169 | */ |
170 | - public function add_meta( $id = 0, $meta_key = '', $meta_value, $unique = false ) { |
|
171 | - $id = $this->sanitize_id( $id ); |
|
170 | + public function add_meta($id = 0, $meta_key = '', $meta_value, $unique = false) { |
|
171 | + $id = $this->sanitize_id($id); |
|
172 | 172 | |
173 | 173 | // Bailout. |
174 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
174 | + if ( ! $this->is_valid_post_type($id)) { |
|
175 | 175 | return $this->check; |
176 | 176 | } |
177 | 177 | |
178 | - $meta_id = add_metadata( $this->meta_type, $id, $meta_key, $meta_value, $unique ); |
|
178 | + $meta_id = add_metadata($this->meta_type, $id, $meta_key, $meta_value, $unique); |
|
179 | 179 | |
180 | - if ( $meta_id ) { |
|
181 | - $this->delete_cache( $id ); |
|
180 | + if ($meta_id) { |
|
181 | + $this->delete_cache($id); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | return $meta_id; |
@@ -204,18 +204,18 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return int|bool False on failure, true if success. |
206 | 206 | */ |
207 | - public function update_meta( $id = 0, $meta_key = '', $meta_value, $prev_value = '' ) { |
|
208 | - $id = $this->sanitize_id( $id ); |
|
207 | + public function update_meta($id = 0, $meta_key = '', $meta_value, $prev_value = '') { |
|
208 | + $id = $this->sanitize_id($id); |
|
209 | 209 | |
210 | 210 | // Bailout. |
211 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
211 | + if ( ! $this->is_valid_post_type($id)) { |
|
212 | 212 | return $this->check; |
213 | 213 | } |
214 | 214 | |
215 | - $meta_id = update_metadata( $this->meta_type, $id, $meta_key, $meta_value, $prev_value ); |
|
215 | + $meta_id = update_metadata($this->meta_type, $id, $meta_key, $meta_value, $prev_value); |
|
216 | 216 | |
217 | - if ( $meta_id ) { |
|
218 | - $this->delete_cache( $id ); |
|
217 | + if ($meta_id) { |
|
218 | + $this->delete_cache($id); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | return $meta_id; |
@@ -238,18 +238,18 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @return bool False for failure. True for success. |
240 | 240 | */ |
241 | - public function delete_meta( $id = 0, $meta_key = '', $meta_value = '', $delete_all = '' ) { |
|
242 | - $id = $this->sanitize_id( $id ); |
|
241 | + public function delete_meta($id = 0, $meta_key = '', $meta_value = '', $delete_all = '') { |
|
242 | + $id = $this->sanitize_id($id); |
|
243 | 243 | |
244 | 244 | // Bailout. |
245 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
245 | + if ( ! $this->is_valid_post_type($id)) { |
|
246 | 246 | return $this->check; |
247 | 247 | } |
248 | 248 | |
249 | - $is_meta_deleted = delete_metadata( $this->meta_type, $id, $meta_key, $meta_value, $delete_all ); |
|
249 | + $is_meta_deleted = delete_metadata($this->meta_type, $id, $meta_key, $meta_value, $delete_all); |
|
250 | 250 | |
251 | - if ( $is_meta_deleted ) { |
|
252 | - $this->delete_cache( $id ); |
|
251 | + if ($is_meta_deleted) { |
|
252 | + $this->delete_cache($id); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | return $is_meta_deleted; |
@@ -266,10 +266,10 @@ discard block |
||
266 | 266 | * |
267 | 267 | * @return string |
268 | 268 | */ |
269 | - public function __rename_meta_table_name_in_query( $clause, $wp_query ) { |
|
269 | + public function __rename_meta_table_name_in_query($clause, $wp_query) { |
|
270 | 270 | // Add new table to sql query. |
271 | - if ( $this->is_post_type_query( $wp_query ) && ! empty( $wp_query->meta_query->queries ) ) { |
|
272 | - $clause = $this->__rename_meta_table_name( $clause, current_filter() ); |
|
271 | + if ($this->is_post_type_query($wp_query) && ! empty($wp_query->meta_query->queries)) { |
|
272 | + $clause = $this->__rename_meta_table_name($clause, current_filter()); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | return $clause; |
@@ -284,39 +284,39 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @return mixed |
286 | 286 | */ |
287 | - public function __rename_meta_table_name( $clause, $filter ){ |
|
287 | + public function __rename_meta_table_name($clause, $filter) { |
|
288 | 288 | global $wpdb; |
289 | 289 | |
290 | - $clause = str_replace( "{$wpdb->postmeta}.post_id", "{$this->table_name}.{$this->meta_type}_id", $clause ); |
|
291 | - $clause = str_replace( $wpdb->postmeta, $this->table_name, $clause ); |
|
290 | + $clause = str_replace("{$wpdb->postmeta}.post_id", "{$this->table_name}.{$this->meta_type}_id", $clause); |
|
291 | + $clause = str_replace($wpdb->postmeta, $this->table_name, $clause); |
|
292 | 292 | |
293 | - switch( $filter ) { |
|
293 | + switch ($filter) { |
|
294 | 294 | case 'posts_join': |
295 | - $joins = array( 'INNER JOIN', 'LEFT JOIN' ); |
|
295 | + $joins = array('INNER JOIN', 'LEFT JOIN'); |
|
296 | 296 | |
297 | - foreach ( $joins as $join ) { |
|
298 | - if( false !== strpos( $clause, $join ) ) { |
|
299 | - $clause = explode( $join, $clause ); |
|
297 | + foreach ($joins as $join) { |
|
298 | + if (false !== strpos($clause, $join)) { |
|
299 | + $clause = explode($join, $clause); |
|
300 | 300 | |
301 | - foreach ( $clause as $key => $clause_part ) { |
|
302 | - if( empty( $clause_part ) ) { |
|
301 | + foreach ($clause as $key => $clause_part) { |
|
302 | + if (empty($clause_part)) { |
|
303 | 303 | continue; |
304 | 304 | } |
305 | 305 | |
306 | - preg_match( '/' . $wpdb->prefix . 'give_' . $this->meta_type . 'meta AS (.*) ON/', $clause_part, $alias_table_name ); |
|
306 | + preg_match('/'.$wpdb->prefix.'give_'.$this->meta_type.'meta AS (.*) ON/', $clause_part, $alias_table_name); |
|
307 | 307 | |
308 | - if( isset( $alias_table_name[1] ) ) { |
|
309 | - $clause[$key] = str_replace( "{$alias_table_name[1]}.post_id", "{$alias_table_name[1]}.{$this->meta_type}_id", $clause_part ); |
|
308 | + if (isset($alias_table_name[1])) { |
|
309 | + $clause[$key] = str_replace("{$alias_table_name[1]}.post_id", "{$alias_table_name[1]}.{$this->meta_type}_id", $clause_part); |
|
310 | 310 | } |
311 | 311 | } |
312 | 312 | |
313 | - $clause = implode( "{$join} ", $clause ); |
|
313 | + $clause = implode("{$join} ", $clause); |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | break; |
317 | 317 | |
318 | 318 | case 'posts_where': |
319 | - $clause = str_replace( array( 'mt2.post_id', 'mt1.post_id' ), array( "mt2.{$this->meta_type}_id", "mt1.{$this->meta_type}_id" ), $clause ); |
|
319 | + $clause = str_replace(array('mt2.post_id', 'mt1.post_id'), array("mt2.{$this->meta_type}_id", "mt1.{$this->meta_type}_id"), $clause); |
|
320 | 320 | break; |
321 | 321 | } |
322 | 322 | |
@@ -334,19 +334,19 @@ discard block |
||
334 | 334 | * |
335 | 335 | * @return bool |
336 | 336 | */ |
337 | - protected function is_post_type_query( $wp_query ) { |
|
337 | + protected function is_post_type_query($wp_query) { |
|
338 | 338 | $status = false; |
339 | 339 | |
340 | 340 | // Check if it is payment query. |
341 | - if ( ! empty( $wp_query->query['post_type'] ) ) { |
|
341 | + if ( ! empty($wp_query->query['post_type'])) { |
|
342 | 342 | if ( |
343 | - is_string( $wp_query->query['post_type'] ) && |
|
343 | + is_string($wp_query->query['post_type']) && |
|
344 | 344 | $this->post_type === $wp_query->query['post_type'] |
345 | 345 | ) { |
346 | 346 | $status = true; |
347 | 347 | } elseif ( |
348 | - is_array( $wp_query->query['post_type'] ) && |
|
349 | - in_array( $this->post_type, $wp_query->query['post_type'] ) |
|
348 | + is_array($wp_query->query['post_type']) && |
|
349 | + in_array($this->post_type, $wp_query->query['post_type']) |
|
350 | 350 | ) { |
351 | 351 | $status = true; |
352 | 352 | } |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | * |
366 | 366 | * @return bool |
367 | 367 | */ |
368 | - protected function is_valid_post_type( $ID ) { |
|
369 | - return $ID && ( $this->post_type === get_post_type( $ID ) ); |
|
368 | + protected function is_valid_post_type($ID) { |
|
369 | + return $ID && ($this->post_type === get_post_type($ID)); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | /** |
@@ -392,8 +392,8 @@ discard block |
||
392 | 392 | * |
393 | 393 | * @return void |
394 | 394 | */ |
395 | - private function delete_cache( $id, $meta_type = '' ) { |
|
396 | - $meta_type = empty( $meta_type ) ? $this->meta_type : $meta_type; |
|
395 | + private function delete_cache($id, $meta_type = '') { |
|
396 | + $meta_type = empty($meta_type) ? $this->meta_type : $meta_type; |
|
397 | 397 | |
398 | 398 | $group = array( |
399 | 399 | // 'form' => 'give-forms', |
@@ -403,8 +403,8 @@ discard block |
||
403 | 403 | // 'log' => 'give-logs', |
404 | 404 | ); |
405 | 405 | |
406 | - if ( array_key_exists( $meta_type, $group ) ) { |
|
407 | - Give_Cache::delete_group( $id, $group[ $meta_type ] ); |
|
406 | + if (array_key_exists($meta_type, $group)) { |
|
407 | + Give_Cache::delete_group($id, $group[$meta_type]); |
|
408 | 408 | } |
409 | 409 | } |
410 | 410 | |
@@ -419,8 +419,8 @@ discard block |
||
419 | 419 | * |
420 | 420 | * @return mixed |
421 | 421 | */ |
422 | - public function __call( $name, $arguments ) { |
|
423 | - switch ( $name ) { |
|
422 | + public function __call($name, $arguments) { |
|
423 | + switch ($name) { |
|
424 | 424 | case '__add_meta': |
425 | 425 | $this->check = $arguments[0]; |
426 | 426 | $id = $arguments[1]; |
@@ -429,11 +429,11 @@ discard block |
||
429 | 429 | $unique = $arguments[4]; |
430 | 430 | |
431 | 431 | // Bailout. |
432 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
432 | + if ( ! $this->is_valid_post_type($id)) { |
|
433 | 433 | return $this->check; |
434 | 434 | } |
435 | 435 | |
436 | - return $this->add_meta( $id, $meta_key, $meta_value, $unique ); |
|
436 | + return $this->add_meta($id, $meta_key, $meta_value, $unique); |
|
437 | 437 | |
438 | 438 | case '__get_meta': |
439 | 439 | $this->check = $arguments[0]; |
@@ -442,13 +442,13 @@ discard block |
||
442 | 442 | $single = $arguments[3]; |
443 | 443 | |
444 | 444 | // Bailout. |
445 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
445 | + if ( ! $this->is_valid_post_type($id)) { |
|
446 | 446 | return $this->check; |
447 | 447 | } |
448 | 448 | |
449 | 449 | $this->raw_result = true; |
450 | 450 | |
451 | - return $this->get_meta( $id, $meta_key, $single ); |
|
451 | + return $this->get_meta($id, $meta_key, $single); |
|
452 | 452 | |
453 | 453 | case '__update_meta': |
454 | 454 | $this->check = $arguments[0]; |
@@ -457,11 +457,11 @@ discard block |
||
457 | 457 | $meta_value = $arguments[3]; |
458 | 458 | |
459 | 459 | // Bailout. |
460 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
460 | + if ( ! $this->is_valid_post_type($id)) { |
|
461 | 461 | return $this->check; |
462 | 462 | } |
463 | 463 | |
464 | - return $this->update_meta( $id, $meta_key, $meta_value ); |
|
464 | + return $this->update_meta($id, $meta_key, $meta_value); |
|
465 | 465 | |
466 | 466 | case '__delete_meta': |
467 | 467 | $this->check = $arguments[0]; |
@@ -471,11 +471,11 @@ discard block |
||
471 | 471 | $delete_all = $arguments[3]; |
472 | 472 | |
473 | 473 | // Bailout. |
474 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
474 | + if ( ! $this->is_valid_post_type($id)) { |
|
475 | 475 | return $this->check; |
476 | 476 | } |
477 | 477 | |
478 | - return $this->delete_meta( $id, $meta_key, $meta_value, $delete_all ); |
|
478 | + return $this->delete_meta($id, $meta_key, $meta_value, $delete_all); |
|
479 | 479 | } |
480 | 480 | } |
481 | 481 | |
@@ -500,10 +500,10 @@ discard block |
||
500 | 500 | KEY meta_key (meta_key({$this->min_index_length})) |
501 | 501 | ) {$charset_collate};"; |
502 | 502 | |
503 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
504 | - dbDelta( $sql ); |
|
503 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
504 | + dbDelta($sql); |
|
505 | 505 | |
506 | - update_option( $this->table_name . '_db_version', $this->version ); |
|
506 | + update_option($this->table_name.'_db_version', $this->version); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | * |
516 | 516 | * @return string |
517 | 517 | */ |
518 | - public function get_meta_type(){ |
|
518 | + public function get_meta_type() { |
|
519 | 519 | return $this->meta_type; |
520 | 520 | } |
521 | 521 | } |
522 | 522 | \ No newline at end of file |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | |
41 | 41 | // Exit if accessed directly. |
42 | -if ( ! defined( 'ABSPATH' ) ) { |
|
42 | +if ( ! defined('ABSPATH')) { |
|
43 | 43 | exit; |
44 | 44 | } |
45 | 45 | |
46 | -if ( ! class_exists( 'Give' ) ) : |
|
46 | +if ( ! class_exists('Give')) : |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Main Give Class |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @return Give |
238 | 238 | */ |
239 | 239 | public static function instance() { |
240 | - if ( is_null( self::$_instance ) ) { |
|
240 | + if (is_null(self::$_instance)) { |
|
241 | 241 | self::$_instance = new self(); |
242 | 242 | } |
243 | 243 | |
@@ -249,13 +249,13 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function __construct() { |
251 | 251 | // PHP version |
252 | - if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) { |
|
253 | - define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' ); |
|
252 | + if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) { |
|
253 | + define('GIVE_REQUIRED_PHP_VERSION', '5.3'); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | // Bailout: Need minimum php version to load plugin. |
257 | - if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) { |
|
258 | - add_action( 'admin_notices', array( $this, 'minmum_phpversion_notice' ) ); |
|
257 | + if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) { |
|
258 | + add_action('admin_notices', array($this, 'minmum_phpversion_notice')); |
|
259 | 259 | |
260 | 260 | return; |
261 | 261 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $this->includes(); |
266 | 266 | $this->init_hooks(); |
267 | 267 | |
268 | - do_action( 'give_loaded' ); |
|
268 | + do_action('give_loaded'); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -274,8 +274,8 @@ discard block |
||
274 | 274 | * @since 1.8.9 |
275 | 275 | */ |
276 | 276 | private function init_hooks() { |
277 | - register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
278 | - add_action( 'plugins_loaded', array( $this, 'init' ), 0 ); |
|
277 | + register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
278 | + add_action('plugins_loaded', array($this, 'init'), 0); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @since 1.8.9 |
292 | 292 | */ |
293 | - do_action( 'before_give_init' ); |
|
293 | + do_action('before_give_init'); |
|
294 | 294 | |
295 | 295 | // Set up localization. |
296 | 296 | $this->load_textdomain(); |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * |
321 | 321 | * @since 1.8.7 |
322 | 322 | */ |
323 | - do_action( 'give_init', $this ); |
|
323 | + do_action('give_init', $this); |
|
324 | 324 | |
325 | 325 | } |
326 | 326 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | */ |
338 | 338 | public function __clone() { |
339 | 339 | // Cloning instances of the class is forbidden. |
340 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
340 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | */ |
351 | 351 | public function __wakeup() { |
352 | 352 | // Unserializing instances of the class is forbidden. |
353 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
353 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |
@@ -364,33 +364,33 @@ discard block |
||
364 | 364 | private function setup_constants() { |
365 | 365 | |
366 | 366 | // Plugin version |
367 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
368 | - define( 'GIVE_VERSION', '2.0.4' ); |
|
367 | + if ( ! defined('GIVE_VERSION')) { |
|
368 | + define('GIVE_VERSION', '2.0.4'); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | // Plugin Root File |
372 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
373 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
372 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
373 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | // Plugin Folder Path |
377 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
378 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) ); |
|
377 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
378 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE)); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | // Plugin Folder URL |
382 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
383 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) ); |
|
382 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
383 | + define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE)); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | // Plugin Basename aka: "give/give.php" |
387 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
388 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) ); |
|
387 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
388 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE)); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | // Make sure CAL_GREGORIAN is defined |
392 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
393 | - define( 'CAL_GREGORIAN', 1 ); |
|
392 | + if ( ! defined('CAL_GREGORIAN')) { |
|
393 | + define('CAL_GREGORIAN', 1); |
|
394 | 394 | } |
395 | 395 | } |
396 | 396 | |
@@ -408,152 +408,152 @@ discard block |
||
408 | 408 | /** |
409 | 409 | * Load libraries. |
410 | 410 | */ |
411 | - if ( ! class_exists( 'WP_Async_Request' ) ) { |
|
412 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' ); |
|
411 | + if ( ! class_exists('WP_Async_Request')) { |
|
412 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php'); |
|
413 | 413 | } |
414 | 414 | |
415 | - if ( ! class_exists( 'WP_Background_Process' ) ) { |
|
416 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' ); |
|
415 | + if ( ! class_exists('WP_Background_Process')) { |
|
416 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php'); |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | /** |
420 | 420 | * Load plugin files |
421 | 421 | */ |
422 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
423 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
422 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
423 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
424 | 424 | $give_options = give_get_settings(); |
425 | 425 | |
426 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
427 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php'; |
|
428 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
429 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php'; |
|
430 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
431 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
432 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
433 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
434 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
435 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
436 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php'; |
|
437 | - require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php'; |
|
438 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php'; |
|
439 | - |
|
440 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
441 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
442 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
443 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
444 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php'; |
|
445 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php'; |
|
446 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php'; |
|
447 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php'; |
|
448 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
449 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
450 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
451 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
452 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
453 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
454 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php'; |
|
455 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php'; |
|
456 | - |
|
457 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
458 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
459 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
460 | - require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php'; |
|
461 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
462 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
463 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
464 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
465 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
466 | - require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php'; |
|
467 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
468 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
469 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
470 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
471 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
472 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
473 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php'; |
|
474 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
475 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
476 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
477 | - |
|
478 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php'; |
|
479 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
480 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
481 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
482 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
483 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
484 | - |
|
485 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
486 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
487 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
488 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
489 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
490 | - |
|
491 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
492 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
493 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php'; |
|
494 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
495 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
496 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
497 | - |
|
498 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php'; |
|
499 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php'; |
|
500 | - |
|
501 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php'; |
|
502 | - |
|
503 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
504 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
426 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
427 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php'; |
|
428 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
429 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php'; |
|
430 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
431 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
432 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
433 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
434 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
435 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
436 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php'; |
|
437 | + require_once GIVE_PLUGIN_DIR.'includes/class-notices.php'; |
|
438 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php'; |
|
439 | + |
|
440 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
441 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
442 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
443 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
444 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php'; |
|
445 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php'; |
|
446 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php'; |
|
447 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php'; |
|
448 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
449 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
450 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
451 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
452 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
453 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
454 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php'; |
|
455 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php'; |
|
456 | + |
|
457 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
458 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
459 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
460 | + require_once GIVE_PLUGIN_DIR.'includes/import-functions.php'; |
|
461 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
462 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
463 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
464 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
465 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
466 | + require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php'; |
|
467 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
468 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
469 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
470 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
471 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
472 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
473 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php'; |
|
474 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
475 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
476 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
477 | + |
|
478 | + require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php'; |
|
479 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
480 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
481 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
482 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
483 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
484 | + |
|
485 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
486 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
487 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
488 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
489 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
490 | + |
|
491 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
492 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
493 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php'; |
|
494 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
495 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
496 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
497 | + |
|
498 | + require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php'; |
|
499 | + require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php'; |
|
500 | + |
|
501 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php'; |
|
502 | + |
|
503 | + if (defined('WP_CLI') && WP_CLI) { |
|
504 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
505 | 505 | } |
506 | 506 | |
507 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
508 | - |
|
509 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
510 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
511 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
512 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
513 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
514 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
515 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
516 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
517 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
518 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
519 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php'; |
|
520 | - |
|
521 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
522 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
523 | - |
|
524 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php'; |
|
525 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php'; |
|
526 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php'; |
|
527 | - |
|
528 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
529 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
530 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
531 | - |
|
532 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php'; |
|
533 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php'; |
|
534 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php'; |
|
535 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php'; |
|
536 | - |
|
537 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php'; |
|
538 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php'; |
|
539 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php'; |
|
540 | - |
|
541 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php'; |
|
542 | - |
|
543 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php'; |
|
544 | - |
|
545 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
546 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
547 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
548 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
549 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
550 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
551 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
552 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
553 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
507 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
508 | + |
|
509 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
510 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
511 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
512 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
513 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
514 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
515 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
516 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
517 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
518 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
519 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php'; |
|
520 | + |
|
521 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
522 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
523 | + |
|
524 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php'; |
|
525 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php'; |
|
526 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php'; |
|
527 | + |
|
528 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
529 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
530 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
531 | + |
|
532 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php'; |
|
533 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php'; |
|
534 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php'; |
|
535 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php'; |
|
536 | + |
|
537 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php'; |
|
538 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php'; |
|
539 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php'; |
|
540 | + |
|
541 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'; |
|
542 | + |
|
543 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php'; |
|
544 | + |
|
545 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
546 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
547 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
548 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
549 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
550 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
551 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
552 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
553 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
554 | 554 | }// End if(). |
555 | 555 | |
556 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
556 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
557 | 557 | |
558 | 558 | } |
559 | 559 | |
@@ -568,16 +568,16 @@ discard block |
||
568 | 568 | public function load_textdomain() { |
569 | 569 | |
570 | 570 | // Set filter for Give's languages directory |
571 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
572 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
571 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
572 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
573 | 573 | |
574 | 574 | // Traditional WordPress plugin locale filter. |
575 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
576 | - $locale = apply_filters( 'plugin_locale', $locale, 'give' ); |
|
575 | + $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
576 | + $locale = apply_filters('plugin_locale', $locale, 'give'); |
|
577 | 577 | |
578 | - unload_textdomain( 'give' ); |
|
579 | - load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' ); |
|
580 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
578 | + unload_textdomain('give'); |
|
579 | + load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo'); |
|
580 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
581 | 581 | |
582 | 582 | } |
583 | 583 | |
@@ -590,17 +590,17 @@ discard block |
||
590 | 590 | */ |
591 | 591 | public function minmum_phpversion_notice() { |
592 | 592 | // Bailout. |
593 | - if ( ! is_admin() ) { |
|
593 | + if ( ! is_admin()) { |
|
594 | 594 | return; |
595 | 595 | } |
596 | 596 | |
597 | - $notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>'; |
|
598 | - $notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>'; |
|
599 | - $notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>'; |
|
600 | - $notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>'; |
|
601 | - $notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>'; |
|
602 | - $notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>'; |
|
603 | - $notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>'; |
|
597 | + $notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>'; |
|
598 | + $notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>'; |
|
599 | + $notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>'; |
|
600 | + $notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>'; |
|
601 | + $notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>'; |
|
602 | + $notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>'; |
|
603 | + $notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>'; |
|
604 | 604 | |
605 | 605 | echo sprintf( |
606 | 606 | '<div class="notice notice-error">%1$s</div>', |
@@ -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 | |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * @access public |
73 | 73 | */ |
74 | 74 | public function __construct() { |
75 | - if( is_multisite() ) { |
|
76 | - add_action( 'switch_blog', array( $this, 'handle_switch_blog' ), 10, 2 ); |
|
75 | + if (is_multisite()) { |
|
76 | + add_action('switch_blog', array($this, 'handle_switch_blog'), 10, 2); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -111,16 +111,16 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @return object |
113 | 113 | */ |
114 | - public function get( $row_id ) { |
|
114 | + public function get($row_id) { |
|
115 | 115 | /* @var WPDB $wpdb */ |
116 | 116 | global $wpdb; |
117 | 117 | |
118 | 118 | // Bailout. |
119 | - if ( empty( $row_id ) ) { |
|
119 | + if (empty($row_id)) { |
|
120 | 120 | return null; |
121 | 121 | } |
122 | 122 | |
123 | - return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
|
123 | + return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id)); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -134,18 +134,18 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @return object |
136 | 136 | */ |
137 | - public function get_by( $column, $row_id ) { |
|
137 | + public function get_by($column, $row_id) { |
|
138 | 138 | /* @var WPDB $wpdb */ |
139 | 139 | global $wpdb; |
140 | 140 | |
141 | 141 | // Bailout. |
142 | - if ( empty( $column ) || empty( $row_id ) ) { |
|
142 | + if (empty($column) || empty($row_id)) { |
|
143 | 143 | return null; |
144 | 144 | } |
145 | 145 | |
146 | - $column = esc_sql( $column ); |
|
146 | + $column = esc_sql($column); |
|
147 | 147 | |
148 | - return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) ); |
|
148 | + return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id)); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -159,18 +159,18 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @return string Column value. |
161 | 161 | */ |
162 | - public function get_column( $column, $row_id ) { |
|
162 | + public function get_column($column, $row_id) { |
|
163 | 163 | /* @var WPDB $wpdb */ |
164 | 164 | global $wpdb; |
165 | 165 | |
166 | 166 | // Bailout. |
167 | - if ( empty( $column ) || empty( $row_id ) ) { |
|
167 | + if (empty($column) || empty($row_id)) { |
|
168 | 168 | return null; |
169 | 169 | } |
170 | 170 | |
171 | - $column = esc_sql( $column ); |
|
171 | + $column = esc_sql($column); |
|
172 | 172 | |
173 | - return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
|
173 | + return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id)); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -185,19 +185,19 @@ discard block |
||
185 | 185 | * |
186 | 186 | * @return string |
187 | 187 | */ |
188 | - public function get_column_by( $column, $column_where, $column_value ) { |
|
188 | + public function get_column_by($column, $column_where, $column_value) { |
|
189 | 189 | /* @var WPDB $wpdb */ |
190 | 190 | global $wpdb; |
191 | 191 | |
192 | 192 | // Bailout. |
193 | - if ( empty( $column ) || empty( $column_where ) || empty( $column_value ) ) { |
|
193 | + if (empty($column) || empty($column_where) || empty($column_value)) { |
|
194 | 194 | return null; |
195 | 195 | } |
196 | 196 | |
197 | - $column_where = esc_sql( $column_where ); |
|
198 | - $column = esc_sql( $column ); |
|
197 | + $column_where = esc_sql($column_where); |
|
198 | + $column = esc_sql($column); |
|
199 | 199 | |
200 | - return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) ); |
|
200 | + return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value)); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
@@ -211,12 +211,12 @@ discard block |
||
211 | 211 | * |
212 | 212 | * @return int |
213 | 213 | */ |
214 | - public function insert( $data, $type = '' ) { |
|
214 | + public function insert($data, $type = '') { |
|
215 | 215 | /* @var WPDB $wpdb */ |
216 | 216 | global $wpdb; |
217 | 217 | |
218 | 218 | // Set default values. |
219 | - $data = wp_parse_args( $data, $this->get_column_defaults() ); |
|
219 | + $data = wp_parse_args($data, $this->get_column_defaults()); |
|
220 | 220 | |
221 | 221 | /** |
222 | 222 | * Fires before inserting data to the database. |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * |
226 | 226 | * @param array $data |
227 | 227 | */ |
228 | - do_action( "give_pre_insert_{$type}", $data ); |
|
228 | + do_action("give_pre_insert_{$type}", $data); |
|
229 | 229 | |
230 | 230 | // Initialise column format array |
231 | 231 | $column_formats = $this->get_columns(); |
@@ -234,13 +234,13 @@ discard block |
||
234 | 234 | // $data = array_change_key_case( $data ); |
235 | 235 | |
236 | 236 | // White list columns |
237 | - $data = array_intersect_key( $data, $column_formats ); |
|
237 | + $data = array_intersect_key($data, $column_formats); |
|
238 | 238 | |
239 | 239 | // Reorder $column_formats to match the order of columns given in $data |
240 | - $data_keys = array_keys( $data ); |
|
241 | - $column_formats = array_merge( array_flip( $data_keys ), $column_formats ); |
|
240 | + $data_keys = array_keys($data); |
|
241 | + $column_formats = array_merge(array_flip($data_keys), $column_formats); |
|
242 | 242 | |
243 | - $wpdb->insert( $this->table_name, $data, $column_formats ); |
|
243 | + $wpdb->insert($this->table_name, $data, $column_formats); |
|
244 | 244 | |
245 | 245 | /** |
246 | 246 | * Fires after inserting data to the database. |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | * @param int $insert_id |
251 | 251 | * @param array $data |
252 | 252 | */ |
253 | - do_action( "give_post_insert_{$type}", $wpdb->insert_id, $data ); |
|
253 | + do_action("give_post_insert_{$type}", $wpdb->insert_id, $data); |
|
254 | 254 | |
255 | 255 | return $wpdb->insert_id; |
256 | 256 | } |
@@ -267,18 +267,18 @@ discard block |
||
267 | 267 | * |
268 | 268 | * @return bool |
269 | 269 | */ |
270 | - public function update( $row_id, $data = array(), $where = '' ) { |
|
270 | + public function update($row_id, $data = array(), $where = '') { |
|
271 | 271 | /* @var WPDB $wpdb */ |
272 | 272 | global $wpdb; |
273 | 273 | |
274 | 274 | // Row ID must be positive integer |
275 | - $row_id = absint( $row_id ); |
|
275 | + $row_id = absint($row_id); |
|
276 | 276 | |
277 | - if ( empty( $row_id ) ) { |
|
277 | + if (empty($row_id)) { |
|
278 | 278 | return false; |
279 | 279 | } |
280 | 280 | |
281 | - if ( empty( $where ) ) { |
|
281 | + if (empty($where)) { |
|
282 | 282 | $where = $this->primary_key; |
283 | 283 | } |
284 | 284 | |
@@ -286,16 +286,16 @@ discard block |
||
286 | 286 | $column_formats = $this->get_columns(); |
287 | 287 | |
288 | 288 | // Force fields to lower case |
289 | - $data = array_change_key_case( $data ); |
|
289 | + $data = array_change_key_case($data); |
|
290 | 290 | |
291 | 291 | // White list columns |
292 | - $data = array_intersect_key( $data, $column_formats ); |
|
292 | + $data = array_intersect_key($data, $column_formats); |
|
293 | 293 | |
294 | 294 | // Reorder $column_formats to match the order of columns given in $data |
295 | - $data_keys = array_keys( $data ); |
|
296 | - $column_formats = array_merge( array_flip( $data_keys ), $column_formats ); |
|
295 | + $data_keys = array_keys($data); |
|
296 | + $column_formats = array_merge(array_flip($data_keys), $column_formats); |
|
297 | 297 | |
298 | - if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) { |
|
298 | + if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) { |
|
299 | 299 | return false; |
300 | 300 | } |
301 | 301 | |
@@ -312,18 +312,18 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @return bool |
314 | 314 | */ |
315 | - public function delete( $row_id = 0 ) { |
|
315 | + public function delete($row_id = 0) { |
|
316 | 316 | /* @var WPDB $wpdb */ |
317 | 317 | global $wpdb; |
318 | 318 | |
319 | 319 | // Row ID must be positive integer |
320 | - $row_id = absint( $row_id ); |
|
320 | + $row_id = absint($row_id); |
|
321 | 321 | |
322 | - if ( empty( $row_id ) ) { |
|
322 | + if (empty($row_id)) { |
|
323 | 323 | return false; |
324 | 324 | } |
325 | 325 | |
326 | - if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) { |
|
326 | + if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) { |
|
327 | 327 | return false; |
328 | 328 | } |
329 | 329 | |
@@ -340,13 +340,13 @@ discard block |
||
340 | 340 | * |
341 | 341 | * @return bool If the table name exists. |
342 | 342 | */ |
343 | - public function table_exists( $table ) { |
|
343 | + public function table_exists($table) { |
|
344 | 344 | /* @var WPDB $wpdb */ |
345 | 345 | global $wpdb; |
346 | 346 | |
347 | - $table = sanitize_text_field( $table ); |
|
347 | + $table = sanitize_text_field($table); |
|
348 | 348 | |
349 | - return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table; |
|
349 | + return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table; |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | /** |
@@ -360,16 +360,16 @@ discard block |
||
360 | 360 | * |
361 | 361 | * @return bool |
362 | 362 | */ |
363 | - public function does_column_exist( $column_name ) { |
|
363 | + public function does_column_exist($column_name) { |
|
364 | 364 | |
365 | 365 | global $wpdb; |
366 | 366 | |
367 | - $column = $wpdb->get_results( $wpdb->prepare( |
|
367 | + $column = $wpdb->get_results($wpdb->prepare( |
|
368 | 368 | "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ", |
369 | 369 | DB_NAME, $this->table_name, $column_name |
370 | - ) ); |
|
370 | + )); |
|
371 | 371 | |
372 | - if ( ! empty( $column ) ) { |
|
372 | + if ( ! empty($column)) { |
|
373 | 373 | return true; |
374 | 374 | } |
375 | 375 | |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | * @return bool Returns if the customers table was installed and upgrade routine run. |
386 | 386 | */ |
387 | 387 | public function installed() { |
388 | - return $this->table_exists( $this->table_name ); |
|
388 | + return $this->table_exists($this->table_name); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | /** |
@@ -395,8 +395,8 @@ discard block |
||
395 | 395 | * @access public |
396 | 396 | */ |
397 | 397 | public function register_table() { |
398 | - $current_version = get_option( $this->table_name . '_db_version' ); |
|
399 | - if ( ! $current_version || version_compare( $current_version, $this->version, '<' ) ) { |
|
398 | + $current_version = get_option($this->table_name.'_db_version'); |
|
399 | + if ( ! $current_version || version_compare($current_version, $this->version, '<')) { |
|
400 | 400 | $this->create_table(); |
401 | 401 | } |
402 | 402 | } |
@@ -421,23 +421,23 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @return int|bool The normalized log ID or false if it's found to not be valid. |
423 | 423 | */ |
424 | - public function sanitize_id( $id ) { |
|
425 | - if ( ! is_numeric( $id ) ) { |
|
424 | + public function sanitize_id($id) { |
|
425 | + if ( ! is_numeric($id)) { |
|
426 | 426 | return false; |
427 | 427 | } |
428 | 428 | |
429 | 429 | $id = (int) $id; |
430 | 430 | |
431 | 431 | // We were given a non positive number. |
432 | - if ( absint( $id ) !== $id ) { |
|
432 | + if (absint($id) !== $id) { |
|
433 | 433 | return false; |
434 | 434 | } |
435 | 435 | |
436 | - if ( empty( $id ) ) { |
|
436 | + if (empty($id)) { |
|
437 | 437 | return false; |
438 | 438 | } |
439 | 439 | |
440 | - return absint( $id ); |
|
440 | + return absint($id); |
|
441 | 441 | |
442 | 442 | } |
443 | 443 | |
@@ -451,23 +451,23 @@ discard block |
||
451 | 451 | * @param $new_blog_id |
452 | 452 | * @param $prev_blog_id |
453 | 453 | */ |
454 | - public function handle_switch_blog( $new_blog_id, $prev_blog_id ) { |
|
454 | + public function handle_switch_blog($new_blog_id, $prev_blog_id) { |
|
455 | 455 | global $wpdb; |
456 | 456 | |
457 | 457 | // Bailout. |
458 | - if ( $new_blog_id === $prev_blog_id ) { |
|
458 | + if ($new_blog_id === $prev_blog_id) { |
|
459 | 459 | return; |
460 | 460 | } |
461 | 461 | |
462 | 462 | |
463 | 463 | $this->table_name = str_replace( |
464 | - 1 != $prev_blog_id ? $wpdb->get_blog_prefix( $prev_blog_id ) : $wpdb->base_prefix, |
|
465 | - 1 != $new_blog_id ? $wpdb->get_blog_prefix( $new_blog_id ) : $wpdb->base_prefix, |
|
464 | + 1 != $prev_blog_id ? $wpdb->get_blog_prefix($prev_blog_id) : $wpdb->base_prefix, |
|
465 | + 1 != $new_blog_id ? $wpdb->get_blog_prefix($new_blog_id) : $wpdb->base_prefix, |
|
466 | 466 | $this->table_name |
467 | 467 | ); |
468 | 468 | |
469 | - if ( $this instanceof Give_DB_Meta ) { |
|
470 | - $wpdb->{$this->get_meta_type() . 'meta'} = $this->table_name; |
|
469 | + if ($this instanceof Give_DB_Meta) { |
|
470 | + $wpdb->{$this->get_meta_type().'meta'} = $this->table_name; |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.8.13 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -75,63 +75,63 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function init() { |
77 | 77 | // Bail early if screen cannot be detected. |
78 | - if ( empty( $this->screen ) ) { |
|
78 | + if (empty($this->screen)) { |
|
79 | 79 | return null; |
80 | 80 | } |
81 | 81 | |
82 | 82 | $content = array(); |
83 | 83 | |
84 | 84 | // Define content and hook into the appropriate action. |
85 | - switch ( $this->screen ) { |
|
85 | + switch ($this->screen) { |
|
86 | 86 | // Forms screen. |
87 | 87 | case 'edit-give_forms': |
88 | - $this->form = $this->post_exists( 'give_forms' ); |
|
88 | + $this->form = $this->post_exists('give_forms'); |
|
89 | 89 | |
90 | - if ( $this->form ) { |
|
90 | + if ($this->form) { |
|
91 | 91 | // Form exists. Bail out. |
92 | 92 | return false; |
93 | 93 | } else { |
94 | 94 | // No forms exist. |
95 | - $content = $this->get_content( 'no_forms' ); |
|
95 | + $content = $this->get_content('no_forms'); |
|
96 | 96 | } |
97 | 97 | |
98 | - add_action( 'manage_posts_extra_tablenav', array( $this, 'render' ) ); |
|
98 | + add_action('manage_posts_extra_tablenav', array($this, 'render')); |
|
99 | 99 | break; |
100 | 100 | // Donations screen. |
101 | 101 | case 'give_forms_page_give-payment-history': |
102 | - $this->form = $this->post_exists( 'give_forms' ); |
|
103 | - $this->donation = $this->post_exists( 'give_payment' ); |
|
102 | + $this->form = $this->post_exists('give_forms'); |
|
103 | + $this->donation = $this->post_exists('give_payment'); |
|
104 | 104 | |
105 | - if ( $this->donation ) { |
|
105 | + if ($this->donation) { |
|
106 | 106 | // Donation exists. Bail out. |
107 | 107 | return false; |
108 | - } elseif ( ! $this->form ) { |
|
108 | + } elseif ( ! $this->form) { |
|
109 | 109 | // No forms and no donations exist. |
110 | - $content = $this->get_content( 'no_donations_or_forms' ); |
|
110 | + $content = $this->get_content('no_donations_or_forms'); |
|
111 | 111 | } else { |
112 | 112 | // No donations exist but a form does exist. |
113 | - $content = $this->get_content( 'no_donations' ); |
|
113 | + $content = $this->get_content('no_donations'); |
|
114 | 114 | } |
115 | 115 | |
116 | - add_action( 'give_payments_page_bottom', array( $this, 'render' ) ); |
|
116 | + add_action('give_payments_page_bottom', array($this, 'render')); |
|
117 | 117 | break; |
118 | 118 | // Donors screen. |
119 | 119 | case 'give_forms_page_give-donors': |
120 | - $this->form = $this->post_exists( 'give_forms' ); |
|
120 | + $this->form = $this->post_exists('give_forms'); |
|
121 | 121 | $this->donor = $this->donor_exists(); |
122 | 122 | |
123 | - if ( $this->donor ) { |
|
123 | + if ($this->donor) { |
|
124 | 124 | // Donor exists. Bail out. |
125 | 125 | return false; |
126 | - } elseif ( ! $this->form ) { |
|
126 | + } elseif ( ! $this->form) { |
|
127 | 127 | // No forms and no donors exist. |
128 | - $content = $this->get_content( 'no_donors_or_forms' ); |
|
128 | + $content = $this->get_content('no_donors_or_forms'); |
|
129 | 129 | } else { |
130 | 130 | // No donors exist but a form does exist. |
131 | - $content = $this->get_content( 'no_donors' ); |
|
131 | + $content = $this->get_content('no_donors'); |
|
132 | 132 | } |
133 | 133 | |
134 | - add_action( 'give_donors_table_bottom', array( $this, 'render' ) ); |
|
134 | + add_action('give_donors_table_bottom', array($this, 'render')); |
|
135 | 135 | break; |
136 | 136 | default: |
137 | 137 | return null; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $this->content = $content; |
141 | 141 | |
142 | 142 | // Hide non-essential UI elements. |
143 | - add_action( 'admin_head', array( $this, 'hide_ui' ) ); |
|
143 | + add_action('admin_head', array($this, 'hide_ui')); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @param string $which The location of the list table hook: 'top' or 'bottom'. |
152 | 152 | */ |
153 | - public function render( $which = 'bottom') { |
|
153 | + public function render($which = 'bottom') { |
|
154 | 154 | // Bail out to prevent content from rendering twice. |
155 | - if ( 'top' === $which ) { |
|
155 | + if ('top' === $which) { |
|
156 | 156 | return null; |
157 | 157 | } |
158 | 158 | |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @param string $screen The current screen ID. |
179 | 179 | */ |
180 | - $content = apply_filters( 'give_blank_slate_content', $this->content, $screen ); |
|
180 | + $content = apply_filters('give_blank_slate_content', $this->content, $screen); |
|
181 | 181 | |
182 | - $template_path = GIVE_PLUGIN_DIR . 'includes/admin/views/blank-slate.php'; |
|
182 | + $template_path = GIVE_PLUGIN_DIR.'includes/admin/views/blank-slate.php'; |
|
183 | 183 | |
184 | 184 | include $template_path; |
185 | 185 | } |
@@ -214,17 +214,17 @@ discard block |
||
214 | 214 | * @param string $post_type Post type used in the query. |
215 | 215 | * @return bool True if post exists, otherwise false. |
216 | 216 | */ |
217 | - private function post_exists( $post_type ) { |
|
217 | + private function post_exists($post_type) { |
|
218 | 218 | // Attempt to get a single post of the post type. |
219 | - $query = new WP_Query( array( |
|
219 | + $query = new WP_Query(array( |
|
220 | 220 | 'post_type' => $post_type, |
221 | 221 | 'posts_per_page' => 1, |
222 | 222 | 'no_found_rows' => false, |
223 | 223 | 'update_post_meta_cache' => false, |
224 | 224 | 'update_post_term_cache' => false, |
225 | 225 | 'fields' => 'ids', |
226 | - 'post_status' => array( 'any', 'trash' ), |
|
227 | - ) ); |
|
226 | + 'post_status' => array('any', 'trash'), |
|
227 | + )); |
|
228 | 228 | |
229 | 229 | return $query->have_posts(); |
230 | 230 | } |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | * @return bool True if donor exists, otherwise false. |
238 | 238 | */ |
239 | 239 | private function donor_exists() { |
240 | - $donors = Give()->donors->get_donors( array( 'number' => 1 ) ); |
|
240 | + $donors = Give()->donors->get_donors(array('number' => 1)); |
|
241 | 241 | |
242 | - return ! empty( $donors ); |
|
242 | + return ! empty($donors); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -250,17 +250,17 @@ discard block |
||
250 | 250 | * @param string $context The key used to determine which content is returned. |
251 | 251 | * @return array Blank slate content. |
252 | 252 | */ |
253 | - private function get_content( $context ) { |
|
253 | + private function get_content($context) { |
|
254 | 254 | // Define default content. |
255 | 255 | $defaults = array( |
256 | - 'image_url' => GIVE_PLUGIN_URL . 'assets/images/svg/give-icon-full-circle.svg', |
|
257 | - 'image_alt' => __( 'Give Icon', 'give' ), |
|
258 | - 'heading' => __( 'No donation forms found.', 'give' ), |
|
259 | - 'message' => __( 'The first step towards accepting online donations is to create a form.', 'give' ), |
|
260 | - 'cta_text' => __( 'Create Donation Form', 'give' ), |
|
261 | - 'cta_link' => admin_url( 'post-new.php?post_type=give_forms' ), |
|
256 | + 'image_url' => GIVE_PLUGIN_URL.'assets/images/svg/give-icon-full-circle.svg', |
|
257 | + 'image_alt' => __('Give Icon', 'give'), |
|
258 | + 'heading' => __('No donation forms found.', 'give'), |
|
259 | + 'message' => __('The first step towards accepting online donations is to create a form.', 'give'), |
|
260 | + 'cta_text' => __('Create Donation Form', 'give'), |
|
261 | + 'cta_link' => admin_url('post-new.php?post_type=give_forms'), |
|
262 | 262 | 'help' => sprintf( |
263 | - __( 'Need help? Get started with %sGive 101%s.', 'give' ), |
|
263 | + __('Need help? Get started with %sGive 101%s.', 'give'), |
|
264 | 264 | '<a href="http://docs.givewp.com/give101/" target="_blank">', |
265 | 265 | '</a>' |
266 | 266 | ), |
@@ -269,40 +269,40 @@ discard block |
||
269 | 269 | // Define contextual content. |
270 | 270 | $content = array( |
271 | 271 | 'no_donations_or_forms' => array( |
272 | - 'heading' => __( 'No donations found.', 'give' ), |
|
273 | - 'message' => __( 'Your donation history will appear here, but first, you need a donation form!', 'give' ), |
|
272 | + 'heading' => __('No donations found.', 'give'), |
|
273 | + 'message' => __('Your donation history will appear here, but first, you need a donation form!', 'give'), |
|
274 | 274 | ), |
275 | 275 | 'no_donations' => array( |
276 | - 'heading' => __( 'No donations found.', 'give' ), |
|
277 | - 'message' => __( 'When your first donation arrives, a record of the donation will appear here.', 'give' ), |
|
278 | - 'cta_text' => __( 'View All Forms', 'give' ), |
|
279 | - 'cta_link' => admin_url( 'edit.php?post_type=give_forms' ), |
|
276 | + 'heading' => __('No donations found.', 'give'), |
|
277 | + 'message' => __('When your first donation arrives, a record of the donation will appear here.', 'give'), |
|
278 | + 'cta_text' => __('View All Forms', 'give'), |
|
279 | + 'cta_link' => admin_url('edit.php?post_type=give_forms'), |
|
280 | 280 | 'help' => sprintf( |
281 | - __( 'Need help? Learn more about %sDonations%s.', 'give' ), |
|
281 | + __('Need help? Learn more about %sDonations%s.', 'give'), |
|
282 | 282 | '<a href="http://docs.givewp.com/core-donations/">', |
283 | 283 | '</a>' |
284 | 284 | ), |
285 | 285 | ), |
286 | 286 | 'no_donors_or_forms' => array( |
287 | - 'heading' => __( 'No donors found.', 'give' ), |
|
288 | - 'message' => __( 'Your donor history will appear here, but first, you need a donation form!', 'give' ), |
|
287 | + 'heading' => __('No donors found.', 'give'), |
|
288 | + 'message' => __('Your donor history will appear here, but first, you need a donation form!', 'give'), |
|
289 | 289 | ), |
290 | 290 | 'no_donors' => array( |
291 | - 'heading' => __( 'No donors found.', 'give' ), |
|
292 | - 'message' => __( 'When your first donation arrives, the donor will appear here.', 'give' ), |
|
293 | - 'cta_text' => __( 'View All Forms', 'give' ), |
|
294 | - 'cta_link' => admin_url( 'edit.php?post_type=give_forms' ), |
|
291 | + 'heading' => __('No donors found.', 'give'), |
|
292 | + 'message' => __('When your first donation arrives, the donor will appear here.', 'give'), |
|
293 | + 'cta_text' => __('View All Forms', 'give'), |
|
294 | + 'cta_link' => admin_url('edit.php?post_type=give_forms'), |
|
295 | 295 | 'help' => sprintf( |
296 | - __( 'Need help? Learn more about %sDonors%s.', 'give' ), |
|
296 | + __('Need help? Learn more about %sDonors%s.', 'give'), |
|
297 | 297 | '<a href="http://docs.givewp.com/core-donors/">', |
298 | 298 | '</a>' |
299 | 299 | ), |
300 | 300 | ), |
301 | 301 | ); |
302 | 302 | |
303 | - if ( isset( $content[ $context ] ) ) { |
|
303 | + if (isset($content[$context])) { |
|
304 | 304 | // Merge contextual content with defaults. |
305 | - return wp_parse_args( $content[ $context ], $defaults ); |
|
305 | + return wp_parse_args($content[$context], $defaults); |
|
306 | 306 | } else { |
307 | 307 | // Return defaults if context is undefined. |
308 | 308 | return $defaults; |