@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param $url |
74 | 74 | * |
75 | - * @return mixed |
|
75 | + * @return string |
|
76 | 76 | */ |
77 | 77 | public function give_update_cmb_meta_box_url( $url ) { |
78 | 78 | // Path to Give's CMB |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | * @since 1.3.5 |
936 | 936 | * |
937 | 937 | * @param $array |
938 | - * @param $position |int|string Expects an array key or 'id' of the settings field to appear after |
|
938 | + * @param string $position |int|string Expects an array key or 'id' of the settings field to appear after |
|
939 | 939 | * @param $insert |array a valid array of options to insert |
940 | 940 | * |
941 | 941 | * @return array |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | * @since 1.0 |
975 | 975 | * |
976 | 976 | * @param array $field_arr |
977 | - * @param array $saved_values |
|
977 | + * @param string|boolean $saved_values |
|
978 | 978 | * |
979 | 979 | * @return void |
980 | 980 | */ |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | * @since 1.0 |
1010 | 1010 | * |
1011 | 1011 | * @param array $field_arr |
1012 | - * @param array $saved_value |
|
1012 | + * @param string|boolean $saved_value |
|
1013 | 1013 | * |
1014 | 1014 | * @return void |
1015 | 1015 | */ |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | * @params $string text |
1164 | 1164 | * @params $filter array |
1165 | 1165 | * |
1166 | - * @return text $string |
|
1166 | + * @return string $string |
|
1167 | 1167 | */ |
1168 | 1168 | function give_slug_to_title( $string, $filters = array() ){ |
1169 | 1169 |
@@ -1167,12 +1167,12 @@ |
||
1167 | 1167 | */ |
1168 | 1168 | function give_slug_to_title( $string, $filters = array() ){ |
1169 | 1169 | |
1170 | - foreach( $filters as $filter_item ){ |
|
1171 | - $string = str_replace( $filter_item, ' ', $string ); |
|
1172 | - } |
|
1170 | + foreach( $filters as $filter_item ){ |
|
1171 | + $string = str_replace( $filter_item, ' ', $string ); |
|
1172 | + } |
|
1173 | 1173 | |
1174 | - // Return updated string after converting it to title case |
|
1175 | - return ucwords( $string ); |
|
1174 | + // Return updated string after converting it to title case |
|
1175 | + return ucwords( $string ); |
|
1176 | 1176 | |
1177 | 1177 | } |
1178 | 1178 |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | public function __construct() { |
44 | 44 | |
45 | 45 | // Custom CMB2 Settings Fields |
46 | - add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 ); |
|
47 | - add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 ); |
|
48 | - add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 ); |
|
49 | - add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 ); |
|
50 | - add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 ); |
|
51 | - add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 ); |
|
52 | - add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 ); |
|
53 | - add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 ); |
|
46 | + add_action('cmb2_render_give_title', 'give_title_callback', 10, 5); |
|
47 | + add_action('cmb2_render_give_description', 'give_description_callback', 10, 5); |
|
48 | + add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5); |
|
49 | + add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5); |
|
50 | + add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5); |
|
51 | + add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5); |
|
52 | + add_action('cmb2_render_api', 'give_api_callback', 10, 5); |
|
53 | + add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @since 1.0 |
61 | 61 | */ |
62 | 62 | public function init() { |
63 | - register_setting( $this->key, $this->key ); |
|
63 | + register_setting($this->key, $this->key); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return mixed |
76 | 76 | */ |
77 | - public function give_update_cmb_meta_box_url( $url ) { |
|
77 | + public function give_update_cmb_meta_box_url($url) { |
|
78 | 78 | // Path to Give's CMB |
79 | - return GIVE_PLUGIN_URL . '/includes/libraries/cmb2'; |
|
79 | + return GIVE_PLUGIN_URL.'/includes/libraries/cmb2'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -88,27 +88,27 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function give_get_settings_tabs() { |
90 | 90 | |
91 | - $settings = $this->give_settings( null ); |
|
91 | + $settings = $this->give_settings(null); |
|
92 | 92 | |
93 | 93 | $tabs = array(); |
94 | - $tabs['general'] = __( 'General', 'give' ); |
|
95 | - $tabs['gateways'] = __( 'Payment Gateways', 'give' ); |
|
96 | - $tabs['display'] = __( 'Display Options', 'give' ); |
|
97 | - $tabs['emails'] = __( 'Emails', 'give' ); |
|
94 | + $tabs['general'] = __('General', 'give'); |
|
95 | + $tabs['gateways'] = __('Payment Gateways', 'give'); |
|
96 | + $tabs['display'] = __('Display Options', 'give'); |
|
97 | + $tabs['emails'] = __('Emails', 'give'); |
|
98 | 98 | |
99 | - if ( ! empty( $settings['addons']['fields'] ) ) { |
|
100 | - $tabs['addons'] = __( 'Add-ons', 'give' ); |
|
99 | + if ( ! empty($settings['addons']['fields'])) { |
|
100 | + $tabs['addons'] = __('Add-ons', 'give'); |
|
101 | 101 | } |
102 | 102 | |
103 | - if ( ! empty( $settings['licenses']['fields'] ) ) { |
|
104 | - $tabs['licenses'] = __( 'Licenses', 'give' ); |
|
103 | + if ( ! empty($settings['licenses']['fields'])) { |
|
104 | + $tabs['licenses'] = __('Licenses', 'give'); |
|
105 | 105 | } |
106 | 106 | |
107 | - $tabs['advanced'] = __( 'Advanced', 'give' ); |
|
108 | - $tabs['api'] = __( 'API', 'give' ); |
|
109 | - $tabs['system_info'] = __( 'System Info', 'give' ); |
|
107 | + $tabs['advanced'] = __('Advanced', 'give'); |
|
108 | + $tabs['api'] = __('API', 'give'); |
|
109 | + $tabs['system_info'] = __('System Info', 'give'); |
|
110 | 110 | |
111 | - return apply_filters( 'give_settings_tabs', $tabs ); |
|
111 | + return apply_filters('give_settings_tabs', $tabs); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function admin_page_display() { |
121 | 121 | |
122 | - $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general'; |
|
122 | + $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general'; |
|
123 | 123 | |
124 | 124 | ?> |
125 | 125 | |
@@ -129,22 +129,22 @@ discard block |
||
129 | 129 | |
130 | 130 | <h2 class="nav-tab-wrapper"> |
131 | 131 | <?php |
132 | - foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) { |
|
132 | + foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) { |
|
133 | 133 | |
134 | - $tab_url = esc_url( add_query_arg( array( |
|
134 | + $tab_url = esc_url(add_query_arg(array( |
|
135 | 135 | 'settings-updated' => false, |
136 | 136 | 'tab' => $tab_id, |
137 | - ) ) ); |
|
137 | + ))); |
|
138 | 138 | |
139 | 139 | $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; |
140 | 140 | |
141 | - echo '<a href="' . esc_url( $tab_url ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>'; |
|
141 | + echo '<a href="'.esc_url($tab_url).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>'; |
|
142 | 142 | |
143 | 143 | } |
144 | 144 | ?> |
145 | 145 | </h2> |
146 | 146 | |
147 | - <?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?> |
|
147 | + <?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?> |
|
148 | 148 | |
149 | 149 | </div><!-- .wrap --> |
150 | 150 | |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return string |
168 | 168 | */ |
169 | - function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) { |
|
169 | + function give_modify_cmb2_form_output($form_format, $object_id, $cmb) { |
|
170 | 170 | |
171 | 171 | // only modify the give settings form |
172 | - if ( 'give_settings' == $object_id ) { |
|
172 | + if ('give_settings' == $object_id) { |
|
173 | 173 | |
174 | - return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . esc_attr__( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>'; |
|
174 | + return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.esc_attr__('Save Settings', 'give').'" class="button-primary"></div></form>'; |
|
175 | 175 | |
176 | 176 | } |
177 | 177 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @return array |
190 | 190 | */ |
191 | - public function give_settings( $active_tab ) { |
|
191 | + public function give_settings($active_tab) { |
|
192 | 192 | |
193 | 193 | $give_settings = array( |
194 | 194 | /** |
@@ -196,99 +196,99 @@ discard block |
||
196 | 196 | */ |
197 | 197 | 'general' => array( |
198 | 198 | 'id' => 'general_settings', |
199 | - 'give_title' => __( 'General Settings', 'give' ), |
|
200 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
201 | - 'fields' => apply_filters( 'give_settings_general', array( |
|
199 | + 'give_title' => __('General Settings', 'give'), |
|
200 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
201 | + 'fields' => apply_filters('give_settings_general', array( |
|
202 | 202 | array( |
203 | - 'name' => __( 'General Settings', 'give' ), |
|
203 | + 'name' => __('General Settings', 'give'), |
|
204 | 204 | 'desc' => '', |
205 | 205 | 'type' => 'give_title', |
206 | 206 | 'id' => 'give_title_general_settings_1', |
207 | 207 | ), |
208 | 208 | array( |
209 | - 'name' => __( 'Success Page', 'give' ), |
|
209 | + 'name' => __('Success Page', 'give'), |
|
210 | 210 | /* translators: %s: [give_receipt] */ |
211 | - 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
211 | + 'desc' => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
212 | 212 | 'id' => 'success_page', |
213 | 213 | 'type' => 'select', |
214 | - 'options' => give_cmb2_get_post_options( array( |
|
214 | + 'options' => give_cmb2_get_post_options(array( |
|
215 | 215 | 'post_type' => 'page', |
216 | - 'numberposts' => - 1, |
|
217 | - ) ), |
|
216 | + 'numberposts' => -1, |
|
217 | + )), |
|
218 | 218 | ), |
219 | 219 | array( |
220 | - 'name' => __( 'Failed Donation Page', 'give' ), |
|
221 | - 'desc' => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ), |
|
220 | + 'name' => __('Failed Donation Page', 'give'), |
|
221 | + 'desc' => __('The page donors are sent to if their donation is cancelled or fails.', 'give'), |
|
222 | 222 | 'id' => 'failure_page', |
223 | 223 | 'type' => 'select', |
224 | - 'options' => give_cmb2_get_post_options( array( |
|
224 | + 'options' => give_cmb2_get_post_options(array( |
|
225 | 225 | 'post_type' => 'page', |
226 | - 'numberposts' => - 1, |
|
227 | - ) ), |
|
226 | + 'numberposts' => -1, |
|
227 | + )), |
|
228 | 228 | ), |
229 | 229 | array( |
230 | - 'name' => __( 'Donation History Page', 'give' ), |
|
230 | + 'name' => __('Donation History Page', 'give'), |
|
231 | 231 | /* translators: %s: [donation_history] */ |
232 | - 'desc' => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
232 | + 'desc' => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
233 | 233 | 'id' => 'history_page', |
234 | 234 | 'type' => 'select', |
235 | - 'options' => give_cmb2_get_post_options( array( |
|
235 | + 'options' => give_cmb2_get_post_options(array( |
|
236 | 236 | 'post_type' => 'page', |
237 | - 'numberposts' => - 1, |
|
238 | - ) ), |
|
237 | + 'numberposts' => -1, |
|
238 | + )), |
|
239 | 239 | ), |
240 | 240 | array( |
241 | - 'name' => __( 'Base Country', 'give' ), |
|
242 | - 'desc' => __( 'The country your site operates from.', 'give' ), |
|
241 | + 'name' => __('Base Country', 'give'), |
|
242 | + 'desc' => __('The country your site operates from.', 'give'), |
|
243 | 243 | 'id' => 'base_country', |
244 | 244 | 'type' => 'select', |
245 | 245 | 'options' => give_get_country_list(), |
246 | 246 | ), |
247 | 247 | array( |
248 | - 'name' => __( 'Currency Settings', 'give' ), |
|
248 | + 'name' => __('Currency Settings', 'give'), |
|
249 | 249 | 'desc' => '', |
250 | 250 | 'type' => 'give_title', |
251 | 251 | 'id' => 'give_title_general_settings_2', |
252 | 252 | ), |
253 | 253 | array( |
254 | - 'name' => __( 'Currency', 'give' ), |
|
255 | - 'desc' => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
254 | + 'name' => __('Currency', 'give'), |
|
255 | + 'desc' => __('The donation currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
256 | 256 | 'id' => 'currency', |
257 | 257 | 'type' => 'select', |
258 | 258 | 'options' => give_get_currencies(), |
259 | 259 | 'default' => 'USD', |
260 | 260 | ), |
261 | 261 | array( |
262 | - 'name' => __( 'Currency Position', 'give' ), |
|
263 | - 'desc' => __( 'The position of the currency symbol.', 'give' ), |
|
262 | + 'name' => __('Currency Position', 'give'), |
|
263 | + 'desc' => __('The position of the currency symbol.', 'give'), |
|
264 | 264 | 'id' => 'currency_position', |
265 | 265 | 'type' => 'select', |
266 | 266 | 'options' => array( |
267 | 267 | /* translators: %s: currency symbol */ |
268 | - 'before' => sprintf( __( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
268 | + 'before' => sprintf(__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())), |
|
269 | 269 | /* translators: %s: currency symbol */ |
270 | - 'after' => sprintf( __( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
270 | + 'after' => sprintf(__('After - 10%s', 'give'), give_currency_symbol(give_get_currency())), |
|
271 | 271 | ), |
272 | 272 | 'default' => 'before', |
273 | 273 | ), |
274 | 274 | array( |
275 | - 'name' => __( 'Thousands Separator', 'give' ), |
|
276 | - 'desc' => __( 'The symbol (usually , or .) to separate thousands.', 'give' ), |
|
275 | + 'name' => __('Thousands Separator', 'give'), |
|
276 | + 'desc' => __('The symbol (usually , or .) to separate thousands.', 'give'), |
|
277 | 277 | 'id' => 'thousands_separator', |
278 | 278 | 'type' => 'text_small', |
279 | 279 | 'sanitization_cb' => 'give_sanitize_thousand_separator', |
280 | 280 | 'default' => ',', |
281 | 281 | ), |
282 | 282 | array( |
283 | - 'name' => __( 'Decimal Separator', 'give' ), |
|
284 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
283 | + 'name' => __('Decimal Separator', 'give'), |
|
284 | + 'desc' => __('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
285 | 285 | 'id' => 'decimal_separator', |
286 | 286 | 'type' => 'text_small', |
287 | 287 | 'default' => '.', |
288 | 288 | ), |
289 | 289 | array( |
290 | - 'name' => __( 'Number of Decimals', 'give' ), |
|
291 | - 'desc' => __( 'The number of decimal points displayed in amounts.', 'give' ), |
|
290 | + 'name' => __('Number of Decimals', 'give'), |
|
291 | + 'desc' => __('The number of decimal points displayed in amounts.', 'give'), |
|
292 | 292 | 'id' => 'number_decimals', |
293 | 293 | 'type' => 'text_small', |
294 | 294 | 'default' => 2, |
@@ -302,83 +302,83 @@ discard block |
||
302 | 302 | */ |
303 | 303 | 'gateways' => array( |
304 | 304 | 'id' => 'payment_gateways', |
305 | - 'give_title' => __( 'Payment Gateways', 'give' ), |
|
306 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
307 | - 'fields' => apply_filters( 'give_settings_gateways', array( |
|
305 | + 'give_title' => __('Payment Gateways', 'give'), |
|
306 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
307 | + 'fields' => apply_filters('give_settings_gateways', array( |
|
308 | 308 | array( |
309 | - 'name' => __( 'Gateways Settings', 'give' ), |
|
309 | + 'name' => __('Gateways Settings', 'give'), |
|
310 | 310 | 'desc' => '', |
311 | 311 | 'id' => 'give_title_gateway_settings_1', |
312 | 312 | 'type' => 'give_title', |
313 | 313 | ), |
314 | 314 | array( |
315 | - 'name' => __( 'Test Mode', 'give' ), |
|
316 | - 'desc' => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
315 | + 'name' => __('Test Mode', 'give'), |
|
316 | + 'desc' => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
317 | 317 | 'id' => 'test_mode', |
318 | 318 | 'type' => 'checkbox', |
319 | 319 | ), |
320 | 320 | array( |
321 | - 'name' => __( 'Enabled Gateways', 'give' ), |
|
322 | - 'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ), |
|
321 | + 'name' => __('Enabled Gateways', 'give'), |
|
322 | + 'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'), |
|
323 | 323 | 'id' => 'gateways', |
324 | 324 | 'type' => 'enabled_gateways', |
325 | 325 | ), |
326 | 326 | array( |
327 | - 'name' => __( 'Default Gateway', 'give' ), |
|
328 | - 'desc' => __( 'The gateway that will be selected by default.', 'give' ), |
|
327 | + 'name' => __('Default Gateway', 'give'), |
|
328 | + 'desc' => __('The gateway that will be selected by default.', 'give'), |
|
329 | 329 | 'id' => 'default_gateway', |
330 | 330 | 'type' => 'default_gateway', |
331 | 331 | ), |
332 | 332 | array( |
333 | - 'name' => __( 'PayPal Standard', 'give' ), |
|
333 | + 'name' => __('PayPal Standard', 'give'), |
|
334 | 334 | 'desc' => '', |
335 | 335 | 'type' => 'give_title', |
336 | 336 | 'id' => 'give_title_gateway_settings_2', |
337 | 337 | ), |
338 | 338 | array( |
339 | - 'name' => __( 'PayPal Email', 'give' ), |
|
340 | - 'desc' => __( 'Enter your PayPal account\'s email.', 'give' ), |
|
339 | + 'name' => __('PayPal Email', 'give'), |
|
340 | + 'desc' => __('Enter your PayPal account\'s email.', 'give'), |
|
341 | 341 | 'id' => 'paypal_email', |
342 | 342 | 'type' => 'text_email', |
343 | 343 | ), |
344 | 344 | array( |
345 | - 'name' => __( 'PayPal Page Style', 'give' ), |
|
346 | - 'desc' => __( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ), |
|
345 | + 'name' => __('PayPal Page Style', 'give'), |
|
346 | + 'desc' => __('Enter the name of the page style to use, or leave blank to use the default.', 'give'), |
|
347 | 347 | 'id' => 'paypal_page_style', |
348 | 348 | 'type' => 'text', |
349 | 349 | ), |
350 | 350 | array( |
351 | - 'name' => __( 'PayPal Transaction Type', 'give' ), |
|
352 | - 'desc' => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
351 | + 'name' => __('PayPal Transaction Type', 'give'), |
|
352 | + 'desc' => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
353 | 353 | 'id' => 'paypal_button_type', |
354 | 354 | 'type' => 'radio_inline', |
355 | 355 | 'options' => array( |
356 | - 'donation' => __( 'Donation', 'give' ), |
|
357 | - 'standard' => __( 'Standard Transaction', 'give' ), |
|
356 | + 'donation' => __('Donation', 'give'), |
|
357 | + 'standard' => __('Standard Transaction', 'give'), |
|
358 | 358 | ), |
359 | 359 | 'default' => 'donation', |
360 | 360 | ), |
361 | 361 | array( |
362 | - 'name' => __( 'Disable PayPal IPN Verification', 'give' ), |
|
363 | - 'desc' => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ), |
|
362 | + 'name' => __('Disable PayPal IPN Verification', 'give'), |
|
363 | + 'desc' => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'), |
|
364 | 364 | 'id' => 'disable_paypal_verification', |
365 | 365 | 'type' => 'checkbox', |
366 | 366 | ), |
367 | 367 | array( |
368 | - 'name' => __( 'Offline Donations', 'give' ), |
|
368 | + 'name' => __('Offline Donations', 'give'), |
|
369 | 369 | 'desc' => '', |
370 | 370 | 'type' => 'give_title', |
371 | 371 | 'id' => 'give_title_gateway_settings_3', |
372 | 372 | ), |
373 | 373 | array( |
374 | - 'name' => __( 'Collect Billing Details', 'give' ), |
|
375 | - 'desc' => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ), |
|
374 | + 'name' => __('Collect Billing Details', 'give'), |
|
375 | + 'desc' => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'), |
|
376 | 376 | 'id' => 'give_offline_donation_enable_billing_fields', |
377 | 377 | 'type' => 'checkbox', |
378 | 378 | ), |
379 | 379 | array( |
380 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
381 | - 'desc' => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
380 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
381 | + 'desc' => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
382 | 382 | 'id' => 'global_offline_donation_content', |
383 | 383 | 'default' => give_get_default_offline_donation_content(), |
384 | 384 | 'type' => 'wysiwyg', |
@@ -387,15 +387,15 @@ discard block |
||
387 | 387 | ), |
388 | 388 | ), |
389 | 389 | array( |
390 | - 'name' => __( 'Offline Donation Email Instructions Subject', 'give' ), |
|
391 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
390 | + 'name' => __('Offline Donation Email Instructions Subject', 'give'), |
|
391 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
392 | 392 | 'id' => 'offline_donation_subject', |
393 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
393 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
394 | 394 | 'type' => 'text', |
395 | 395 | ), |
396 | 396 | array( |
397 | - 'name' => __( 'Offline Donation Email Instructions', 'give' ), |
|
398 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
397 | + 'name' => __('Offline Donation Email Instructions', 'give'), |
|
398 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
399 | 399 | 'id' => 'global_offline_donation_email', |
400 | 400 | 'default' => give_get_default_offline_donation_email_content(), |
401 | 401 | 'type' => 'wysiwyg', |
@@ -409,104 +409,104 @@ discard block |
||
409 | 409 | /** Display Settings */ |
410 | 410 | 'display' => array( |
411 | 411 | 'id' => 'display_settings', |
412 | - 'give_title' => __( 'Display Settings', 'give' ), |
|
413 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
414 | - 'fields' => apply_filters( 'give_settings_display', array( |
|
412 | + 'give_title' => __('Display Settings', 'give'), |
|
413 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
414 | + 'fields' => apply_filters('give_settings_display', array( |
|
415 | 415 | array( |
416 | - 'name' => __( 'Display Settings', 'give' ), |
|
416 | + 'name' => __('Display Settings', 'give'), |
|
417 | 417 | 'desc' => '', |
418 | 418 | 'id' => 'give_title_display_settings_1', |
419 | 419 | 'type' => 'give_title', |
420 | 420 | ), |
421 | 421 | array( |
422 | - 'name' => __( 'Disable CSS', 'give' ), |
|
423 | - 'desc' => __( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ), |
|
422 | + 'name' => __('Disable CSS', 'give'), |
|
423 | + 'desc' => __('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'), |
|
424 | 424 | 'id' => 'disable_css', |
425 | 425 | 'type' => 'checkbox', |
426 | 426 | ), |
427 | 427 | array( |
428 | - 'name' => __( 'Enable Floating Labels', 'give' ), |
|
428 | + 'name' => __('Enable Floating Labels', 'give'), |
|
429 | 429 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
430 | - 'desc' => sprintf( wp_kses( __( 'Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( |
|
430 | + 'desc' => sprintf(wp_kses(__('Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array( |
|
431 | 431 | 'a' => array( |
432 | 432 | 'href' => array(), |
433 | 433 | 'target' => array(), |
434 | 434 | ), |
435 | - ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
435 | + )), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
436 | 436 | 'id' => 'floatlabels', |
437 | 437 | 'type' => 'checkbox', |
438 | 438 | ), |
439 | 439 | array( |
440 | - 'name' => __( 'Disable Welcome Screen', 'give' ), |
|
440 | + 'name' => __('Disable Welcome Screen', 'give'), |
|
441 | 441 | /* translators: %s: about page URL */ |
442 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give' ), array( |
|
442 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give'), array( |
|
443 | 443 | 'a' => array( |
444 | 444 | 'href' => array(), |
445 | 445 | 'target' => array(), |
446 | 446 | ), |
447 | - ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
447 | + )), esc_url(admin_url('index.php?page=give-about'))), |
|
448 | 448 | 'id' => 'disable_welcome', |
449 | 449 | 'type' => 'checkbox', |
450 | 450 | ), |
451 | 451 | array( |
452 | - 'name' => __( 'Post Types', 'give' ), |
|
452 | + 'name' => __('Post Types', 'give'), |
|
453 | 453 | 'desc' => '', |
454 | 454 | 'id' => 'give_title_display_settings_2', |
455 | 455 | 'type' => 'give_title', |
456 | 456 | ), |
457 | 457 | array( |
458 | - 'name' => __( 'Disable Form Single Views', 'give' ), |
|
459 | - 'desc' => __( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
458 | + 'name' => __('Disable Form Single Views', 'give'), |
|
459 | + 'desc' => __('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
460 | 460 | 'id' => 'disable_forms_singular', |
461 | 461 | 'type' => 'checkbox', |
462 | 462 | ), |
463 | 463 | array( |
464 | - 'name' => __( 'Disable Form Archives', 'give' ), |
|
465 | - 'desc' => __( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ), |
|
464 | + 'name' => __('Disable Form Archives', 'give'), |
|
465 | + 'desc' => __('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'), |
|
466 | 466 | 'id' => 'disable_forms_archives', |
467 | 467 | 'type' => 'checkbox', |
468 | 468 | ), |
469 | 469 | array( |
470 | - 'name' => __( 'Disable Form Excerpts', 'give' ), |
|
471 | - 'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
470 | + 'name' => __('Disable Form Excerpts', 'give'), |
|
471 | + 'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
472 | 472 | 'id' => 'disable_forms_excerpt', |
473 | 473 | 'type' => 'checkbox', |
474 | 474 | ), |
475 | 475 | array( |
476 | - 'name' => __( 'Featured Image Size', 'give' ), |
|
477 | - 'desc' => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ), |
|
476 | + 'name' => __('Featured Image Size', 'give'), |
|
477 | + 'desc' => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'), |
|
478 | 478 | 'id' => 'featured_image_size', |
479 | 479 | 'type' => 'select', |
480 | 480 | 'default' => 'large', |
481 | 481 | 'options' => give_get_featured_image_sizes(), |
482 | 482 | ), |
483 | 483 | array( |
484 | - 'name' => __( 'Disable Form Featured Image', 'give' ), |
|
485 | - 'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
484 | + 'name' => __('Disable Form Featured Image', 'give'), |
|
485 | + 'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
486 | 486 | 'id' => 'disable_form_featured_img', |
487 | 487 | 'type' => 'checkbox', |
488 | 488 | ), |
489 | 489 | array( |
490 | - 'name' => __( 'Disable Single Form Sidebar', 'give' ), |
|
491 | - 'desc' => __( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
490 | + 'name' => __('Disable Single Form Sidebar', 'give'), |
|
491 | + 'desc' => __('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
492 | 492 | 'id' => 'disable_form_sidebar', |
493 | 493 | 'type' => 'checkbox', |
494 | 494 | ), |
495 | 495 | array( |
496 | - 'name' => __( 'Taxonomies', 'give' ), |
|
496 | + 'name' => __('Taxonomies', 'give'), |
|
497 | 497 | 'desc' => '', |
498 | 498 | 'id' => 'give_title_display_settings_3', |
499 | 499 | 'type' => 'give_title', |
500 | 500 | ), |
501 | 501 | array( |
502 | - 'name' => __( 'Enable Form Categories', 'give' ), |
|
503 | - 'desc' => __( 'Enables the "Category" taxonomy for all Give forms.', 'give' ), |
|
502 | + 'name' => __('Enable Form Categories', 'give'), |
|
503 | + 'desc' => __('Enables the "Category" taxonomy for all Give forms.', 'give'), |
|
504 | 504 | 'id' => 'categories', |
505 | 505 | 'type' => 'checkbox', |
506 | 506 | ), |
507 | 507 | array( |
508 | - 'name' => __( 'Enable Form Tags', 'give' ), |
|
509 | - 'desc' => __( 'Enables the "Tag" taxonomy for all Give forms.', 'give' ), |
|
508 | + 'name' => __('Enable Form Tags', 'give'), |
|
509 | + 'desc' => __('Enables the "Tag" taxonomy for all Give forms.', 'give'), |
|
510 | 510 | 'id' => 'tags', |
511 | 511 | 'type' => 'checkbox', |
512 | 512 | ), |
@@ -519,101 +519,101 @@ discard block |
||
519 | 519 | */ |
520 | 520 | 'emails' => array( |
521 | 521 | 'id' => 'email_settings', |
522 | - 'give_title' => __( 'Email Settings', 'give' ), |
|
523 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
524 | - 'fields' => apply_filters( 'give_settings_emails', array( |
|
522 | + 'give_title' => __('Email Settings', 'give'), |
|
523 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
524 | + 'fields' => apply_filters('give_settings_emails', array( |
|
525 | 525 | array( |
526 | - 'name' => __( 'Email Settings', 'give' ), |
|
526 | + 'name' => __('Email Settings', 'give'), |
|
527 | 527 | 'desc' => '', |
528 | 528 | 'id' => 'give_title_email_settings_1', |
529 | 529 | 'type' => 'give_title', |
530 | 530 | ), |
531 | 531 | array( |
532 | 532 | 'id' => 'email_template', |
533 | - 'name' => __( 'Email Template', 'give' ), |
|
534 | - 'desc' => __( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ), |
|
533 | + 'name' => __('Email Template', 'give'), |
|
534 | + 'desc' => __('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'), |
|
535 | 535 | 'type' => 'select', |
536 | 536 | 'options' => give_get_email_templates(), |
537 | 537 | ), |
538 | 538 | array( |
539 | 539 | 'id' => 'email_logo', |
540 | - 'name' => __( 'Logo', 'give' ), |
|
541 | - 'desc' => __( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
540 | + 'name' => __('Logo', 'give'), |
|
541 | + 'desc' => __('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
542 | 542 | 'type' => 'file', |
543 | 543 | ), |
544 | 544 | array( |
545 | 545 | 'id' => 'from_name', |
546 | - 'name' => __( 'From Name', 'give' ), |
|
547 | - 'desc' => __( 'The name that appears in the "From" field in donation receipt emails.', 'give' ), |
|
548 | - 'default' => get_bloginfo( 'name' ), |
|
546 | + 'name' => __('From Name', 'give'), |
|
547 | + 'desc' => __('The name that appears in the "From" field in donation receipt emails.', 'give'), |
|
548 | + 'default' => get_bloginfo('name'), |
|
549 | 549 | 'type' => 'text', |
550 | 550 | ), |
551 | 551 | array( |
552 | 552 | 'id' => 'from_email', |
553 | - 'name' => __( 'From Email', 'give' ), |
|
554 | - 'desc' => __( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ), |
|
555 | - 'default' => get_bloginfo( 'admin_email' ), |
|
553 | + 'name' => __('From Email', 'give'), |
|
554 | + 'desc' => __('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'), |
|
555 | + 'default' => get_bloginfo('admin_email'), |
|
556 | 556 | 'type' => 'text', |
557 | 557 | ), |
558 | 558 | array( |
559 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
559 | + 'name' => __('Donation Receipt', 'give'), |
|
560 | 560 | 'desc' => '', |
561 | 561 | 'id' => 'give_title_email_settings_2', |
562 | 562 | 'type' => 'give_title', |
563 | 563 | ), |
564 | 564 | array( |
565 | 565 | 'id' => 'donation_subject', |
566 | - 'name' => __( 'Donation Email Subject', 'give' ), |
|
567 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
568 | - 'default' => esc_attr__( 'Donation Receipt', 'give' ), |
|
566 | + 'name' => __('Donation Email Subject', 'give'), |
|
567 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
568 | + 'default' => esc_attr__('Donation Receipt', 'give'), |
|
569 | 569 | 'type' => 'text', |
570 | 570 | ), |
571 | 571 | array( |
572 | 572 | 'id' => 'donation_receipt', |
573 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
573 | + 'name' => __('Donation Receipt', 'give'), |
|
574 | 574 | 'desc' => sprintf( |
575 | 575 | /* translators: %s: emails tags list */ |
576 | - __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ), |
|
577 | - '<br/>' . give_get_emails_tags_list() |
|
576 | + __('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'), |
|
577 | + '<br/>'.give_get_emails_tags_list() |
|
578 | 578 | ), |
579 | 579 | 'type' => 'wysiwyg', |
580 | 580 | 'default' => give_get_default_donation_receipt_email(), |
581 | 581 | ), |
582 | 582 | array( |
583 | - 'name' => __( 'New Donation Notification', 'give' ), |
|
583 | + 'name' => __('New Donation Notification', 'give'), |
|
584 | 584 | 'desc' => '', |
585 | 585 | 'id' => 'give_title_email_settings_3', |
586 | 586 | 'type' => 'give_title', |
587 | 587 | ), |
588 | 588 | array( |
589 | 589 | 'id' => 'donation_notification_subject', |
590 | - 'name' => __( 'Donation Notification Subject', 'give' ), |
|
591 | - 'desc' => __( 'Enter the subject line for the donation notification email.', 'give' ), |
|
590 | + 'name' => __('Donation Notification Subject', 'give'), |
|
591 | + 'desc' => __('Enter the subject line for the donation notification email.', 'give'), |
|
592 | 592 | 'type' => 'text', |
593 | - 'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ), |
|
593 | + 'default' => esc_attr__('New Donation - #{payment_id}', 'give'), |
|
594 | 594 | ), |
595 | 595 | array( |
596 | 596 | 'id' => 'donation_notification', |
597 | - 'name' => __( 'Donation Notification', 'give' ), |
|
597 | + 'name' => __('Donation Notification', 'give'), |
|
598 | 598 | 'desc' => sprintf( |
599 | 599 | /* translators: %s: emails tags list */ |
600 | - __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ), |
|
601 | - '<br/>' . give_get_emails_tags_list() |
|
600 | + __('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'), |
|
601 | + '<br/>'.give_get_emails_tags_list() |
|
602 | 602 | ), |
603 | 603 | 'type' => 'wysiwyg', |
604 | 604 | 'default' => give_get_default_donation_notification_email(), |
605 | 605 | ), |
606 | 606 | array( |
607 | 607 | 'id' => 'admin_notice_emails', |
608 | - 'name' => __( 'Donation Notification Emails', 'give' ), |
|
609 | - 'desc' => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ), |
|
608 | + 'name' => __('Donation Notification Emails', 'give'), |
|
609 | + 'desc' => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'), |
|
610 | 610 | 'type' => 'textarea', |
611 | - 'default' => get_bloginfo( 'admin_email' ), |
|
611 | + 'default' => get_bloginfo('admin_email'), |
|
612 | 612 | ), |
613 | 613 | array( |
614 | 614 | 'id' => 'disable_admin_notices', |
615 | - 'name' => __( 'Disable Admin Notifications', 'give' ), |
|
616 | - 'desc' => __( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ), |
|
615 | + 'name' => __('Disable Admin Notifications', 'give'), |
|
616 | + 'desc' => __('Check this box if you do not want to receive emails when new donations are made.', 'give'), |
|
617 | 617 | 'type' => 'checkbox', |
618 | 618 | ), |
619 | 619 | ) |
@@ -622,99 +622,99 @@ discard block |
||
622 | 622 | /** Extension Settings */ |
623 | 623 | 'addons' => array( |
624 | 624 | 'id' => 'addons', |
625 | - 'give_title' => __( 'Give Add-ons Settings', 'give' ), |
|
626 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
627 | - 'fields' => apply_filters( 'give_settings_addons', array() |
|
625 | + 'give_title' => __('Give Add-ons Settings', 'give'), |
|
626 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
627 | + 'fields' => apply_filters('give_settings_addons', array() |
|
628 | 628 | ), |
629 | 629 | ), |
630 | 630 | /** Licenses Settings */ |
631 | 631 | 'licenses' => array( |
632 | 632 | 'id' => 'licenses', |
633 | - 'give_title' => __( 'Give Licenses', 'give' ), |
|
634 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
635 | - 'fields' => apply_filters( 'give_settings_licenses', array() |
|
633 | + 'give_title' => __('Give Licenses', 'give'), |
|
634 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
635 | + 'fields' => apply_filters('give_settings_licenses', array() |
|
636 | 636 | ), |
637 | 637 | ), |
638 | 638 | /** Advanced Options */ |
639 | 639 | 'advanced' => array( |
640 | 640 | 'id' => 'advanced_options', |
641 | - 'give_title' => __( 'Advanced Options', 'give' ), |
|
642 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
643 | - 'fields' => apply_filters( 'give_settings_advanced', array( |
|
641 | + 'give_title' => __('Advanced Options', 'give'), |
|
642 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
643 | + 'fields' => apply_filters('give_settings_advanced', array( |
|
644 | 644 | array( |
645 | - 'name' => __( 'Access Control', 'give' ), |
|
645 | + 'name' => __('Access Control', 'give'), |
|
646 | 646 | 'desc' => '', |
647 | 647 | 'id' => 'give_title_session_control_1', |
648 | 648 | 'type' => 'give_title', |
649 | 649 | ), |
650 | 650 | array( |
651 | 651 | 'id' => 'session_lifetime', |
652 | - 'name' => __( 'Session Lifetime', 'give' ), |
|
653 | - 'desc' => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ), |
|
652 | + 'name' => __('Session Lifetime', 'give'), |
|
653 | + 'desc' => __('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'), |
|
654 | 654 | 'type' => 'select', |
655 | 655 | 'options' => array( |
656 | - '86400' => __( '24 Hours', 'give' ), |
|
657 | - '172800' => __( '48 Hours', 'give' ), |
|
658 | - '259200' => __( '72 Hours', 'give' ), |
|
659 | - '604800' => __( '1 Week', 'give' ), |
|
656 | + '86400' => __('24 Hours', 'give'), |
|
657 | + '172800' => __('48 Hours', 'give'), |
|
658 | + '259200' => __('72 Hours', 'give'), |
|
659 | + '604800' => __('1 Week', 'give'), |
|
660 | 660 | ), |
661 | 661 | ), |
662 | 662 | array( |
663 | - 'name' => __( 'Email Access', 'give' ), |
|
664 | - 'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
663 | + 'name' => __('Email Access', 'give'), |
|
664 | + 'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
665 | 665 | 'id' => 'email_access', |
666 | 666 | 'type' => 'checkbox', |
667 | 667 | ), |
668 | 668 | array( |
669 | 669 | 'id' => 'recaptcha_key', |
670 | - 'name' => __( 'reCAPTCHA Site Key', 'give' ), |
|
670 | + 'name' => __('reCAPTCHA Site Key', 'give'), |
|
671 | 671 | /* translators: %s: https://www.google.com/recaptcha/ */ |
672 | - 'desc' => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ), |
|
672 | + 'desc' => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')), |
|
673 | 673 | 'default' => '', |
674 | 674 | 'type' => 'text', |
675 | 675 | ), |
676 | 676 | array( |
677 | 677 | 'id' => 'recaptcha_secret', |
678 | - 'name' => __( 'reCAPTCHA Secret Key', 'give' ), |
|
679 | - 'desc' => __( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ), |
|
678 | + 'name' => __('reCAPTCHA Secret Key', 'give'), |
|
679 | + 'desc' => __('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'), |
|
680 | 680 | 'default' => '', |
681 | 681 | 'type' => 'text', |
682 | 682 | ), |
683 | 683 | array( |
684 | - 'name' => __( 'Data Control', 'give' ), |
|
684 | + 'name' => __('Data Control', 'give'), |
|
685 | 685 | 'desc' => '', |
686 | 686 | 'id' => 'give_title_data_control_2', |
687 | 687 | 'type' => 'give_title', |
688 | 688 | ), |
689 | 689 | array( |
690 | - 'name' => __( 'Remove All Data on Uninstall?', 'give' ), |
|
691 | - 'desc' => __( 'When the plugin is deleted, completely remove all Give data.', 'give' ), |
|
690 | + 'name' => __('Remove All Data on Uninstall?', 'give'), |
|
691 | + 'desc' => __('When the plugin is deleted, completely remove all Give data.', 'give'), |
|
692 | 692 | 'id' => 'uninstall_on_delete', |
693 | 693 | 'type' => 'checkbox', |
694 | 694 | ), |
695 | 695 | array( |
696 | - 'name' => __( 'Filter Control', 'give' ), |
|
696 | + 'name' => __('Filter Control', 'give'), |
|
697 | 697 | 'desc' => '', |
698 | 698 | 'id' => 'give_title_filter_control', |
699 | 699 | 'type' => 'give_title', |
700 | 700 | ), |
701 | 701 | array( |
702 | 702 | /* translators: %s: the_content */ |
703 | - 'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ), |
|
703 | + 'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'), |
|
704 | 704 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
705 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
705 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
706 | 706 | 'id' => 'disable_the_content_filter', |
707 | 707 | 'type' => 'checkbox', |
708 | 708 | ), |
709 | 709 | array( |
710 | - 'name' => __( 'Script Loading', 'give' ), |
|
710 | + 'name' => __('Script Loading', 'give'), |
|
711 | 711 | 'desc' => '', |
712 | 712 | 'id' => 'give_title_script_control', |
713 | 713 | 'type' => 'give_title', |
714 | 714 | ), |
715 | 715 | array( |
716 | - 'name' => __( 'Load Scripts in Footer?', 'give' ), |
|
717 | - 'desc' => __( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ), |
|
716 | + 'name' => __('Load Scripts in Footer?', 'give'), |
|
717 | + 'desc' => __('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'), |
|
718 | 718 | 'id' => 'scripts_footer', |
719 | 719 | 'type' => 'checkbox', |
720 | 720 | ), |
@@ -724,13 +724,13 @@ discard block |
||
724 | 724 | /** API Settings */ |
725 | 725 | 'api' => array( |
726 | 726 | 'id' => 'api', |
727 | - 'give_title' => __( 'API', 'give' ), |
|
728 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
727 | + 'give_title' => __('API', 'give'), |
|
728 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
729 | 729 | 'show_names' => false, // Hide field names on the left |
730 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
730 | + 'fields' => apply_filters('give_settings_system', array( |
|
731 | 731 | array( |
732 | 732 | 'id' => 'api', |
733 | - 'name' => __( 'API', 'give' ), |
|
733 | + 'name' => __('API', 'give'), |
|
734 | 734 | 'type' => 'api', |
735 | 735 | ), |
736 | 736 | ) |
@@ -739,13 +739,13 @@ discard block |
||
739 | 739 | /** Licenses Settings */ |
740 | 740 | 'system_info' => array( |
741 | 741 | 'id' => 'system_info', |
742 | - 'give_title' => __( 'System Info', 'give' ), |
|
743 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
744 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
742 | + 'give_title' => __('System Info', 'give'), |
|
743 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
744 | + 'fields' => apply_filters('give_settings_system', array( |
|
745 | 745 | array( |
746 | 746 | 'id' => 'system-info-textarea', |
747 | - 'name' => __( 'System Info', 'give' ), |
|
748 | - 'desc' => __( 'Please copy and paste this information in your ticket when contacting support.', 'give' ), |
|
747 | + 'name' => __('System Info', 'give'), |
|
748 | + 'desc' => __('Please copy and paste this information in your ticket when contacting support.', 'give'), |
|
749 | 749 | 'type' => 'system_info', |
750 | 750 | ), |
751 | 751 | ) |
@@ -753,15 +753,15 @@ discard block |
||
753 | 753 | ), |
754 | 754 | ); |
755 | 755 | |
756 | - $give_settings = apply_filters( 'give_registered_settings', $give_settings ); |
|
756 | + $give_settings = apply_filters('give_registered_settings', $give_settings); |
|
757 | 757 | |
758 | 758 | // Return all settings array if no active tab |
759 | - if ( empty( $active_tab ) || ! isset( $give_settings[ $active_tab ] ) ) { |
|
759 | + if (empty($active_tab) || ! isset($give_settings[$active_tab])) { |
|
760 | 760 | return $give_settings; |
761 | 761 | } |
762 | 762 | |
763 | 763 | // Add other tabs and settings fields as needed |
764 | - return $give_settings[ $active_tab ]; |
|
764 | + return $give_settings[$active_tab]; |
|
765 | 765 | |
766 | 766 | } |
767 | 767 | |
@@ -770,11 +770,11 @@ discard block |
||
770 | 770 | */ |
771 | 771 | public function settings_notices() { |
772 | 772 | |
773 | - if ( ! isset( $_POST['give_settings_saved'] ) ) { |
|
773 | + if ( ! isset($_POST['give_settings_saved'])) { |
|
774 | 774 | return; |
775 | 775 | } |
776 | 776 | |
777 | - add_settings_error( 'give-notices', 'global-settings-updated', __( 'Settings updated.', 'give' ), 'updated' ); |
|
777 | + add_settings_error('give-notices', 'global-settings-updated', __('Settings updated.', 'give'), 'updated'); |
|
778 | 778 | |
779 | 779 | } |
780 | 780 | |
@@ -789,14 +789,14 @@ discard block |
||
789 | 789 | * @return mixed Field value or exception is thrown. |
790 | 790 | * @throws Exception Throws an exception if the field is invalid. |
791 | 791 | */ |
792 | - public function __get( $field ) { |
|
792 | + public function __get($field) { |
|
793 | 793 | |
794 | 794 | // Allowed fields to retrieve |
795 | - if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) { |
|
795 | + if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) { |
|
796 | 796 | return $this->{$field}; |
797 | 797 | } |
798 | 798 | |
799 | - throw new Exception( sprintf( __( 'Invalid property: %s', 'give' ), $field ) ); |
|
799 | + throw new Exception(sprintf(__('Invalid property: %s', 'give'), $field)); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | |
@@ -815,12 +815,12 @@ discard block |
||
815 | 815 | * |
816 | 816 | * @return mixed Option value |
817 | 817 | */ |
818 | -function give_get_option( $key = '', $default = false ) { |
|
818 | +function give_get_option($key = '', $default = false) { |
|
819 | 819 | $give_options = give_get_settings(); |
820 | - $value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default; |
|
821 | - $value = apply_filters( 'give_get_option', $value, $key, $default ); |
|
820 | + $value = ! empty($give_options[$key]) ? $give_options[$key] : $default; |
|
821 | + $value = apply_filters('give_get_option', $value, $key, $default); |
|
822 | 822 | |
823 | - return apply_filters( "give_get_option_{$key}", $value, $key, $default ); |
|
823 | + return apply_filters("give_get_option_{$key}", $value, $key, $default); |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | |
@@ -838,33 +838,33 @@ discard block |
||
838 | 838 | * |
839 | 839 | * @return boolean True if updated, false if not. |
840 | 840 | */ |
841 | -function give_update_option( $key = '', $value = false ) { |
|
841 | +function give_update_option($key = '', $value = false) { |
|
842 | 842 | |
843 | 843 | // If no key, exit |
844 | - if ( empty( $key ) ) { |
|
844 | + if (empty($key)) { |
|
845 | 845 | return false; |
846 | 846 | } |
847 | 847 | |
848 | - if ( empty( $value ) ) { |
|
849 | - $remove_option = give_delete_option( $key ); |
|
848 | + if (empty($value)) { |
|
849 | + $remove_option = give_delete_option($key); |
|
850 | 850 | |
851 | 851 | return $remove_option; |
852 | 852 | } |
853 | 853 | |
854 | 854 | // First let's grab the current settings |
855 | - $options = get_option( 'give_settings' ); |
|
855 | + $options = get_option('give_settings'); |
|
856 | 856 | |
857 | 857 | // Let's let devs alter that value coming in |
858 | - $value = apply_filters( 'give_update_option', $value, $key ); |
|
858 | + $value = apply_filters('give_update_option', $value, $key); |
|
859 | 859 | |
860 | 860 | // Next let's try to update the value |
861 | - $options[ $key ] = $value; |
|
862 | - $did_update = update_option( 'give_settings', $options ); |
|
861 | + $options[$key] = $value; |
|
862 | + $did_update = update_option('give_settings', $options); |
|
863 | 863 | |
864 | 864 | // If it updated, let's update the global variable |
865 | - if ( $did_update ) { |
|
865 | + if ($did_update) { |
|
866 | 866 | global $give_options; |
867 | - $give_options[ $key ] = $value; |
|
867 | + $give_options[$key] = $value; |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | return $did_update; |
@@ -883,25 +883,25 @@ discard block |
||
883 | 883 | * |
884 | 884 | * @return boolean True if updated, false if not. |
885 | 885 | */ |
886 | -function give_delete_option( $key = '' ) { |
|
886 | +function give_delete_option($key = '') { |
|
887 | 887 | |
888 | 888 | // If no key, exit |
889 | - if ( empty( $key ) ) { |
|
889 | + if (empty($key)) { |
|
890 | 890 | return false; |
891 | 891 | } |
892 | 892 | |
893 | 893 | // First let's grab the current settings |
894 | - $options = get_option( 'give_settings' ); |
|
894 | + $options = get_option('give_settings'); |
|
895 | 895 | |
896 | 896 | // Next let's try to update the value |
897 | - if ( isset( $options[ $key ] ) ) { |
|
898 | - unset( $options[ $key ] ); |
|
897 | + if (isset($options[$key])) { |
|
898 | + unset($options[$key]); |
|
899 | 899 | } |
900 | 900 | |
901 | - $did_update = update_option( 'give_settings', $options ); |
|
901 | + $did_update = update_option('give_settings', $options); |
|
902 | 902 | |
903 | 903 | // If it updated, let's update the global variable |
904 | - if ( $did_update ) { |
|
904 | + if ($did_update) { |
|
905 | 905 | global $give_options; |
906 | 906 | $give_options = $options; |
907 | 907 | } |
@@ -920,9 +920,9 @@ discard block |
||
920 | 920 | */ |
921 | 921 | function give_get_settings() { |
922 | 922 | |
923 | - $settings = get_option( 'give_settings' ); |
|
923 | + $settings = get_option('give_settings'); |
|
924 | 924 | |
925 | - return (array) apply_filters( 'give_get_settings', $settings ); |
|
925 | + return (array) apply_filters('give_get_settings', $settings); |
|
926 | 926 | |
927 | 927 | } |
928 | 928 | |
@@ -940,25 +940,25 @@ discard block |
||
940 | 940 | * |
941 | 941 | * @return array |
942 | 942 | */ |
943 | -function give_settings_array_insert( $array, $position, $insert ) { |
|
944 | - if ( is_int( $position ) ) { |
|
945 | - array_splice( $array, $position, 0, $insert ); |
|
943 | +function give_settings_array_insert($array, $position, $insert) { |
|
944 | + if (is_int($position)) { |
|
945 | + array_splice($array, $position, 0, $insert); |
|
946 | 946 | } else { |
947 | 947 | |
948 | - foreach ( $array as $index => $subarray ) { |
|
949 | - if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) { |
|
948 | + foreach ($array as $index => $subarray) { |
|
949 | + if (isset($subarray['id']) && $subarray['id'] == $position) { |
|
950 | 950 | $pos = $index; |
951 | 951 | } |
952 | 952 | } |
953 | 953 | |
954 | - if ( ! isset( $pos ) ) { |
|
954 | + if ( ! isset($pos)) { |
|
955 | 955 | return $array; |
956 | 956 | } |
957 | 957 | |
958 | 958 | $array = array_merge( |
959 | - array_slice( $array, 0, $pos ), |
|
959 | + array_slice($array, 0, $pos), |
|
960 | 960 | $insert, |
961 | - array_slice( $array, $pos ) |
|
961 | + array_slice($array, $pos) |
|
962 | 962 | ); |
963 | 963 | } |
964 | 964 | |
@@ -978,23 +978,23 @@ discard block |
||
978 | 978 | * |
979 | 979 | * @return void |
980 | 980 | */ |
981 | -function give_enabled_gateways_callback( $field_arr, $saved_values = array() ) { |
|
981 | +function give_enabled_gateways_callback($field_arr, $saved_values = array()) { |
|
982 | 982 | |
983 | 983 | $id = $field_arr['id']; |
984 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
984 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
985 | 985 | |
986 | 986 | echo '<ul class="give-checklist-fields give-payment-gatways-list">'; |
987 | 987 | |
988 | - foreach ( $gateways as $key => $option ) : |
|
988 | + foreach ($gateways as $key => $option) : |
|
989 | 989 | |
990 | - if ( is_array( $saved_values ) && array_key_exists( $key, $saved_values ) ) { |
|
990 | + if (is_array($saved_values) && array_key_exists($key, $saved_values)) { |
|
991 | 991 | $enabled = '1'; |
992 | 992 | } else { |
993 | 993 | $enabled = null; |
994 | 994 | } |
995 | 995 | |
996 | - echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/> '; |
|
997 | - echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>'; |
|
996 | + echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/> '; |
|
997 | + echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>'; |
|
998 | 998 | |
999 | 999 | endforeach; |
1000 | 1000 | |
@@ -1013,16 +1013,16 @@ discard block |
||
1013 | 1013 | * |
1014 | 1014 | * @return void |
1015 | 1015 | */ |
1016 | -function give_default_gateway_callback( $field_arr, $saved_value ) { |
|
1016 | +function give_default_gateway_callback($field_arr, $saved_value) { |
|
1017 | 1017 | $id = $field_arr['id']; |
1018 | 1018 | $gateways = give_get_enabled_payment_gateways(); |
1019 | - $saved_value = give_get_default_gateway( null ); |
|
1019 | + $saved_value = give_get_default_gateway(null); |
|
1020 | 1020 | |
1021 | - echo '<select class="give-select" name="' . $id . '" id="' . $id . '">'; |
|
1021 | + echo '<select class="give-select" name="'.$id.'" id="'.$id.'">'; |
|
1022 | 1022 | |
1023 | - foreach ( $gateways as $key => $option ) : |
|
1024 | - $selected = isset( $saved_value ) ? selected( $key, $saved_value, false ) : ''; |
|
1025 | - echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
1023 | + foreach ($gateways as $key => $option) : |
|
1024 | + $selected = isset($saved_value) ? selected($key, $saved_value, false) : ''; |
|
1025 | + echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>'; |
|
1026 | 1026 | endforeach; |
1027 | 1027 | |
1028 | 1028 | echo '</select>'; |
@@ -1040,13 +1040,13 @@ discard block |
||
1040 | 1040 | * |
1041 | 1041 | * @return void |
1042 | 1042 | */ |
1043 | -function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1043 | +function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1044 | 1044 | |
1045 | 1045 | $id = $field_type_object->field->args['id']; |
1046 | 1046 | $title = $field_type_object->field->args['name']; |
1047 | 1047 | $field_description = $field_type_object->field->args['desc']; |
1048 | 1048 | |
1049 | - echo '<hr>' . $field_description; |
|
1049 | + echo '<hr>'.$field_description; |
|
1050 | 1050 | |
1051 | 1051 | } |
1052 | 1052 | |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | * |
1062 | 1062 | * @return void |
1063 | 1063 | */ |
1064 | -function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1064 | +function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1065 | 1065 | |
1066 | 1066 | $id = $field_type_object->field->args['id']; |
1067 | 1067 | $title = $field_type_object->field->args['name']; |
@@ -1080,25 +1080,25 @@ discard block |
||
1080 | 1080 | * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types |
1081 | 1081 | * @return array An array of options that matches the CMB2 options array |
1082 | 1082 | */ |
1083 | -function give_cmb2_get_post_options( $query_args, $force = false ) { |
|
1083 | +function give_cmb2_get_post_options($query_args, $force = false) { |
|
1084 | 1084 | |
1085 | - $post_options = array( '' => '' ); // Blank option |
|
1085 | + $post_options = array('' => ''); // Blank option |
|
1086 | 1086 | |
1087 | - if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) { |
|
1087 | + if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) { |
|
1088 | 1088 | return $post_options; |
1089 | 1089 | } |
1090 | 1090 | |
1091 | - $args = wp_parse_args( $query_args, array( |
|
1091 | + $args = wp_parse_args($query_args, array( |
|
1092 | 1092 | 'post_type' => 'page', |
1093 | 1093 | 'numberposts' => 10, |
1094 | - ) ); |
|
1094 | + )); |
|
1095 | 1095 | |
1096 | - $posts = get_posts( $args ); |
|
1096 | + $posts = get_posts($args); |
|
1097 | 1097 | |
1098 | - if ( $posts ) { |
|
1099 | - foreach ( $posts as $post ) { |
|
1098 | + if ($posts) { |
|
1099 | + foreach ($posts as $post) { |
|
1100 | 1100 | |
1101 | - $post_options[ $post->ID ] = $post->post_title; |
|
1101 | + $post_options[$post->ID] = $post->post_title; |
|
1102 | 1102 | |
1103 | 1103 | } |
1104 | 1104 | } |
@@ -1123,33 +1123,33 @@ discard block |
||
1123 | 1123 | |
1124 | 1124 | $sizes = array(); |
1125 | 1125 | $get_sizes = get_intermediate_image_sizes(); |
1126 | - $core_image_sizes = array( 'thumbnail', 'medium', 'medium_large', 'large' ); |
|
1126 | + $core_image_sizes = array('thumbnail', 'medium', 'medium_large', 'large'); |
|
1127 | 1127 | |
1128 | 1128 | |
1129 | 1129 | // This will help us to filter special characters from a string |
1130 | - $filter_slug_items = array( '_', '-' ); |
|
1130 | + $filter_slug_items = array('_', '-'); |
|
1131 | 1131 | |
1132 | - foreach ( $get_sizes as $_size ) { |
|
1132 | + foreach ($get_sizes as $_size) { |
|
1133 | 1133 | |
1134 | 1134 | // Converting image size slug to title case |
1135 | - $sizes[ $_size ] = give_slug_to_title( $_size, $filter_slug_items ); |
|
1135 | + $sizes[$_size] = give_slug_to_title($_size, $filter_slug_items); |
|
1136 | 1136 | |
1137 | - if ( in_array( $_size, $core_image_sizes ) ) { |
|
1138 | - $sizes[ $_size ] .= ' (' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" ); |
|
1139 | - } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) { |
|
1140 | - $sizes[ $_size ] .= " ({$_wp_additional_image_sizes[ $_size ]['width']} x {$_wp_additional_image_sizes[ $_size ]['height']}"; |
|
1137 | + if (in_array($_size, $core_image_sizes)) { |
|
1138 | + $sizes[$_size] .= ' ('.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h"); |
|
1139 | + } elseif (isset($_wp_additional_image_sizes[$_size])) { |
|
1140 | + $sizes[$_size] .= " ({$_wp_additional_image_sizes[$_size]['width']} x {$_wp_additional_image_sizes[$_size]['height']}"; |
|
1141 | 1141 | } |
1142 | 1142 | |
1143 | 1143 | // Based on the above image height check, label the respective resolution as responsive |
1144 | - if ( ( array_key_exists( $_size, $_wp_additional_image_sizes ) && ! $_wp_additional_image_sizes[ $_size ]['crop'] ) || ( in_array( $_size, $core_image_sizes ) && ! get_option( "{$_size}_crop" ) ) ) { |
|
1145 | - $sizes[ $_size ] .= ' - responsive'; |
|
1144 | + if ((array_key_exists($_size, $_wp_additional_image_sizes) && ! $_wp_additional_image_sizes[$_size]['crop']) || (in_array($_size, $core_image_sizes) && ! get_option("{$_size}_crop"))) { |
|
1145 | + $sizes[$_size] .= ' - responsive'; |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | - $sizes[ $_size ] .= ')'; |
|
1148 | + $sizes[$_size] .= ')'; |
|
1149 | 1149 | |
1150 | 1150 | } |
1151 | 1151 | |
1152 | - return apply_filters( 'give_get_featured_image_sizes', $sizes ); |
|
1152 | + return apply_filters('give_get_featured_image_sizes', $sizes); |
|
1153 | 1153 | } |
1154 | 1154 | |
1155 | 1155 | |
@@ -1165,14 +1165,14 @@ discard block |
||
1165 | 1165 | * |
1166 | 1166 | * @return text $string |
1167 | 1167 | */ |
1168 | -function give_slug_to_title( $string, $filters = array() ){ |
|
1168 | +function give_slug_to_title($string, $filters = array()) { |
|
1169 | 1169 | |
1170 | - foreach( $filters as $filter_item ){ |
|
1171 | - $string = str_replace( $filter_item, ' ', $string ); |
|
1170 | + foreach ($filters as $filter_item) { |
|
1171 | + $string = str_replace($filter_item, ' ', $string); |
|
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | // Return updated string after converting it to title case |
1175 | - return ucwords( $string ); |
|
1175 | + return ucwords($string); |
|
1176 | 1176 | |
1177 | 1177 | } |
1178 | 1178 | |
@@ -1188,18 +1188,18 @@ discard block |
||
1188 | 1188 | * |
1189 | 1189 | * @return void |
1190 | 1190 | */ |
1191 | -function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1191 | +function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1192 | 1192 | /* @var CMB2_Types $field_type_object */ |
1193 | 1193 | |
1194 | 1194 | $id = $field_type_object->field->args['id']; |
1195 | 1195 | $field_description = $field_type_object->field->args['desc']; |
1196 | 1196 | $license = $field_type_object->field->args['options']['license']; |
1197 | 1197 | $license_key = $escaped_value; |
1198 | - $is_license_key = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) ); |
|
1199 | - $is_valid_license = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) ); |
|
1198 | + $is_license_key = apply_filters('give_is_license_key', (is_object($license) && ! empty($license))); |
|
1199 | + $is_valid_license = apply_filters('give_is_valid_license', ($is_license_key && property_exists($license, 'license') && 'valid' === $license->license)); |
|
1200 | 1200 | $shortname = $field_type_object->field->args['options']['shortname']; |
1201 | 1201 | $field_classes = 'regular-text give-license-field'; |
1202 | - $type = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password'; |
|
1202 | + $type = empty($escaped_value) || ! $is_valid_license ? 'text' : 'password'; |
|
1203 | 1203 | $custom_html = ''; |
1204 | 1204 | $messages = array(); |
1205 | 1205 | $class = ''; |
@@ -1211,135 +1211,135 @@ discard block |
||
1211 | 1211 | |
1212 | 1212 | // By default query on edd api url will return license object which contain status and message property, this can break below functionality. |
1213 | 1213 | // To combat that check if status is set to error or not, if yes then set $is_license_key to false. |
1214 | - if ( $is_license_key && property_exists( $license, 'status' ) && 'error' === $license->status ) { |
|
1214 | + if ($is_license_key && property_exists($license, 'status') && 'error' === $license->status) { |
|
1215 | 1215 | $is_license_key = false; |
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | // Check if current license is part of subscription or not. |
1219 | - $subscriptions = get_option( 'give_subscriptions' ); |
|
1219 | + $subscriptions = get_option('give_subscriptions'); |
|
1220 | 1220 | |
1221 | - if ( $is_license_key && $subscriptions ) { |
|
1222 | - foreach ( $subscriptions as $subscription ) { |
|
1223 | - if ( in_array( $license_key, $subscription['licenses'] ) ) { |
|
1221 | + if ($is_license_key && $subscriptions) { |
|
1222 | + foreach ($subscriptions as $subscription) { |
|
1223 | + if (in_array($license_key, $subscription['licenses'])) { |
|
1224 | 1224 | $is_in_subscription = $subscription['id']; |
1225 | 1225 | break; |
1226 | 1226 | } |
1227 | 1227 | } |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - if ( $is_license_key ) { |
|
1231 | - if ( $is_in_subscription ) { |
|
1232 | - $subscription_expires = strtotime( $subscriptions[ $is_in_subscription ]['expires'] ); |
|
1233 | - $subscription_status = __( 'renew', 'give' ); |
|
1230 | + if ($is_license_key) { |
|
1231 | + if ($is_in_subscription) { |
|
1232 | + $subscription_expires = strtotime($subscriptions[$is_in_subscription]['expires']); |
|
1233 | + $subscription_status = __('renew', 'give'); |
|
1234 | 1234 | |
1235 | - if ( ( 'active' !== $subscriptions[ $is_in_subscription ]['status'] ) ) { |
|
1236 | - $subscription_status = __( 'expire', 'give' ); |
|
1235 | + if (('active' !== $subscriptions[$is_in_subscription]['status'])) { |
|
1236 | + $subscription_status = __('expire', 'give'); |
|
1237 | 1237 | } |
1238 | 1238 | |
1239 | - if ( $subscription_expires < current_time( 'timestamp', 1 ) ) { |
|
1240 | - $messages[] = sprintf( |
|
1241 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ), |
|
1242 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1243 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1244 | - $checkout_page_link . '?edd_license_key=' . $subscriptions[ $is_in_subscription ]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1239 | + if ($subscription_expires < current_time('timestamp', 1)) { |
|
1240 | + $messages[] = sprintf( |
|
1241 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give'), |
|
1242 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1243 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1244 | + $checkout_page_link.'?edd_license_key='.$subscriptions[$is_in_subscription]['license_key'].'&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1245 | 1245 | ); |
1246 | 1246 | $license_status = 'license-expired'; |
1247 | - } elseif ( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) { |
|
1247 | + } elseif (strtotime('- 7 days', $subscription_expires) < current_time('timestamp', 1)) { |
|
1248 | 1248 | $messages[] = sprintf( |
1249 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give' ), |
|
1250 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1251 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1249 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give'), |
|
1250 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1251 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1252 | 1252 | $subscription_status, |
1253 | - human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[ $is_in_subscription ]['expires'] ) ) |
|
1253 | + human_time_diff(current_time('timestamp', 1), strtotime($subscriptions[$is_in_subscription]['expires'])) |
|
1254 | 1254 | ); |
1255 | 1255 | $license_status = 'license-expires-soon'; |
1256 | 1256 | } else { |
1257 | 1257 | $messages[] = sprintf( |
1258 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give' ), |
|
1259 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1260 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1258 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give'), |
|
1259 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1260 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1261 | 1261 | $subscription_status, |
1262 | - date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[ $is_in_subscription ]['expires'], current_time( 'timestamp' ) ) ) |
|
1262 | + date_i18n(get_option('date_format'), strtotime($subscriptions[$is_in_subscription]['expires'], current_time('timestamp'))) |
|
1263 | 1263 | ); |
1264 | 1264 | $license_status = 'license-expiration-date'; |
1265 | 1265 | } |
1266 | - } elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) { |
|
1266 | + } elseif (empty($license->success) && property_exists($license, 'error')) { |
|
1267 | 1267 | |
1268 | 1268 | // activate_license 'invalid' on anything other than valid, so if there was an error capture it |
1269 | - switch ( $license->error ) { |
|
1269 | + switch ($license->error) { |
|
1270 | 1270 | case 'expired' : |
1271 | 1271 | $class = $license->error; |
1272 | 1272 | $messages[] = sprintf( |
1273 | - __( 'Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ), |
|
1274 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ), |
|
1275 | - $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1273 | + __('Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give'), |
|
1274 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))), |
|
1275 | + $checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1276 | 1276 | ); |
1277 | - $license_status = 'license-' . $class; |
|
1277 | + $license_status = 'license-'.$class; |
|
1278 | 1278 | break; |
1279 | 1279 | |
1280 | 1280 | case 'missing' : |
1281 | 1281 | $class = $license->error; |
1282 | 1282 | $messages[] = sprintf( |
1283 | - __( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ), |
|
1284 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing' |
|
1283 | + __('Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give'), |
|
1284 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=missing' |
|
1285 | 1285 | ); |
1286 | - $license_status = 'license-' . $class; |
|
1286 | + $license_status = 'license-'.$class; |
|
1287 | 1287 | break; |
1288 | 1288 | |
1289 | 1289 | case 'invalid' : |
1290 | 1290 | $class = $license->error; |
1291 | 1291 | $messages[] = sprintf( |
1292 | - __( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1292 | + __('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1293 | 1293 | $addon_name, |
1294 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1294 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1295 | 1295 | ); |
1296 | - $license_status = 'license-' . $class; |
|
1296 | + $license_status = 'license-'.$class; |
|
1297 | 1297 | break; |
1298 | 1298 | |
1299 | 1299 | case 'site_inactive' : |
1300 | 1300 | $class = $license->error; |
1301 | 1301 | $messages[] = sprintf( |
1302 | - __( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1302 | + __('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1303 | 1303 | $addon_name, |
1304 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1304 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1305 | 1305 | ); |
1306 | - $license_status = 'license-' . $class; |
|
1306 | + $license_status = 'license-'.$class; |
|
1307 | 1307 | break; |
1308 | 1308 | |
1309 | 1309 | case 'item_name_mismatch' : |
1310 | 1310 | $class = $license->error; |
1311 | - $messages[] = sprintf( __( 'This license %1$s does not belong to %2$s.', 'give' ), $license_key, $addon_name ); |
|
1312 | - $license_status = 'license-' . $class; |
|
1311 | + $messages[] = sprintf(__('This license %1$s does not belong to %2$s.', 'give'), $license_key, $addon_name); |
|
1312 | + $license_status = 'license-'.$class; |
|
1313 | 1313 | break; |
1314 | 1314 | |
1315 | 1315 | case 'no_activations_left': |
1316 | 1316 | $class = $license->error; |
1317 | - $messages[] = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link ); |
|
1318 | - $license_status = 'license-' . $class; |
|
1317 | + $messages[] = sprintf(__('Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give'), $account_page_link); |
|
1318 | + $license_status = 'license-'.$class; |
|
1319 | 1319 | break; |
1320 | 1320 | } |
1321 | 1321 | } else { |
1322 | - switch ( $license->license ) { |
|
1322 | + switch ($license->license) { |
|
1323 | 1323 | case 'valid' : |
1324 | 1324 | default: |
1325 | 1325 | $class = 'valid'; |
1326 | - $now = current_time( 'timestamp' ); |
|
1327 | - $expiration = strtotime( $license->expires, current_time( 'timestamp' ) ); |
|
1326 | + $now = current_time('timestamp'); |
|
1327 | + $expiration = strtotime($license->expires, current_time('timestamp')); |
|
1328 | 1328 | |
1329 | - if ( 'lifetime' === $license->expires ) { |
|
1330 | - $messages[] = __( 'License key never expires.', 'give' ); |
|
1329 | + if ('lifetime' === $license->expires) { |
|
1330 | + $messages[] = __('License key never expires.', 'give'); |
|
1331 | 1331 | $license_status = 'license-lifetime-notice'; |
1332 | - } elseif ( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) { |
|
1332 | + } elseif ($expiration > $now && $expiration - $now < (DAY_IN_SECONDS * 30)) { |
|
1333 | 1333 | $messages[] = sprintf( |
1334 | - __( 'Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ), |
|
1335 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ), |
|
1336 | - $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew' |
|
1334 | + __('Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give'), |
|
1335 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))), |
|
1336 | + $checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=renew' |
|
1337 | 1337 | ); |
1338 | 1338 | $license_status = 'license-expires-soon'; |
1339 | 1339 | } else { |
1340 | 1340 | $messages[] = sprintf( |
1341 | - __( 'Your license key expires on %s.', 'give' ), |
|
1342 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ) |
|
1341 | + __('Your license key expires on %s.', 'give'), |
|
1342 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))) |
|
1343 | 1343 | ); |
1344 | 1344 | $license_status = 'license-expiration-date'; |
1345 | 1345 | } |
@@ -1347,15 +1347,15 @@ discard block |
||
1347 | 1347 | } |
1348 | 1348 | } |
1349 | 1349 | } else { |
1350 | - $messages[] = sprintf( |
|
1351 | - __( 'To receive updates, please enter your valid %s license key.', 'give' ), |
|
1350 | + $messages[] = sprintf( |
|
1351 | + __('To receive updates, please enter your valid %s license key.', 'give'), |
|
1352 | 1352 | $addon_name |
1353 | 1353 | ); |
1354 | 1354 | $license_status = 'inactive'; |
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | // Add class for input field if license is active. |
1358 | - if ( $is_valid_license ) { |
|
1358 | + if ($is_valid_license) { |
|
1359 | 1359 | $field_classes .= ' give-license-active'; |
1360 | 1360 | } |
1361 | 1361 | |
@@ -1363,33 +1363,33 @@ discard block |
||
1363 | 1363 | $input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\">"; |
1364 | 1364 | |
1365 | 1365 | // If license is active so show deactivate button. |
1366 | - if ( $is_valid_license ) { |
|
1366 | + if ($is_valid_license) { |
|
1367 | 1367 | // Get input field html. |
1368 | 1368 | $input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\" readonly=\"readonly\">"; |
1369 | 1369 | |
1370 | - $custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>'; |
|
1370 | + $custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>'; |
|
1371 | 1371 | |
1372 | 1372 | } |
1373 | 1373 | |
1374 | 1374 | // Field description. |
1375 | - $custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>'; |
|
1375 | + $custom_html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>'; |
|
1376 | 1376 | |
1377 | 1377 | // If no messages found then inform user that to get updated in future register yourself. |
1378 | - if ( empty( $messages ) ) { |
|
1379 | - $messages[] = apply_filters( "{$shortname}_default_addon_notice", __( 'To receive updates, please enter your valid license key.', 'give' ) ); |
|
1378 | + if (empty($messages)) { |
|
1379 | + $messages[] = apply_filters("{$shortname}_default_addon_notice", __('To receive updates, please enter your valid license key.', 'give')); |
|
1380 | 1380 | } |
1381 | 1381 | |
1382 | - foreach ( $messages as $message ) { |
|
1383 | - $custom_html .= '<div class="give-license-status-notice give-' . $license_status . '">'; |
|
1384 | - $custom_html .= '<p>' . $message . '</p>'; |
|
1382 | + foreach ($messages as $message) { |
|
1383 | + $custom_html .= '<div class="give-license-status-notice give-'.$license_status.'">'; |
|
1384 | + $custom_html .= '<p>'.$message.'</p>'; |
|
1385 | 1385 | $custom_html .= '</div>'; |
1386 | 1386 | } |
1387 | 1387 | |
1388 | 1388 | // Field html. |
1389 | - $custom_html = apply_filters( 'give_license_key_field_html', $input_field_html . $custom_html, $field_type_object ); |
|
1389 | + $custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object); |
|
1390 | 1390 | |
1391 | 1391 | // Nonce. |
1392 | - wp_nonce_field( $id . '-nonce', $id . '-nonce' ); |
|
1392 | + wp_nonce_field($id.'-nonce', $id.'-nonce'); |
|
1393 | 1393 | |
1394 | 1394 | // Print field html. |
1395 | 1395 | echo "<div class=\"give-license-key\"><label for=\"{$id}\">{$addon_name }</label></div><div class=\"give-license-block\">{$custom_html}</div>"; |
@@ -1404,7 +1404,7 @@ discard block |
||
1404 | 1404 | */ |
1405 | 1405 | function give_api_callback() { |
1406 | 1406 | |
1407 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
1407 | + if ( ! current_user_can('manage_give_settings')) { |
|
1408 | 1408 | return; |
1409 | 1409 | } |
1410 | 1410 | |
@@ -1413,9 +1413,9 @@ discard block |
||
1413 | 1413 | * |
1414 | 1414 | * @since 1.0 |
1415 | 1415 | */ |
1416 | - do_action( 'give_tools_api_keys_before' ); |
|
1416 | + do_action('give_tools_api_keys_before'); |
|
1417 | 1417 | |
1418 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
1418 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
1419 | 1419 | |
1420 | 1420 | $api_keys_table = new Give_API_Keys_Table(); |
1421 | 1421 | $api_keys_table->prepare_items(); |
@@ -1424,9 +1424,9 @@ discard block |
||
1424 | 1424 | <span class="cmb2-metabox-description api-description"> |
1425 | 1425 | <?php echo sprintf( |
1426 | 1426 | /* translators: 1: http://docs.givewp.com/api 2: http://docs.givewp.com/addon-zapier */ |
1427 | - __( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ), |
|
1428 | - esc_url( 'http://docs.givewp.com/api' ), |
|
1429 | - esc_url( 'http://docs.givewp.com/addon-zapier' ) |
|
1427 | + __('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'), |
|
1428 | + esc_url('http://docs.givewp.com/api'), |
|
1429 | + esc_url('http://docs.givewp.com/addon-zapier') |
|
1430 | 1430 | ); ?> |
1431 | 1431 | </span> |
1432 | 1432 | <?php |
@@ -1436,10 +1436,10 @@ discard block |
||
1436 | 1436 | * |
1437 | 1437 | * @since 1.0 |
1438 | 1438 | */ |
1439 | - do_action( 'give_tools_api_keys_after' ); |
|
1439 | + do_action('give_tools_api_keys_after'); |
|
1440 | 1440 | } |
1441 | 1441 | |
1442 | -add_action( 'give_settings_tab_api_keys', 'give_api_callback' ); |
|
1442 | +add_action('give_settings_tab_api_keys', 'give_api_callback'); |
|
1443 | 1443 | |
1444 | 1444 | /** |
1445 | 1445 | * Hook Callback |
@@ -1452,7 +1452,7 @@ discard block |
||
1452 | 1452 | * |
1453 | 1453 | * @return void |
1454 | 1454 | */ |
1455 | -function give_hook_callback( $args ) { |
|
1455 | +function give_hook_callback($args) { |
|
1456 | 1456 | |
1457 | 1457 | $id = $args['id']; |
1458 | 1458 | |
@@ -1461,7 +1461,7 @@ discard block |
||
1461 | 1461 | * |
1462 | 1462 | * @since 1.0 |
1463 | 1463 | */ |
1464 | - do_action( "give_{$id}" ); |
|
1464 | + do_action("give_{$id}"); |
|
1465 | 1465 | |
1466 | 1466 | } |
1467 | 1467 | |
@@ -1476,19 +1476,19 @@ discard block |
||
1476 | 1476 | * |
1477 | 1477 | * @return bool |
1478 | 1478 | */ |
1479 | -function give_is_setting_enabled( $value, $compare_with = null ) { |
|
1480 | - if ( ! is_null( $compare_with ) ) { |
|
1479 | +function give_is_setting_enabled($value, $compare_with = null) { |
|
1480 | + if ( ! is_null($compare_with)) { |
|
1481 | 1481 | |
1482 | - if ( is_array( $compare_with ) ) { |
|
1482 | + if (is_array($compare_with)) { |
|
1483 | 1483 | // Output. |
1484 | - return in_array( $value, $compare_with ); |
|
1484 | + return in_array($value, $compare_with); |
|
1485 | 1485 | } |
1486 | 1486 | |
1487 | 1487 | // Output. |
1488 | - return ( $value === $compare_with ); |
|
1488 | + return ($value === $compare_with); |
|
1489 | 1489 | } |
1490 | 1490 | |
1491 | 1491 | // Backward compatibility: From version 1.8 most of setting is modified to enabled/disabled |
1492 | 1492 | // Output. |
1493 | - return ( in_array( $value, array( 'enabled', 'on', 'yes' ) ) ? true : false ); |
|
1493 | + return (in_array($value, array('enabled', 'on', 'yes')) ? true : false); |
|
1494 | 1494 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | * @since 1.5 |
51 | 51 | * @global object $wpdb Used to query the database using the WordPress |
52 | 52 | * Database API |
53 | - * @return array $data The data for the CSV file |
|
53 | + * @return boolean $data The data for the CSV file |
|
54 | 54 | */ |
55 | 55 | public function get_data() { |
56 | 56 | global $give_logs, $wpdb; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -55,26 +55,26 @@ discard block |
||
55 | 55 | public function get_data() { |
56 | 56 | global $give_logs, $wpdb; |
57 | 57 | |
58 | - $totals = $this->get_stored_data( 'give_temp_recount_all_stats' ); |
|
59 | - $payment_items = $this->get_stored_data( 'give_temp_payment_items' ); |
|
60 | - $processed_payments = $this->get_stored_data( 'give_temp_processed_payments' ); |
|
61 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
58 | + $totals = $this->get_stored_data('give_temp_recount_all_stats'); |
|
59 | + $payment_items = $this->get_stored_data('give_temp_payment_items'); |
|
60 | + $processed_payments = $this->get_stored_data('give_temp_processed_payments'); |
|
61 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
62 | 62 | |
63 | - if ( false === $totals ) { |
|
63 | + if (false === $totals) { |
|
64 | 64 | $totals = array(); |
65 | 65 | } |
66 | 66 | |
67 | - if ( false === $payment_items ) { |
|
67 | + if (false === $payment_items) { |
|
68 | 68 | $payment_items = array(); |
69 | 69 | } |
70 | 70 | |
71 | - if ( false === $processed_payments ) { |
|
71 | + if (false === $processed_payments) { |
|
72 | 72 | $processed_payments = array(); |
73 | 73 | } |
74 | 74 | |
75 | - $all_forms = $this->get_stored_data( 'give_temp_form_ids' ); |
|
75 | + $all_forms = $this->get_stored_data('give_temp_form_ids'); |
|
76 | 76 | |
77 | - $args = apply_filters( 'give_recount_form_stats_args', array( |
|
77 | + $args = apply_filters('give_recount_form_stats_args', array( |
|
78 | 78 | 'post_parent__in' => $all_forms, |
79 | 79 | 'post_type' => 'give_log', |
80 | 80 | 'posts_per_page' => $this->per_step, |
@@ -82,73 +82,73 @@ discard block |
||
82 | 82 | 'paged' => $this->step, |
83 | 83 | 'log_type' => 'sale', |
84 | 84 | 'fields' => 'ids', |
85 | - ) ); |
|
85 | + )); |
|
86 | 86 | |
87 | - $log_ids = $give_logs->get_connected_logs( $args, 'sale' ); |
|
87 | + $log_ids = $give_logs->get_connected_logs($args, 'sale'); |
|
88 | 88 | |
89 | - if ( $log_ids ) { |
|
90 | - $log_ids = implode( ',', $log_ids ); |
|
89 | + if ($log_ids) { |
|
90 | + $log_ids = implode(',', $log_ids); |
|
91 | 91 | |
92 | - $payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" ); |
|
93 | - unset( $log_ids ); |
|
92 | + $payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)"); |
|
93 | + unset($log_ids); |
|
94 | 94 | |
95 | - $payment_ids = implode( ',', $payment_ids ); |
|
96 | - $payments = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" ); |
|
97 | - unset( $payment_ids ); |
|
95 | + $payment_ids = implode(',', $payment_ids); |
|
96 | + $payments = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")"); |
|
97 | + unset($payment_ids); |
|
98 | 98 | |
99 | 99 | //Loop through payments |
100 | - foreach ( $payments as $payment ) { |
|
100 | + foreach ($payments as $payment) { |
|
101 | 101 | |
102 | 102 | // Prevent payments that have all ready been retrieved from a previous sales log from counting again. |
103 | - if ( in_array( $payment->ID, $processed_payments ) ) { |
|
103 | + if (in_array($payment->ID, $processed_payments)) { |
|
104 | 104 | continue; |
105 | 105 | } |
106 | 106 | |
107 | 107 | //Verify accepted status' |
108 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
108 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
109 | 109 | $processed_payments[] = $payment->ID; |
110 | 110 | continue; |
111 | 111 | } |
112 | 112 | |
113 | - $payment_item = $payment_items[ $payment->ID ]; |
|
113 | + $payment_item = $payment_items[$payment->ID]; |
|
114 | 114 | |
115 | 115 | |
116 | - $form_id = isset( $payment_item['id'] ) ? $payment_item['id'] : ''; |
|
116 | + $form_id = isset($payment_item['id']) ? $payment_item['id'] : ''; |
|
117 | 117 | |
118 | 118 | //Must have a form ID |
119 | - if ( empty( $form_id ) ) { |
|
119 | + if (empty($form_id)) { |
|
120 | 120 | continue; |
121 | 121 | } |
122 | 122 | |
123 | 123 | //Form ID must be within $all_forms array to be validated |
124 | - if ( ! in_array( $form_id, $all_forms ) ) { |
|
124 | + if ( ! in_array($form_id, $all_forms)) { |
|
125 | 125 | continue; |
126 | 126 | } |
127 | 127 | |
128 | 128 | //If array key doesn't exist, create it |
129 | - if ( ! array_key_exists( $form_id, $totals ) ) { |
|
130 | - $totals[ $form_id ] = array( |
|
129 | + if ( ! array_key_exists($form_id, $totals)) { |
|
130 | + $totals[$form_id] = array( |
|
131 | 131 | 'sales' => (int) 0, |
132 | 132 | 'earnings' => (float) 0, |
133 | 133 | ); |
134 | 134 | } |
135 | 135 | |
136 | - $totals[ $form_id ]['sales'] ++; |
|
137 | - $totals[ $form_id ]['earnings'] += $payment_item['price']; |
|
136 | + $totals[$form_id]['sales']++; |
|
137 | + $totals[$form_id]['earnings'] += $payment_item['price']; |
|
138 | 138 | |
139 | 139 | $processed_payments[] = $payment->ID; |
140 | 140 | |
141 | 141 | } |
142 | 142 | |
143 | - $this->store_data( 'give_temp_processed_payments', $processed_payments ); |
|
144 | - $this->store_data( 'give_temp_recount_all_stats', $totals ); |
|
143 | + $this->store_data('give_temp_processed_payments', $processed_payments); |
|
144 | + $this->store_data('give_temp_recount_all_stats', $totals); |
|
145 | 145 | |
146 | 146 | return true; |
147 | 147 | } |
148 | 148 | |
149 | - foreach ( $totals as $key => $stats ) { |
|
150 | - give_update_meta( $key, '_give_form_sales', $stats['sales'] ); |
|
151 | - give_update_meta( $key, '_give_form_earnings', $stats['earnings'] ); |
|
149 | + foreach ($totals as $key => $stats) { |
|
150 | + give_update_meta($key, '_give_form_sales', $stats['sales']); |
|
151 | + give_update_meta($key, '_give_form_earnings', $stats['earnings']); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | return false; |
@@ -163,20 +163,20 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function get_percentage_complete() { |
165 | 165 | |
166 | - $total = $this->get_stored_data( 'give_recount_all_total', false ); |
|
166 | + $total = $this->get_stored_data('give_recount_all_total', false); |
|
167 | 167 | |
168 | - if ( false === $total ) { |
|
168 | + if (false === $total) { |
|
169 | 169 | $this->pre_fetch(); |
170 | - $total = $this->get_stored_data( 'give_recount_all_total', 0 ); |
|
170 | + $total = $this->get_stored_data('give_recount_all_total', 0); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | $percentage = 100; |
174 | 174 | |
175 | - if ( $total > 0 ) { |
|
176 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
175 | + if ($total > 0) { |
|
176 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
177 | 177 | } |
178 | 178 | |
179 | - if ( $percentage > 100 ) { |
|
179 | + if ($percentage > 100) { |
|
180 | 180 | $percentage = 100; |
181 | 181 | } |
182 | 182 | |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | * |
191 | 191 | * @param array $request The Form Data passed into the batch processing |
192 | 192 | */ |
193 | - public function set_properties( $request ) { |
|
194 | - $this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false; |
|
193 | + public function set_properties($request) { |
|
194 | + $this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -202,34 +202,34 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function process_step() { |
204 | 204 | |
205 | - if ( ! $this->can_export() ) { |
|
206 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
205 | + if ( ! $this->can_export()) { |
|
206 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | $had_data = $this->get_data(); |
210 | 210 | |
211 | - if ( $had_data ) { |
|
211 | + if ($had_data) { |
|
212 | 212 | $this->done = false; |
213 | 213 | |
214 | 214 | return true; |
215 | 215 | } else { |
216 | - $this->delete_data( 'give_recount_all_total' ); |
|
217 | - $this->delete_data( 'give_temp_recount_all_stats' ); |
|
218 | - $this->delete_data( 'give_temp_payment_items' ); |
|
219 | - $this->delete_data( 'give_temp_form_ids' ); |
|
220 | - $this->delete_data( 'give_temp_processed_payments' ); |
|
216 | + $this->delete_data('give_recount_all_total'); |
|
217 | + $this->delete_data('give_temp_recount_all_stats'); |
|
218 | + $this->delete_data('give_temp_payment_items'); |
|
219 | + $this->delete_data('give_temp_form_ids'); |
|
220 | + $this->delete_data('give_temp_processed_payments'); |
|
221 | 221 | $this->done = true; |
222 | - $this->message = esc_html__( 'Donation form income amounts and donation counts stats successfully recounted.', 'give' ); |
|
222 | + $this->message = esc_html__('Donation form income amounts and donation counts stats successfully recounted.', 'give'); |
|
223 | 223 | |
224 | 224 | return false; |
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
228 | 228 | public function headers() { |
229 | - ignore_user_abort( true ); |
|
229 | + ignore_user_abort(true); |
|
230 | 230 | |
231 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
232 | - set_time_limit( 0 ); |
|
231 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
232 | + set_time_limit(0); |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
@@ -258,76 +258,76 @@ discard block |
||
258 | 258 | |
259 | 259 | global $give_logs, $wpdb; |
260 | 260 | |
261 | - if ( $this->step == 1 ) { |
|
262 | - $this->delete_data( 'give_temp_recount_all_total' ); |
|
263 | - $this->delete_data( 'give_temp_recount_all_stats' ); |
|
264 | - $this->delete_data( 'give_temp_payment_items' ); |
|
265 | - $this->delete_data( 'give_temp_processed_payments' ); |
|
261 | + if ($this->step == 1) { |
|
262 | + $this->delete_data('give_temp_recount_all_total'); |
|
263 | + $this->delete_data('give_temp_recount_all_stats'); |
|
264 | + $this->delete_data('give_temp_payment_items'); |
|
265 | + $this->delete_data('give_temp_processed_payments'); |
|
266 | 266 | } |
267 | 267 | |
268 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
269 | - $total = $this->get_stored_data( 'give_temp_recount_all_total' ); |
|
268 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
269 | + $total = $this->get_stored_data('give_temp_recount_all_total'); |
|
270 | 270 | |
271 | - if ( false === $total ) { |
|
271 | + if (false === $total) { |
|
272 | 272 | $total = 0; |
273 | - $payment_items = $this->get_stored_data( 'give_temp_payment_items' ); |
|
273 | + $payment_items = $this->get_stored_data('give_temp_payment_items'); |
|
274 | 274 | |
275 | - if ( false === $payment_items ) { |
|
275 | + if (false === $payment_items) { |
|
276 | 276 | $payment_items = array(); |
277 | - $this->store_data( 'give_temp_payment_items', $payment_items ); |
|
277 | + $this->store_data('give_temp_payment_items', $payment_items); |
|
278 | 278 | } |
279 | 279 | |
280 | - $all_forms = $this->get_stored_data( 'give_temp_form_ids' ); |
|
280 | + $all_forms = $this->get_stored_data('give_temp_form_ids'); |
|
281 | 281 | |
282 | - if ( false === $all_forms ) { |
|
282 | + if (false === $all_forms) { |
|
283 | 283 | $args = array( |
284 | 284 | 'post_status' => 'any', |
285 | 285 | 'post_type' => 'give_forms', |
286 | - 'posts_per_page' => - 1, |
|
286 | + 'posts_per_page' => -1, |
|
287 | 287 | 'fields' => 'ids', |
288 | 288 | ); |
289 | 289 | |
290 | - $all_forms = get_posts( $args ); |
|
291 | - $this->store_data( 'give_temp_form_ids', $all_forms ); |
|
290 | + $all_forms = get_posts($args); |
|
291 | + $this->store_data('give_temp_form_ids', $all_forms); |
|
292 | 292 | } |
293 | 293 | |
294 | - $args = apply_filters( 'give_recount_form_stats_total_args', array( |
|
294 | + $args = apply_filters('give_recount_form_stats_total_args', array( |
|
295 | 295 | 'post_parent__in' => $all_forms, |
296 | 296 | 'post_type' => 'give_log', |
297 | 297 | 'post_status' => 'publish', |
298 | 298 | 'log_type' => 'sale', |
299 | 299 | 'fields' => 'ids', |
300 | 300 | 'nopaging' => true, |
301 | - ) ); |
|
301 | + )); |
|
302 | 302 | |
303 | - $all_logs = $give_logs->get_connected_logs( $args, 'sale' ); |
|
303 | + $all_logs = $give_logs->get_connected_logs($args, 'sale'); |
|
304 | 304 | |
305 | - if ( $all_logs ) { |
|
306 | - $log_ids = implode( ',', $all_logs ); |
|
307 | - $payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" ); |
|
308 | - unset( $log_ids ); |
|
305 | + if ($all_logs) { |
|
306 | + $log_ids = implode(',', $all_logs); |
|
307 | + $payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)"); |
|
308 | + unset($log_ids); |
|
309 | 309 | |
310 | - $payment_ids = implode( ',', $payment_ids ); |
|
311 | - $payments = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" ); |
|
312 | - unset( $payment_ids ); |
|
310 | + $payment_ids = implode(',', $payment_ids); |
|
311 | + $payments = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")"); |
|
312 | + unset($payment_ids); |
|
313 | 313 | |
314 | - foreach ( $payments as $payment ) { |
|
314 | + foreach ($payments as $payment) { |
|
315 | 315 | |
316 | - $payment = new Give_Payment( $payment->ID ); |
|
316 | + $payment = new Give_Payment($payment->ID); |
|
317 | 317 | $form_id = $payment->form_id; |
318 | 318 | |
319 | 319 | //If for some reason somehow the form_ID isn't set check payment meta |
320 | - if ( empty( $payment->form_id ) ) { |
|
320 | + if (empty($payment->form_id)) { |
|
321 | 321 | $payment_meta = $payment->get_meta(); |
322 | - $form_id = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0; |
|
322 | + $form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0; |
|
323 | 323 | } |
324 | 324 | |
325 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
325 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
326 | 326 | continue; |
327 | 327 | } |
328 | 328 | |
329 | - if ( ! array_key_exists( $payment->ID, $payment_items ) ) { |
|
330 | - $payment_items[ $payment->ID ] = array( |
|
329 | + if ( ! array_key_exists($payment->ID, $payment_items)) { |
|
330 | + $payment_items[$payment->ID] = array( |
|
331 | 331 | 'id' => $form_id, |
332 | 332 | 'payment_id' => $payment->ID, |
333 | 333 | 'price' => $payment->total |
@@ -336,11 +336,11 @@ discard block |
||
336 | 336 | |
337 | 337 | } |
338 | 338 | |
339 | - $total = count( $all_logs ); |
|
339 | + $total = count($all_logs); |
|
340 | 340 | } |
341 | 341 | |
342 | - $this->store_data( 'give_temp_payment_items', $payment_items ); |
|
343 | - $this->store_data( 'give_recount_all_total', $total ); |
|
342 | + $this->store_data('give_temp_payment_items', $payment_items); |
|
343 | + $this->store_data('give_recount_all_total', $total); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | } |
@@ -354,11 +354,11 @@ discard block |
||
354 | 354 | * |
355 | 355 | * @return mixed Returns the data from the database |
356 | 356 | */ |
357 | - private function get_stored_data( $key ) { |
|
357 | + private function get_stored_data($key) { |
|
358 | 358 | global $wpdb; |
359 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
359 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
360 | 360 | |
361 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
361 | + return empty($value) ? false : maybe_unserialize($value); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | /** |
@@ -371,10 +371,10 @@ discard block |
||
371 | 371 | * |
372 | 372 | * @return void |
373 | 373 | */ |
374 | - private function store_data( $key, $value ) { |
|
374 | + private function store_data($key, $value) { |
|
375 | 375 | global $wpdb; |
376 | 376 | |
377 | - $value = maybe_serialize( $value ); |
|
377 | + $value = maybe_serialize($value); |
|
378 | 378 | |
379 | 379 | $data = array( |
380 | 380 | 'option_name' => $key, |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | '%s', |
389 | 389 | ); |
390 | 390 | |
391 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
391 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
@@ -400,9 +400,9 @@ discard block |
||
400 | 400 | * |
401 | 401 | * @return void |
402 | 402 | */ |
403 | - private function delete_data( $key ) { |
|
403 | + private function delete_data($key) { |
|
404 | 404 | global $wpdb; |
405 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
405 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * @access public |
50 | 50 | * @since 1.5 |
51 | 51 | * |
52 | - * @return array $data The data for the CSV file |
|
52 | + * @return boolean $data The data for the CSV file |
|
53 | 53 | */ |
54 | 54 | public function get_data() { |
55 | 55 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -55,32 +55,32 @@ discard block |
||
55 | 55 | |
56 | 56 | $args = array( |
57 | 57 | 'number' => $this->per_step, |
58 | - 'offset' => $this->per_step * ( $this->step - 1 ), |
|
58 | + 'offset' => $this->per_step * ($this->step - 1), |
|
59 | 59 | 'orderby' => 'id', |
60 | 60 | 'order' => 'DESC', |
61 | 61 | ); |
62 | 62 | |
63 | - $customers = Give()->customers->get_customers( $args ); |
|
63 | + $customers = Give()->customers->get_customers($args); |
|
64 | 64 | |
65 | - if ( $customers ) { |
|
65 | + if ($customers) { |
|
66 | 66 | |
67 | - $allowed_payment_status = apply_filters( 'give_recount_donors_donation_statuses', give_get_payment_status_keys() ); |
|
67 | + $allowed_payment_status = apply_filters('give_recount_donors_donation_statuses', give_get_payment_status_keys()); |
|
68 | 68 | |
69 | - foreach ( $customers as $customer ) { |
|
69 | + foreach ($customers as $customer) { |
|
70 | 70 | |
71 | - $attached_payment_ids = explode( ',', $customer->payment_ids ); |
|
71 | + $attached_payment_ids = explode(',', $customer->payment_ids); |
|
72 | 72 | |
73 | 73 | $attached_args = array( |
74 | 74 | 'post__in' => $attached_payment_ids, |
75 | - 'number' => - 1, |
|
75 | + 'number' => -1, |
|
76 | 76 | 'status' => $allowed_payment_status, |
77 | 77 | ); |
78 | 78 | |
79 | - $attached_payments = (array) give_get_payments( $attached_args ); |
|
79 | + $attached_payments = (array) give_get_payments($attached_args); |
|
80 | 80 | |
81 | 81 | $unattached_args = array( |
82 | 82 | 'post__not_in' => $attached_payment_ids, |
83 | - 'number' => - 1, |
|
83 | + 'number' => -1, |
|
84 | 84 | 'status' => $allowed_payment_status, |
85 | 85 | 'meta_query' => array( |
86 | 86 | array( |
@@ -91,29 +91,29 @@ discard block |
||
91 | 91 | ), |
92 | 92 | ); |
93 | 93 | |
94 | - $unattached_payments = give_get_payments( $unattached_args ); |
|
94 | + $unattached_payments = give_get_payments($unattached_args); |
|
95 | 95 | |
96 | - $payments = array_merge( $attached_payments, $unattached_payments ); |
|
96 | + $payments = array_merge($attached_payments, $unattached_payments); |
|
97 | 97 | |
98 | 98 | $purchase_value = 0.00; |
99 | 99 | $purchase_count = 0; |
100 | 100 | $payment_ids = array(); |
101 | 101 | |
102 | - if ( $payments ) { |
|
102 | + if ($payments) { |
|
103 | 103 | |
104 | - foreach ( $payments as $payment ) { |
|
104 | + foreach ($payments as $payment) { |
|
105 | 105 | |
106 | 106 | $should_process_payment = 'publish' == $payment->post_status ? true : false; |
107 | - $should_process_payment = apply_filters( 'give_donor_recount_should_process_donation', $should_process_payment, $payment ); |
|
107 | + $should_process_payment = apply_filters('give_donor_recount_should_process_donation', $should_process_payment, $payment); |
|
108 | 108 | |
109 | - if ( true === $should_process_payment ) { |
|
109 | + if (true === $should_process_payment) { |
|
110 | 110 | |
111 | - if ( apply_filters( 'give_customer_recount_should_increase_value', true, $payment ) ) { |
|
112 | - $purchase_value += give_get_payment_amount( $payment->ID ); |
|
111 | + if (apply_filters('give_customer_recount_should_increase_value', true, $payment)) { |
|
112 | + $purchase_value += give_get_payment_amount($payment->ID); |
|
113 | 113 | } |
114 | 114 | |
115 | - if ( apply_filters( 'give_customer_recount_should_increase_count', true, $payment ) ) { |
|
116 | - $purchase_count ++; |
|
115 | + if (apply_filters('give_customer_recount_should_increase_count', true, $payment)) { |
|
116 | + $purchase_count++; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | } |
125 | 125 | |
126 | - $payment_ids = implode( ',', $payment_ids ); |
|
126 | + $payment_ids = implode(',', $payment_ids); |
|
127 | 127 | |
128 | 128 | $customer_update_data = array( |
129 | 129 | 'purchase_count' => $purchase_count, |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | 'payment_ids' => $payment_ids, |
132 | 132 | ); |
133 | 133 | |
134 | - $customer_instance = new Give_Customer( $customer->id ); |
|
135 | - $customer_instance->update( $customer_update_data ); |
|
134 | + $customer_instance = new Give_Customer($customer->id); |
|
135 | + $customer_instance->update($customer_update_data); |
|
136 | 136 | |
137 | 137 | } |
138 | 138 | |
@@ -152,21 +152,21 @@ discard block |
||
152 | 152 | public function get_percentage_complete() { |
153 | 153 | |
154 | 154 | $args = array( |
155 | - 'number' => - 1, |
|
155 | + 'number' => -1, |
|
156 | 156 | 'orderby' => 'id', |
157 | 157 | 'order' => 'DESC', |
158 | 158 | ); |
159 | 159 | |
160 | - $customers = Give()->customers->get_customers( $args ); |
|
161 | - $total = count( $customers ); |
|
160 | + $customers = Give()->customers->get_customers($args); |
|
161 | + $total = count($customers); |
|
162 | 162 | |
163 | 163 | $percentage = 100; |
164 | 164 | |
165 | - if ( $total > 0 ) { |
|
166 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
165 | + if ($total > 0) { |
|
166 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
167 | 167 | } |
168 | 168 | |
169 | - if ( $percentage > 100 ) { |
|
169 | + if ($percentage > 100) { |
|
170 | 170 | $percentage = 100; |
171 | 171 | } |
172 | 172 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @param array $request The Form Data passed into the batch processing |
182 | 182 | */ |
183 | - public function set_properties( $request ) { |
|
183 | + public function set_properties($request) { |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -191,19 +191,19 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function process_step() { |
193 | 193 | |
194 | - if ( ! $this->can_export() ) { |
|
195 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
194 | + if ( ! $this->can_export()) { |
|
195 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | $had_data = $this->get_data(); |
199 | 199 | |
200 | - if ( $had_data ) { |
|
200 | + if ($had_data) { |
|
201 | 201 | $this->done = false; |
202 | 202 | |
203 | 203 | return true; |
204 | 204 | } else { |
205 | 205 | $this->done = true; |
206 | - $this->message = esc_html__( 'Donor stats have been successfully recounted.', 'give' ); |
|
206 | + $this->message = esc_html__('Donor stats have been successfully recounted.', 'give'); |
|
207 | 207 | |
208 | 208 | return false; |
209 | 209 | } |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | * Headers |
214 | 214 | */ |
215 | 215 | public function headers() { |
216 | - ignore_user_abort( true ); |
|
216 | + ignore_user_abort(true); |
|
217 | 217 | |
218 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
219 | - set_time_limit( 0 ); |
|
218 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
219 | + set_time_limit(0); |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 |
@@ -50,7 +50,7 @@ |
||
50 | 50 | * @since 1.5 |
51 | 51 | * @global object $wpdb Used to query the database using the WordPress |
52 | 52 | * Database API |
53 | - * @return array $data The data for the CSV file |
|
53 | + * @return boolean $data The data for the CSV file |
|
54 | 54 | */ |
55 | 55 | public function get_data() { |
56 | 56 | global $give_logs, $wpdb; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -62,23 +62,23 @@ discard block |
||
62 | 62 | public function get_data() { |
63 | 63 | global $give_logs, $wpdb; |
64 | 64 | |
65 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
65 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
66 | 66 | |
67 | - if ( $this->step == 1 ) { |
|
68 | - $this->delete_data( 'give_temp_recount_form_stats' ); |
|
67 | + if ($this->step == 1) { |
|
68 | + $this->delete_data('give_temp_recount_form_stats'); |
|
69 | 69 | } |
70 | 70 | |
71 | - $totals = $this->get_stored_data( 'give_temp_recount_form_stats' ); |
|
71 | + $totals = $this->get_stored_data('give_temp_recount_form_stats'); |
|
72 | 72 | |
73 | - if ( false === $totals ) { |
|
73 | + if (false === $totals) { |
|
74 | 74 | $totals = array( |
75 | 75 | 'earnings' => (float) 0, |
76 | 76 | 'sales' => 0, |
77 | 77 | ); |
78 | - $this->store_data( 'give_temp_recount_form_stats', $totals ); |
|
78 | + $this->store_data('give_temp_recount_form_stats', $totals); |
|
79 | 79 | } |
80 | 80 | |
81 | - $args = apply_filters( 'give_recount_form_stats_args', array( |
|
81 | + $args = apply_filters('give_recount_form_stats_args', array( |
|
82 | 82 | 'post_parent' => $this->form_id, |
83 | 83 | 'post_type' => 'give_log', |
84 | 84 | 'posts_per_page' => $this->per_step, |
@@ -86,49 +86,49 @@ discard block |
||
86 | 86 | 'paged' => $this->step, |
87 | 87 | 'log_type' => 'sale', |
88 | 88 | 'fields' => 'ids', |
89 | - ) ); |
|
89 | + )); |
|
90 | 90 | |
91 | - $log_ids = $give_logs->get_connected_logs( $args, 'sale' ); |
|
91 | + $log_ids = $give_logs->get_connected_logs($args, 'sale'); |
|
92 | 92 | $this->_log_ids_debug = array(); |
93 | 93 | |
94 | - if ( $log_ids ) { |
|
95 | - $log_ids = implode( ',', $log_ids ); |
|
96 | - $payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" ); |
|
97 | - unset( $log_ids ); |
|
94 | + if ($log_ids) { |
|
95 | + $log_ids = implode(',', $log_ids); |
|
96 | + $payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)"); |
|
97 | + unset($log_ids); |
|
98 | 98 | |
99 | - $payment_ids = implode( ',', $payment_ids ); |
|
100 | - $payments = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" ); |
|
101 | - unset( $payment_ids ); |
|
99 | + $payment_ids = implode(',', $payment_ids); |
|
100 | + $payments = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")"); |
|
101 | + unset($payment_ids); |
|
102 | 102 | |
103 | - foreach ( $payments as $payment ) { |
|
103 | + foreach ($payments as $payment) { |
|
104 | 104 | |
105 | - $payment = new Give_Payment( $payment->ID ); |
|
105 | + $payment = new Give_Payment($payment->ID); |
|
106 | 106 | |
107 | 107 | //Ensure acceptible status only |
108 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
108 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
109 | 109 | continue; |
110 | 110 | } |
111 | 111 | |
112 | 112 | //Ensure only payments for this form are counted |
113 | - if ( $payment->form_id != $this->form_id ) { |
|
113 | + if ($payment->form_id != $this->form_id) { |
|
114 | 114 | continue; |
115 | 115 | } |
116 | 116 | |
117 | 117 | $this->_log_ids_debug[] = $payment->ID; |
118 | 118 | |
119 | - $totals['sales'] ++; |
|
119 | + $totals['sales']++; |
|
120 | 120 | $totals['earnings'] += $payment->total; |
121 | 121 | |
122 | 122 | } |
123 | 123 | |
124 | - $this->store_data( 'give_temp_recount_form_stats', $totals ); |
|
124 | + $this->store_data('give_temp_recount_form_stats', $totals); |
|
125 | 125 | |
126 | 126 | return true; |
127 | 127 | } |
128 | 128 | |
129 | 129 | |
130 | - give_update_meta( $this->form_id, '_give_form_sales', $totals['sales'] ); |
|
131 | - give_update_meta( $this->form_id, '_give_form_earnings', $totals['earnings'] ); |
|
130 | + give_update_meta($this->form_id, '_give_form_sales', $totals['sales']); |
|
131 | + give_update_meta($this->form_id, '_give_form_earnings', $totals['earnings']); |
|
132 | 132 | |
133 | 133 | return false; |
134 | 134 | |
@@ -143,54 +143,54 @@ discard block |
||
143 | 143 | public function get_percentage_complete() { |
144 | 144 | global $give_logs, $wpdb; |
145 | 145 | |
146 | - if ( $this->step == 1 ) { |
|
147 | - $this->delete_data( 'give_recount_total_' . $this->form_id ); |
|
146 | + if ($this->step == 1) { |
|
147 | + $this->delete_data('give_recount_total_'.$this->form_id); |
|
148 | 148 | } |
149 | 149 | |
150 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
151 | - $total = $this->get_stored_data( 'give_recount_total_' . $this->form_id ); |
|
150 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
151 | + $total = $this->get_stored_data('give_recount_total_'.$this->form_id); |
|
152 | 152 | |
153 | - if ( false === $total ) { |
|
153 | + if (false === $total) { |
|
154 | 154 | $total = 0; |
155 | - $args = apply_filters( 'give_recount_form_stats_total_args', array( |
|
155 | + $args = apply_filters('give_recount_form_stats_total_args', array( |
|
156 | 156 | 'post_parent' => $this->form_id, |
157 | 157 | 'post_type' => 'give_log', |
158 | 158 | 'post_status' => 'publish', |
159 | 159 | 'log_type' => 'sale', |
160 | 160 | 'fields' => 'ids', |
161 | 161 | 'nopaging' => true, |
162 | - ) ); |
|
162 | + )); |
|
163 | 163 | |
164 | - $log_ids = $give_logs->get_connected_logs( $args, 'sale' ); |
|
164 | + $log_ids = $give_logs->get_connected_logs($args, 'sale'); |
|
165 | 165 | |
166 | - if ( $log_ids ) { |
|
167 | - $log_ids = implode( ',', $log_ids ); |
|
168 | - $payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" ); |
|
169 | - unset( $log_ids ); |
|
166 | + if ($log_ids) { |
|
167 | + $log_ids = implode(',', $log_ids); |
|
168 | + $payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)"); |
|
169 | + unset($log_ids); |
|
170 | 170 | |
171 | - $payment_ids = implode( ',', $payment_ids ); |
|
172 | - $payments = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" ); |
|
173 | - unset( $payment_ids ); |
|
171 | + $payment_ids = implode(',', $payment_ids); |
|
172 | + $payments = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")"); |
|
173 | + unset($payment_ids); |
|
174 | 174 | |
175 | - foreach ( $payments as $payment ) { |
|
176 | - if ( in_array( $payment->post_status, $accepted_statuses ) ) { |
|
175 | + foreach ($payments as $payment) { |
|
176 | + if (in_array($payment->post_status, $accepted_statuses)) { |
|
177 | 177 | continue; |
178 | 178 | } |
179 | 179 | |
180 | - $total ++; |
|
180 | + $total++; |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | - $this->store_data( 'give_recount_total_' . $this->form_id, $total ); |
|
184 | + $this->store_data('give_recount_total_'.$this->form_id, $total); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | $percentage = 100; |
188 | 188 | |
189 | - if ( $total > 0 ) { |
|
190 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
189 | + if ($total > 0) { |
|
190 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
191 | 191 | } |
192 | 192 | |
193 | - if ( $percentage > 100 ) { |
|
193 | + if ($percentage > 100) { |
|
194 | 194 | $percentage = 100; |
195 | 195 | } |
196 | 196 | |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @param array $request The Form Data passed into the batch processing |
206 | 206 | */ |
207 | - public function set_properties( $request ) { |
|
208 | - $this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false; |
|
207 | + public function set_properties($request) { |
|
208 | + $this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -216,31 +216,31 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function process_step() { |
218 | 218 | |
219 | - if ( ! $this->can_export() ) { |
|
220 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
219 | + if ( ! $this->can_export()) { |
|
220 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | $had_data = $this->get_data(); |
224 | 224 | |
225 | - if ( $had_data ) { |
|
225 | + if ($had_data) { |
|
226 | 226 | $this->done = false; |
227 | 227 | |
228 | 228 | return true; |
229 | 229 | } else { |
230 | - $this->delete_data( 'give_recount_total_' . $this->form_id ); |
|
231 | - $this->delete_data( 'give_temp_recount_form_stats' ); |
|
230 | + $this->delete_data('give_recount_total_'.$this->form_id); |
|
231 | + $this->delete_data('give_temp_recount_form_stats'); |
|
232 | 232 | $this->done = true; |
233 | - $this->message = sprintf( esc_html__( 'Donation counts and income amount statistics successfully recounted for "%s".', 'give' ), get_the_title( $this->form_id ) ); |
|
233 | + $this->message = sprintf(esc_html__('Donation counts and income amount statistics successfully recounted for "%s".', 'give'), get_the_title($this->form_id)); |
|
234 | 234 | |
235 | 235 | return false; |
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
239 | 239 | public function headers() { |
240 | - ignore_user_abort( true ); |
|
240 | + ignore_user_abort(true); |
|
241 | 241 | |
242 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
243 | - set_time_limit( 0 ); |
|
242 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
243 | + set_time_limit(0); |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
@@ -268,11 +268,11 @@ discard block |
||
268 | 268 | * |
269 | 269 | * @return mixed Returns the data from the database |
270 | 270 | */ |
271 | - private function get_stored_data( $key ) { |
|
271 | + private function get_stored_data($key) { |
|
272 | 272 | global $wpdb; |
273 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
273 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
274 | 274 | |
275 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
275 | + return empty($value) ? false : maybe_unserialize($value); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -285,10 +285,10 @@ discard block |
||
285 | 285 | * |
286 | 286 | * @return void |
287 | 287 | */ |
288 | - private function store_data( $key, $value ) { |
|
288 | + private function store_data($key, $value) { |
|
289 | 289 | global $wpdb; |
290 | 290 | |
291 | - $value = maybe_serialize( $value ); |
|
291 | + $value = maybe_serialize($value); |
|
292 | 292 | |
293 | 293 | $data = array( |
294 | 294 | 'option_name' => $key, |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | '%s', |
303 | 303 | ); |
304 | 304 | |
305 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
305 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | * |
315 | 315 | * @return void |
316 | 316 | */ |
317 | - private function delete_data( $key ) { |
|
317 | + private function delete_data($key) { |
|
318 | 318 | global $wpdb; |
319 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
319 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | * @since 1.5 |
51 | 51 | * @global object $wpdb Used to query the database using the WordPress |
52 | 52 | * Database API |
53 | - * @return array $data The data for the CSV file |
|
53 | + * @return boolean $data The data for the CSV file |
|
54 | 54 | */ |
55 | 55 | public function get_data() { |
56 | 56 |
@@ -188,8 +188,8 @@ |
||
188 | 188 | |
189 | 189 | $payment_ids = implode( ',', $payment_ids ); |
190 | 190 | $customer->update( array( 'payment_ids' => $payment_ids, |
191 | - 'purchase_count' => $purchase_count, |
|
192 | - 'purchase_value' => $pending_total |
|
191 | + 'purchase_count' => $purchase_count, |
|
192 | + 'purchase_value' => $pending_total |
|
193 | 193 | ) ); |
194 | 194 | |
195 | 195 | $this->done = true; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -54,39 +54,39 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function get_data() { |
56 | 56 | |
57 | - $customer = new Give_Customer( $this->customer_id ); |
|
58 | - $payments = $this->get_stored_data( 'give_recount_customer_payments_' . $customer->id, array() ); |
|
57 | + $customer = new Give_Customer($this->customer_id); |
|
58 | + $payments = $this->get_stored_data('give_recount_customer_payments_'.$customer->id, array()); |
|
59 | 59 | |
60 | - $offset = ( $this->step - 1 ) * $this->per_step; |
|
61 | - $step_items = array_slice( $payments, $offset, $this->per_step ); |
|
60 | + $offset = ($this->step - 1) * $this->per_step; |
|
61 | + $step_items = array_slice($payments, $offset, $this->per_step); |
|
62 | 62 | |
63 | - if ( count( $step_items ) > 0 ) { |
|
64 | - $pending_total = (float) $this->get_stored_data( 'give_stats_customer_pending_total' . $customer->id, 0 ); |
|
63 | + if (count($step_items) > 0) { |
|
64 | + $pending_total = (float) $this->get_stored_data('give_stats_customer_pending_total'.$customer->id, 0); |
|
65 | 65 | $step_total = 0; |
66 | 66 | |
67 | - $found_payment_ids = $this->get_stored_data( 'give_stats_found_payments_' . $customer->id, array() ); |
|
67 | + $found_payment_ids = $this->get_stored_data('give_stats_found_payments_'.$customer->id, array()); |
|
68 | 68 | |
69 | - foreach ( $step_items as $payment ) { |
|
70 | - $payment = get_post( $payment->ID ); |
|
69 | + foreach ($step_items as $payment) { |
|
70 | + $payment = get_post($payment->ID); |
|
71 | 71 | |
72 | - if ( is_null( $payment ) || is_wp_error( $payment ) || 'give_payment' !== $payment->post_type ) { |
|
72 | + if (is_null($payment) || is_wp_error($payment) || 'give_payment' !== $payment->post_type) { |
|
73 | 73 | |
74 | - $missing_payments = $this->get_stored_data( 'give_stats_missing_payments' . $customer->id, array() ); |
|
74 | + $missing_payments = $this->get_stored_data('give_stats_missing_payments'.$customer->id, array()); |
|
75 | 75 | $missing_payments[] = $payment->ID; |
76 | - $this->store_data( 'give_stats_missing_payments' . $customer->id, $missing_payments ); |
|
76 | + $this->store_data('give_stats_missing_payments'.$customer->id, $missing_payments); |
|
77 | 77 | |
78 | 78 | continue; |
79 | 79 | } |
80 | 80 | |
81 | 81 | $should_process_payment = 'publish' == $payment->post_status ? true : false; |
82 | - $should_process_payment = apply_filters( 'give_donor_recount_should_process_donation', $should_process_payment, $payment ); |
|
82 | + $should_process_payment = apply_filters('give_donor_recount_should_process_donation', $should_process_payment, $payment); |
|
83 | 83 | |
84 | - if ( true === $should_process_payment ) { |
|
84 | + if (true === $should_process_payment) { |
|
85 | 85 | |
86 | 86 | $found_payment_ids[] = $payment->ID; |
87 | 87 | |
88 | - if ( apply_filters( 'give_customer_recount_sholud_increase_value', true, $payment ) ) { |
|
89 | - $payment_amount = give_get_payment_amount( $payment->ID ); |
|
88 | + if (apply_filters('give_customer_recount_sholud_increase_value', true, $payment)) { |
|
89 | + $payment_amount = give_get_payment_amount($payment->ID); |
|
90 | 90 | $step_total += $payment_amount; |
91 | 91 | } |
92 | 92 | |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | $updated_total = $pending_total + $step_total; |
98 | - $this->store_data( 'give_stats_customer_pending_total' . $customer->id, $updated_total ); |
|
99 | - $this->store_data( 'give_stats_found_payments_' . $customer->id, $found_payment_ids ); |
|
98 | + $this->store_data('give_stats_customer_pending_total'.$customer->id, $updated_total); |
|
99 | + $this->store_data('give_stats_found_payments_'.$customer->id, $found_payment_ids); |
|
100 | 100 | |
101 | 101 | return true; |
102 | 102 | } |
@@ -113,16 +113,16 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function get_percentage_complete() { |
115 | 115 | |
116 | - $payments = $this->get_stored_data( 'give_recount_customer_payments_' . $this->customer_id ); |
|
117 | - $total = count( $payments ); |
|
116 | + $payments = $this->get_stored_data('give_recount_customer_payments_'.$this->customer_id); |
|
117 | + $total = count($payments); |
|
118 | 118 | |
119 | 119 | $percentage = 100; |
120 | 120 | |
121 | - if ( $total > 0 ) { |
|
122 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
121 | + if ($total > 0) { |
|
122 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
123 | 123 | } |
124 | 124 | |
125 | - if ( $percentage > 100 ) { |
|
125 | + if ($percentage > 100) { |
|
126 | 126 | $percentage = 100; |
127 | 127 | } |
128 | 128 | |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @param array $request The Form Data passed into the batch processing |
138 | 138 | */ |
139 | - public function set_properties( $request ) { |
|
140 | - $this->customer_id = isset( $request['customer_id'] ) ? sanitize_text_field( $request['customer_id'] ) : false; |
|
139 | + public function set_properties($request) { |
|
140 | + $this->customer_id = isset($request['customer_id']) ? sanitize_text_field($request['customer_id']) : false; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -148,62 +148,62 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function process_step() { |
150 | 150 | |
151 | - if ( ! $this->can_export() ) { |
|
152 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
151 | + if ( ! $this->can_export()) { |
|
152 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | $had_data = $this->get_data(); |
156 | 156 | |
157 | - if ( $had_data ) { |
|
157 | + if ($had_data) { |
|
158 | 158 | $this->done = false; |
159 | 159 | |
160 | 160 | return true; |
161 | 161 | } else { |
162 | - $customer = new Give_Customer( $this->customer_id ); |
|
163 | - $payment_ids = get_option( 'give_stats_found_payments_' . $customer->id, array() ); |
|
164 | - $this->delete_data( 'give_stats_found_payments_' . $customer->id ); |
|
162 | + $customer = new Give_Customer($this->customer_id); |
|
163 | + $payment_ids = get_option('give_stats_found_payments_'.$customer->id, array()); |
|
164 | + $this->delete_data('give_stats_found_payments_'.$customer->id); |
|
165 | 165 | |
166 | - $removed_payments = array_unique( get_option( 'give_stats_missing_payments' . $customer->id, array() ) ); |
|
166 | + $removed_payments = array_unique(get_option('give_stats_missing_payments'.$customer->id, array())); |
|
167 | 167 | |
168 | 168 | // Find non-existing payments (deleted) and total up the donation count |
169 | 169 | $purchase_count = 0; |
170 | - foreach ( $payment_ids as $key => $payment_id ) { |
|
171 | - if ( in_array( $payment_id, $removed_payments ) ) { |
|
172 | - unset( $payment_ids[ $key ] ); |
|
170 | + foreach ($payment_ids as $key => $payment_id) { |
|
171 | + if (in_array($payment_id, $removed_payments)) { |
|
172 | + unset($payment_ids[$key]); |
|
173 | 173 | continue; |
174 | 174 | } |
175 | 175 | |
176 | - $payment = get_post( $payment_id ); |
|
177 | - if ( apply_filters( 'give_customer_recount_should_increase_count', true, $payment ) ) { |
|
178 | - $purchase_count ++; |
|
176 | + $payment = get_post($payment_id); |
|
177 | + if (apply_filters('give_customer_recount_should_increase_count', true, $payment)) { |
|
178 | + $purchase_count++; |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
182 | - $this->delete_data( 'give_stats_missing_payments' . $customer->id ); |
|
182 | + $this->delete_data('give_stats_missing_payments'.$customer->id); |
|
183 | 183 | |
184 | - $pending_total = $this->get_stored_data( 'give_stats_customer_pending_total' . $customer->id, 0 ); |
|
185 | - $this->delete_data( 'give_stats_customer_pending_total' . $customer->id ); |
|
186 | - $this->delete_data( 'give_recount_customer_stats_' . $customer->id ); |
|
187 | - $this->delete_data( 'give_recount_customer_payments_' . $this->customer_id ); |
|
184 | + $pending_total = $this->get_stored_data('give_stats_customer_pending_total'.$customer->id, 0); |
|
185 | + $this->delete_data('give_stats_customer_pending_total'.$customer->id); |
|
186 | + $this->delete_data('give_recount_customer_stats_'.$customer->id); |
|
187 | + $this->delete_data('give_recount_customer_payments_'.$this->customer_id); |
|
188 | 188 | |
189 | - $payment_ids = implode( ',', $payment_ids ); |
|
190 | - $customer->update( array( 'payment_ids' => $payment_ids, |
|
189 | + $payment_ids = implode(',', $payment_ids); |
|
190 | + $customer->update(array('payment_ids' => $payment_ids, |
|
191 | 191 | 'purchase_count' => $purchase_count, |
192 | 192 | 'purchase_value' => $pending_total |
193 | - ) ); |
|
193 | + )); |
|
194 | 194 | |
195 | 195 | $this->done = true; |
196 | - $this->message = esc_html__( 'Donor stats have been successfully recounted.', 'give' ); |
|
196 | + $this->message = esc_html__('Donor stats have been successfully recounted.', 'give'); |
|
197 | 197 | |
198 | 198 | return false; |
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
202 | 202 | public function headers() { |
203 | - ignore_user_abort( true ); |
|
203 | + ignore_user_abort(true); |
|
204 | 204 | |
205 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
206 | - set_time_limit( 0 ); |
|
205 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
206 | + set_time_limit(0); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -230,26 +230,26 @@ discard block |
||
230 | 230 | * @return void |
231 | 231 | */ |
232 | 232 | public function pre_fetch() { |
233 | - if ( $this->step === 1 ) { |
|
234 | - $allowed_payment_status = apply_filters( 'give_recount_donors_donation_statuses', give_get_payment_status_keys() ); |
|
233 | + if ($this->step === 1) { |
|
234 | + $allowed_payment_status = apply_filters('give_recount_donors_donation_statuses', give_get_payment_status_keys()); |
|
235 | 235 | |
236 | 236 | // Before we start, let's zero out the customer's data |
237 | - $customer = new Give_Customer( $this->customer_id ); |
|
238 | - $customer->update( array( 'purchase_value' => give_format_amount( 0 ), 'purchase_count' => 0 ) ); |
|
237 | + $customer = new Give_Customer($this->customer_id); |
|
238 | + $customer->update(array('purchase_value' => give_format_amount(0), 'purchase_count' => 0)); |
|
239 | 239 | |
240 | - $attached_payment_ids = explode( ',', $customer->payment_ids ); |
|
240 | + $attached_payment_ids = explode(',', $customer->payment_ids); |
|
241 | 241 | |
242 | 242 | $attached_args = array( |
243 | 243 | 'post__in' => $attached_payment_ids, |
244 | - 'number' => - 1, |
|
244 | + 'number' => -1, |
|
245 | 245 | 'status' => $allowed_payment_status, |
246 | 246 | ); |
247 | 247 | |
248 | - $attached_payments = give_get_payments( $attached_args ); |
|
248 | + $attached_payments = give_get_payments($attached_args); |
|
249 | 249 | |
250 | 250 | $unattached_args = array( |
251 | 251 | 'post__not_in' => $attached_payment_ids, |
252 | - 'number' => - 1, |
|
252 | + 'number' => -1, |
|
253 | 253 | 'status' => $allowed_payment_status, |
254 | 254 | 'meta_query' => array( |
255 | 255 | array( |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | ), |
260 | 260 | ); |
261 | 261 | |
262 | - $unattached_payments = give_get_payments( $unattached_args ); |
|
262 | + $unattached_payments = give_get_payments($unattached_args); |
|
263 | 263 | |
264 | - $payments = array_merge( $attached_payments, $unattached_payments ); |
|
264 | + $payments = array_merge($attached_payments, $unattached_payments); |
|
265 | 265 | |
266 | - $this->store_data( 'give_recount_customer_payments_' . $customer->id, $payments ); |
|
266 | + $this->store_data('give_recount_customer_payments_'.$customer->id, $payments); |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | * |
277 | 277 | * @return mixed Returns the data from the database |
278 | 278 | */ |
279 | - private function get_stored_data( $key ) { |
|
279 | + private function get_stored_data($key) { |
|
280 | 280 | global $wpdb; |
281 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
281 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
282 | 282 | |
283 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
283 | + return empty($value) ? false : maybe_unserialize($value); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | * |
294 | 294 | * @return void |
295 | 295 | */ |
296 | - private function store_data( $key, $value ) { |
|
296 | + private function store_data($key, $value) { |
|
297 | 297 | global $wpdb; |
298 | 298 | |
299 | - $value = maybe_serialize( $value ); |
|
299 | + $value = maybe_serialize($value); |
|
300 | 300 | |
301 | 301 | $data = array( |
302 | 302 | 'option_name' => $key, |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | '%s', |
311 | 311 | ); |
312 | 312 | |
313 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
313 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
@@ -322,9 +322,9 @@ discard block |
||
322 | 322 | * |
323 | 323 | * @return void |
324 | 324 | */ |
325 | - private function delete_data( $key ) { |
|
325 | + private function delete_data($key) { |
|
326 | 326 | global $wpdb; |
327 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
327 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | } |
@@ -157,7 +157,7 @@ |
||
157 | 157 | * |
158 | 158 | * @access public |
159 | 159 | * @since 1.0 |
160 | - * @return string|bool String if search is present, false otherwise |
|
160 | + * @return string|false String if search is present, false otherwise |
|
161 | 161 | */ |
162 | 162 | public function get_search() { |
163 | 163 | return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | - 'ajax' => false,// Does this table support ajax? |
|
52 | - ) ); |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | + 'ajax' => false, // Does this table support ajax? |
|
52 | + )); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - public function search_box( $text, $input_id ) { |
|
67 | - $input_id = $input_id . '-search-input'; |
|
66 | + public function search_box($text, $input_id) { |
|
67 | + $input_id = $input_id.'-search-input'; |
|
68 | 68 | |
69 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
70 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
69 | + if ( ! empty($_REQUEST['orderby'])) { |
|
70 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
71 | 71 | } |
72 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
73 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
72 | + if ( ! empty($_REQUEST['order'])) { |
|
73 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
74 | 74 | } |
75 | 75 | ?> |
76 | 76 | <p class="search-box" role="search"> |
77 | 77 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
78 | 78 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
79 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
79 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
80 | 80 | </p> |
81 | 81 | <?php |
82 | 82 | } |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function get_columns() { |
92 | 92 | $columns = array( |
93 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
94 | - 'details' => esc_html__( 'Request Details', 'give' ), |
|
95 | - 'ip' => esc_html__( 'Request IP', 'give' ), |
|
96 | - 'date' => esc_html__( 'Date', 'give' ), |
|
93 | + 'ID' => esc_html__('Log ID', 'give'), |
|
94 | + 'details' => esc_html__('Request Details', 'give'), |
|
95 | + 'ip' => esc_html__('Request IP', 'give'), |
|
96 | + 'date' => esc_html__('Date', 'give'), |
|
97 | 97 | ); |
98 | 98 | |
99 | 99 | return $columns; |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string Column Name |
112 | 112 | */ |
113 | - public function column_default( $item, $column_name ) { |
|
114 | - switch ( $column_name ) { |
|
113 | + public function column_default($item, $column_name) { |
|
114 | + switch ($column_name) { |
|
115 | 115 | default: |
116 | - return $item[ $column_name ]; |
|
116 | + return $item[$column_name]; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -127,26 +127,26 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - public function column_details( $item ) { |
|
130 | + public function column_details($item) { |
|
131 | 131 | ?> |
132 | - <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e( 'View Request', 'give' ); ?></a> |
|
132 | + <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e('View Request', 'give'); ?></a> |
|
133 | 133 | <div id="log-details-<?php echo $item['ID']; ?>" style="display:none;"> |
134 | 134 | <?php |
135 | 135 | |
136 | - $request = get_post_field( 'post_excerpt', $item['ID'] ); |
|
137 | - $error = get_post_field( 'post_content', $item['ID'] ); |
|
138 | - echo '<p><strong>' . esc_html__( 'API Request:', 'give' ) . '</strong></p>'; |
|
139 | - echo '<div>' . $request . '</div>'; |
|
140 | - if ( ! empty( $error ) ) { |
|
141 | - echo '<p><strong>' . esc_html__( 'Error', 'give' ) . '</strong></p>'; |
|
142 | - echo '<div>' . esc_html( $error ) . '</div>'; |
|
136 | + $request = get_post_field('post_excerpt', $item['ID']); |
|
137 | + $error = get_post_field('post_content', $item['ID']); |
|
138 | + echo '<p><strong>'.esc_html__('API Request:', 'give').'</strong></p>'; |
|
139 | + echo '<div>'.$request.'</div>'; |
|
140 | + if ( ! empty($error)) { |
|
141 | + echo '<p><strong>'.esc_html__('Error', 'give').'</strong></p>'; |
|
142 | + echo '<div>'.esc_html($error).'</div>'; |
|
143 | 143 | } |
144 | - echo '<p><strong>' . esc_html__( 'API User:', 'give' ) . '</strong></p>'; |
|
145 | - echo '<div>' . give_get_meta( $item['ID'], '_give_log_user', true ) . '</div>'; |
|
146 | - echo '<p><strong>' . esc_html__( 'API Key:', 'give' ) . '</strong></p>'; |
|
147 | - echo '<div>' . give_get_meta( $item['ID'], '_give_log_key', true ) . '</div>'; |
|
148 | - echo '<p><strong>' . esc_html__( 'Request Date:', 'give' ) . '</strong></p>'; |
|
149 | - echo '<div>' . get_post_field( 'post_date', $item['ID'] ) . '</div>'; |
|
144 | + echo '<p><strong>'.esc_html__('API User:', 'give').'</strong></p>'; |
|
145 | + echo '<div>'.give_get_meta($item['ID'], '_give_log_user', true).'</div>'; |
|
146 | + echo '<p><strong>'.esc_html__('API Key:', 'give').'</strong></p>'; |
|
147 | + echo '<div>'.give_get_meta($item['ID'], '_give_log_key', true).'</div>'; |
|
148 | + echo '<p><strong>'.esc_html__('Request Date:', 'give').'</strong></p>'; |
|
149 | + echo '<div>'.get_post_field('post_date', $item['ID']).'</div>'; |
|
150 | 150 | ?> |
151 | 151 | </div> |
152 | 152 | <?php |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @return string|bool String if search is present, false otherwise |
161 | 161 | */ |
162 | 162 | public function get_search() { |
163 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
163 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -176,19 +176,19 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param string $which |
178 | 178 | */ |
179 | - protected function display_tablenav( $which ) { |
|
180 | - if ( 'top' === $which ) { |
|
181 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
179 | + protected function display_tablenav($which) { |
|
180 | + if ('top' === $which) { |
|
181 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
182 | 182 | } |
183 | 183 | ?> |
184 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
184 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
185 | 185 | |
186 | 186 | <div class="alignleft actions bulkactions"> |
187 | - <?php $this->bulk_actions( $which ); ?> |
|
187 | + <?php $this->bulk_actions($which); ?> |
|
188 | 188 | </div> |
189 | 189 | <?php |
190 | - $this->extra_tablenav( $which ); |
|
191 | - $this->pagination( $which ); |
|
190 | + $this->extra_tablenav($which); |
|
191 | + $this->pagination($which); |
|
192 | 192 | ?> |
193 | 193 | |
194 | 194 | <br class="clear"/> |
@@ -210,31 +210,31 @@ discard block |
||
210 | 210 | |
211 | 211 | $search = $this->get_search(); |
212 | 212 | |
213 | - if ( $search ) { |
|
214 | - if ( filter_var( $search, FILTER_VALIDATE_IP ) ) { |
|
213 | + if ($search) { |
|
214 | + if (filter_var($search, FILTER_VALIDATE_IP)) { |
|
215 | 215 | // This is an IP address search |
216 | 216 | $key = '_give_log_request_ip'; |
217 | - } elseif ( is_email( $search ) ) { |
|
217 | + } elseif (is_email($search)) { |
|
218 | 218 | // This is an email search |
219 | - $userdata = get_user_by( 'email', $search ); |
|
219 | + $userdata = get_user_by('email', $search); |
|
220 | 220 | |
221 | - if ( $userdata ) { |
|
221 | + if ($userdata) { |
|
222 | 222 | $search = $userdata->ID; |
223 | 223 | } |
224 | 224 | |
225 | 225 | $key = '_give_log_user'; |
226 | - } elseif ( strlen( $search ) == 32 ) { |
|
226 | + } elseif (strlen($search) == 32) { |
|
227 | 227 | // Look for an API key |
228 | 228 | $key = '_give_log_key'; |
229 | - } elseif ( stristr( $search, 'token:' ) ) { |
|
229 | + } elseif (stristr($search, 'token:')) { |
|
230 | 230 | // Look for an API token |
231 | - $search = str_ireplace( 'token:', '', $search ); |
|
231 | + $search = str_ireplace('token:', '', $search); |
|
232 | 232 | $key = '_give_log_token'; |
233 | 233 | } else { |
234 | 234 | // This is (probably) a user ID search |
235 | - $userdata = get_userdata( $search ); |
|
235 | + $userdata = get_userdata($search); |
|
236 | 236 | |
237 | - if ( $userdata ) { |
|
237 | + if ($userdata) { |
|
238 | 238 | $search = $userdata->ID; |
239 | 239 | } |
240 | 240 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @return int Current page number |
261 | 261 | */ |
262 | 262 | public function get_paged() { |
263 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
263 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @since 1.0 |
271 | 271 | * @return void |
272 | 272 | */ |
273 | - function bulk_actions( $which = '' ) { |
|
273 | + function bulk_actions($which = '') { |
|
274 | 274 | give_log_views(); |
275 | 275 | } |
276 | 276 | |
@@ -293,14 +293,14 @@ discard block |
||
293 | 293 | 'meta_query' => $this->get_meta_query(), |
294 | 294 | ); |
295 | 295 | |
296 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
296 | + $logs = $give_logs->get_connected_logs($log_query); |
|
297 | 297 | |
298 | - if ( $logs ) { |
|
299 | - foreach ( $logs as $log ) { |
|
298 | + if ($logs) { |
|
299 | + foreach ($logs as $log) { |
|
300 | 300 | |
301 | 301 | $logs_data[] = array( |
302 | 302 | 'ID' => $log->ID, |
303 | - 'ip' => give_get_meta( $log->ID, '_give_log_request_ip', true ), |
|
303 | + 'ip' => give_get_meta($log->ID, '_give_log_request_ip', true), |
|
304 | 304 | 'date' => $log->post_date, |
305 | 305 | ); |
306 | 306 | } |
@@ -328,14 +328,14 @@ discard block |
||
328 | 328 | $columns = $this->get_columns(); |
329 | 329 | $hidden = array(); // No hidden columns |
330 | 330 | $sortable = $this->get_sortable_columns(); |
331 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
331 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
332 | 332 | $this->items = $this->get_logs(); |
333 | - $total_items = $give_logs->get_log_count( 0, 'api_request' ); |
|
333 | + $total_items = $give_logs->get_log_count(0, 'api_request'); |
|
334 | 334 | |
335 | - $this->set_pagination_args( array( |
|
335 | + $this->set_pagination_args(array( |
|
336 | 336 | 'total_items' => $total_items, |
337 | 337 | 'per_page' => $this->per_page, |
338 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
338 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
339 | 339 | ) |
340 | 340 | ); |
341 | 341 | } |
@@ -157,7 +157,7 @@ |
||
157 | 157 | * |
158 | 158 | * @access public |
159 | 159 | * @since 1.0 |
160 | - * @return string|bool string If search is present, false otherwise |
|
160 | + * @return string|false string If search is present, false otherwise |
|
161 | 161 | */ |
162 | 162 | public function get_search() { |
163 | 163 | return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Load WP_List_Table if not loaded |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | global $status, $page; |
45 | 45 | |
46 | 46 | // Set parent defaults |
47 | - parent::__construct( array( |
|
48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
50 | - 'ajax' => false,// Does this table support ajax? |
|
51 | - ) ); |
|
47 | + parent::__construct(array( |
|
48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
50 | + 'ajax' => false, // Does this table support ajax? |
|
51 | + )); |
|
52 | 52 | |
53 | - add_action( 'give_log_view_actions', array( $this, 'give_forms_filter' ) ); |
|
53 | + add_action('give_log_view_actions', array($this, 'give_forms_filter')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -64,39 +64,39 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string Column Name |
66 | 66 | */ |
67 | - public function column_default( $item, $column_name ) { |
|
67 | + public function column_default($item, $column_name) { |
|
68 | 68 | |
69 | - $payment = give_get_payment_by( 'id', $item['payment_id'] ); |
|
69 | + $payment = give_get_payment_by('id', $item['payment_id']); |
|
70 | 70 | |
71 | - switch ( $column_name ) { |
|
71 | + switch ($column_name) { |
|
72 | 72 | case 'form' : |
73 | - $form_title = get_the_title( $item[ $column_name ] ); |
|
74 | - $form_title = empty( $form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item[ $column_name ] ) : $form_title; |
|
75 | - return '<a href="' . esc_url( add_query_arg( 'form', $item[ $column_name ] ) ) . '" >' . $form_title . '</a>'; |
|
73 | + $form_title = get_the_title($item[$column_name]); |
|
74 | + $form_title = empty($form_title) ? sprintf(__('Untitled (#%s)', 'give'), $item[$column_name]) : $form_title; |
|
75 | + return '<a href="'.esc_url(add_query_arg('form', $item[$column_name])).'" >'.$form_title.'</a>'; |
|
76 | 76 | |
77 | 77 | case 'user_id' : |
78 | - return '<a href="' . |
|
79 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . ( ! empty( $item['user_id'] ) ? urlencode( $item['user_id'] ) : give_get_payment_user_email( $item['payment_id'] ) ) ) . |
|
80 | - '">' . $item['user_name'] . '</a>'; |
|
78 | + return '<a href="'. |
|
79 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.( ! empty($item['user_id']) ? urlencode($item['user_id']) : give_get_payment_user_email($item['payment_id']))). |
|
80 | + '">'.$item['user_name'].'</a>'; |
|
81 | 81 | |
82 | 82 | case 'amount' : |
83 | - return give_currency_filter( give_format_amount( $item['amount'] ) ); |
|
83 | + return give_currency_filter(give_format_amount($item['amount'])); |
|
84 | 84 | |
85 | 85 | case 'status' : |
86 | 86 | |
87 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
87 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
88 | 88 | |
89 | - if ( $payment->mode == 'test' ) { |
|
90 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . __( 'Test', 'give' ) . '</span>'; |
|
89 | + if ($payment->mode == 'test') { |
|
90 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.__('Test', 'give').'</span>'; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | return $value; |
94 | 94 | |
95 | 95 | case 'payment_id' : |
96 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $item['payment_id'] ) . '">' . give_get_payment_number( $item['payment_id'] ) . '</a>'; |
|
96 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$item['payment_id']).'">'.give_get_payment_number($item['payment_id']).'</a>'; |
|
97 | 97 | |
98 | 98 | default: |
99 | - return $item[ $column_name ]; |
|
99 | + return $item[$column_name]; |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function get_columns() { |
111 | 111 | $columns = array( |
112 | - 'ID' => __( 'Log ID', 'give' ), |
|
113 | - 'user_id' => __( 'Donor', 'give' ), |
|
114 | - 'form' => __( 'Form', 'give' ), |
|
115 | - 'amount' => __( 'Donation Amount', 'give' ), |
|
116 | - 'status' => __( 'Status', 'give' ), |
|
117 | - 'payment_id' => __( 'Transaction ID', 'give' ), |
|
118 | - 'date' => __( 'Date', 'give' ), |
|
112 | + 'ID' => __('Log ID', 'give'), |
|
113 | + 'user_id' => __('Donor', 'give'), |
|
114 | + 'form' => __('Form', 'give'), |
|
115 | + 'amount' => __('Donation Amount', 'give'), |
|
116 | + 'status' => __('Status', 'give'), |
|
117 | + 'payment_id' => __('Transaction ID', 'give'), |
|
118 | + 'date' => __('Date', 'give'), |
|
119 | 119 | ); |
120 | 120 | |
121 | 121 | return $columns; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @return int Current page number |
130 | 130 | */ |
131 | 131 | public function get_paged() { |
132 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
132 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return mixed int If User ID, string If Email/Login |
141 | 141 | */ |
142 | 142 | public function get_filtered_user() { |
143 | - return isset( $_GET['user'] ) ? absint( $_GET['user'] ) : false; |
|
143 | + return isset($_GET['user']) ? absint($_GET['user']) : false; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @return int Download ID |
152 | 152 | */ |
153 | 153 | public function get_filtered_give_form() { |
154 | - return ! empty( $_GET['form'] ) ? absint( $_GET['form'] ) : false; |
|
154 | + return ! empty($_GET['form']) ? absint($_GET['form']) : false; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @return string|bool string If search is present, false otherwise |
163 | 163 | */ |
164 | 164 | public function get_search() { |
165 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
165 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
@@ -178,20 +178,20 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @param string $which |
180 | 180 | */ |
181 | - protected function display_tablenav( $which ) { |
|
181 | + protected function display_tablenav($which) { |
|
182 | 182 | |
183 | - if ( 'top' === $which ) { |
|
184 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
183 | + if ('top' === $which) { |
|
184 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
185 | 185 | } |
186 | 186 | ?> |
187 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
187 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
188 | 188 | |
189 | 189 | <div class="alignleft actions bulkactions"> |
190 | - <?php $this->bulk_actions( $which ); ?> |
|
190 | + <?php $this->bulk_actions($which); ?> |
|
191 | 191 | </div> |
192 | 192 | <?php |
193 | - $this->extra_tablenav( $which ); |
|
194 | - $this->pagination( $which ); |
|
193 | + $this->extra_tablenav($which); |
|
194 | + $this->pagination($which); |
|
195 | 195 | ?> |
196 | 196 | |
197 | 197 | <br class="clear"/> |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | $meta_query = array(); |
216 | 216 | |
217 | - if ( $user ) { |
|
217 | + if ($user) { |
|
218 | 218 | // Show only logs from a specific user |
219 | 219 | $meta_query[] = array( |
220 | 220 | 'key' => '_give_log_user_id', |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | } |
224 | 224 | |
225 | 225 | $search = $this->get_search(); |
226 | - if ( $search ) { |
|
227 | - if ( is_email( $search ) ) { |
|
226 | + if ($search) { |
|
227 | + if (is_email($search)) { |
|
228 | 228 | // This is an email search. We use this to ensure it works for guest users and logged-in users |
229 | 229 | $key = '_give_log_user_info'; |
230 | 230 | $compare = 'LIKE'; |
@@ -233,32 +233,32 @@ discard block |
||
233 | 233 | $key = '_give_log_user_id'; |
234 | 234 | $compare = 'LIKE'; |
235 | 235 | |
236 | - if ( ! is_numeric( $search ) ) { |
|
236 | + if ( ! is_numeric($search)) { |
|
237 | 237 | // Searching for user by username |
238 | - $user = get_user_by( 'login', $search ); |
|
238 | + $user = get_user_by('login', $search); |
|
239 | 239 | |
240 | - if ( $user ) { |
|
240 | + if ($user) { |
|
241 | 241 | // Found one, set meta value to user's ID |
242 | 242 | $search = $user->ID; |
243 | 243 | } else { |
244 | 244 | // No user found so let's do a real search query |
245 | - $users = new WP_User_Query( array( |
|
245 | + $users = new WP_User_Query(array( |
|
246 | 246 | 'search' => $search, |
247 | - 'search_columns' => array( 'user_url', 'user_nicename' ), |
|
247 | + 'search_columns' => array('user_url', 'user_nicename'), |
|
248 | 248 | 'number' => 1, |
249 | 249 | 'fields' => 'ids', |
250 | - ) ); |
|
250 | + )); |
|
251 | 251 | |
252 | 252 | $found_user = $users->get_results(); |
253 | 253 | |
254 | - if ( $found_user ) { |
|
254 | + if ($found_user) { |
|
255 | 255 | $search = $found_user[0]; |
256 | 256 | } |
257 | 257 | } |
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
261 | - if ( ! $this->file_search ) { |
|
261 | + if ( ! $this->file_search) { |
|
262 | 262 | // Meta query only works for non file name searche |
263 | 263 | $meta_query[] = array( |
264 | 264 | 'key' => $key, |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @since 1.0 |
280 | 280 | * @return void |
281 | 281 | */ |
282 | - function bulk_actions( $which = '' ) { |
|
282 | + function bulk_actions($which = '') { |
|
283 | 283 | give_log_views(); |
284 | 284 | } |
285 | 285 | |
@@ -291,24 +291,24 @@ discard block |
||
291 | 291 | * @return void |
292 | 292 | */ |
293 | 293 | public function give_forms_filter() { |
294 | - $give_forms = get_posts( array( |
|
294 | + $give_forms = get_posts(array( |
|
295 | 295 | 'post_type' => 'give_forms', |
296 | 296 | 'post_status' => 'any', |
297 | - 'posts_per_page' => - 1, |
|
297 | + 'posts_per_page' => -1, |
|
298 | 298 | 'orderby' => 'title', |
299 | 299 | 'order' => 'ASC', |
300 | 300 | 'fields' => 'ids', |
301 | 301 | 'update_post_meta_cache' => false, |
302 | 302 | 'update_post_term_cache' => false, |
303 | - ) ); |
|
303 | + )); |
|
304 | 304 | |
305 | - if ( $give_forms ) { |
|
305 | + if ($give_forms) { |
|
306 | 306 | echo '<select name="form" id="give-log-form-filter">'; |
307 | - echo '<option value="0">' . __( 'All', 'give' ) . '</option>'; |
|
308 | - foreach ( $give_forms as $form ) { |
|
309 | - $form_title = get_the_title( $form ); |
|
310 | - $form_title = empty( $form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $form ) : $form_title; |
|
311 | - echo '<option value="' . $form . '"' . selected( $form, $this->get_filtered_give_form() ) . '>' . esc_html( $form_title ) . '</option>'; |
|
307 | + echo '<option value="0">'.__('All', 'give').'</option>'; |
|
308 | + foreach ($give_forms as $form) { |
|
309 | + $form_title = get_the_title($form); |
|
310 | + $form_title = empty($form_title) ? sprintf(__('Untitled (#%s)', 'give'), $form) : $form_title; |
|
311 | + echo '<option value="'.$form.'"'.selected($form, $this->get_filtered_give_form()).'>'.esc_html($form_title).'</option>'; |
|
312 | 312 | } |
313 | 313 | echo '</select>'; |
314 | 314 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | |
329 | 329 | $logs_data = array(); |
330 | 330 | $paged = $this->get_paged(); |
331 | - $give_form = empty( $_GET['s'] ) ? $this->get_filtered_give_form() : null; |
|
331 | + $give_form = empty($_GET['s']) ? $this->get_filtered_give_form() : null; |
|
332 | 332 | $user = $this->get_filtered_user(); |
333 | 333 | |
334 | 334 | $log_query = array( |
@@ -338,38 +338,38 @@ discard block |
||
338 | 338 | 'meta_query' => $this->get_meta_query(), |
339 | 339 | ); |
340 | 340 | |
341 | - $cache_key = Give_Cache::get_key( 'get_logs', $log_query ); |
|
341 | + $cache_key = Give_Cache::get_key('get_logs', $log_query); |
|
342 | 342 | |
343 | 343 | // Return result from cache if exist. |
344 | - if ( ! ( $logs_data = Give_Cache::get( $cache_key ) ) ) { |
|
345 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
344 | + if ( ! ($logs_data = Give_Cache::get($cache_key))) { |
|
345 | + $logs = $give_logs->get_connected_logs($log_query); |
|
346 | 346 | |
347 | - if ( $logs ) { |
|
348 | - foreach ( $logs as $log ) { |
|
349 | - $payment_id = give_get_meta( $log->ID, '_give_log_payment_id', true ); |
|
347 | + if ($logs) { |
|
348 | + foreach ($logs as $log) { |
|
349 | + $payment_id = give_get_meta($log->ID, '_give_log_payment_id', true); |
|
350 | 350 | |
351 | 351 | // Make sure this payment hasn't been deleted |
352 | - if ( get_post( $payment_id ) ) : |
|
353 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
354 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
355 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
352 | + if (get_post($payment_id)) : |
|
353 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
354 | + $payment_meta = give_get_payment_meta($payment_id); |
|
355 | + $payment_amount = give_get_payment_amount($payment_id); |
|
356 | 356 | |
357 | 357 | $logs_data[] = array( |
358 | - 'ID' => '<span class="give-item-label give-item-label-gray">' . $log->ID . '</span>', |
|
358 | + 'ID' => '<span class="give-item-label give-item-label-gray">'.$log->ID.'</span>', |
|
359 | 359 | 'payment_id' => $payment_id, |
360 | 360 | 'form' => $log->post_parent, |
361 | 361 | 'amount' => $payment_amount, |
362 | 362 | 'user_id' => $user_info['id'], |
363 | - 'user_name' => $user_info['first_name'] . ' ' . $user_info['last_name'], |
|
364 | - 'date' => get_post_field( 'post_date', $payment_id ), |
|
363 | + 'user_name' => $user_info['first_name'].' '.$user_info['last_name'], |
|
364 | + 'date' => get_post_field('post_date', $payment_id), |
|
365 | 365 | ); |
366 | 366 | |
367 | 367 | endif; |
368 | 368 | } |
369 | 369 | |
370 | 370 | // Cache results. |
371 | - if ( ! empty( $logs_data ) ) { |
|
372 | - Give_Cache::set( $cache_key, $logs_data ); |
|
371 | + if ( ! empty($logs_data)) { |
|
372 | + Give_Cache::set($cache_key, $logs_data); |
|
373 | 373 | } |
374 | 374 | } |
375 | 375 | } |
@@ -397,15 +397,15 @@ discard block |
||
397 | 397 | $columns = $this->get_columns(); |
398 | 398 | $hidden = array(); |
399 | 399 | $sortable = $this->get_sortable_columns(); |
400 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
400 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
401 | 401 | $current_page = $this->get_pagenum(); |
402 | 402 | $this->items = $this->get_logs(); |
403 | - $total_items = $give_logs->get_log_count( $this->get_filtered_give_form(), 'sale', $this->get_meta_query() ); |
|
403 | + $total_items = $give_logs->get_log_count($this->get_filtered_give_form(), 'sale', $this->get_meta_query()); |
|
404 | 404 | |
405 | - $this->set_pagination_args( array( |
|
405 | + $this->set_pagination_args(array( |
|
406 | 406 | 'total_items' => $total_items, |
407 | 407 | 'per_page' => $this->per_page, |
408 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
408 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
409 | 409 | ) |
410 | 410 | ); |
411 | 411 | } |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | */ |
41 | 41 | |
42 | 42 | // Exit if accessed directly. |
43 | -if ( ! defined( 'ABSPATH' ) ) { |
|
43 | +if ( ! defined('ABSPATH')) { |
|
44 | 44 | exit; |
45 | 45 | } |
46 | 46 | |
47 | -if ( ! class_exists( 'Give' ) ) : |
|
47 | +if ( ! class_exists('Give')) : |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Main Give Class |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | * @return Give |
196 | 196 | */ |
197 | 197 | public static function instance() { |
198 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) { |
|
198 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) { |
|
199 | 199 | self::$instance = new Give; |
200 | 200 | self::$instance->setup_constants(); |
201 | 201 | |
202 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
202 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain')); |
|
203 | 203 | |
204 | 204 | self::$instance->includes(); |
205 | 205 | self::$instance->roles = new Give_Roles(); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @since 1.8.7 |
222 | 222 | */ |
223 | - do_action( 'give_init', self::$instance ); |
|
223 | + do_action('give_init', self::$instance); |
|
224 | 224 | |
225 | 225 | } |
226 | 226 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function __clone() { |
242 | 242 | // Cloning instances of the class is forbidden |
243 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
243 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function __wakeup() { |
255 | 255 | // Unserializing instances of the class is forbidden. |
256 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
256 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -267,33 +267,33 @@ discard block |
||
267 | 267 | private function setup_constants() { |
268 | 268 | |
269 | 269 | // Plugin version |
270 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
271 | - define( 'GIVE_VERSION', '1.8.8' ); |
|
270 | + if ( ! defined('GIVE_VERSION')) { |
|
271 | + define('GIVE_VERSION', '1.8.8'); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | // Plugin Folder Path |
275 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
276 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
275 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
276 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | // Plugin Folder URL |
280 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
281 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
280 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
281 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | // Plugin Basename aka: "give/give.php" |
285 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
286 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
285 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
286 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | // Plugin Root File |
290 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
291 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
290 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
291 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | // Make sure CAL_GREGORIAN is defined |
295 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
296 | - define( 'CAL_GREGORIAN', 1 ); |
|
295 | + if ( ! defined('CAL_GREGORIAN')) { |
|
296 | + define('CAL_GREGORIAN', 1); |
|
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
@@ -308,127 +308,127 @@ discard block |
||
308 | 308 | private function includes() { |
309 | 309 | global $give_options; |
310 | 310 | |
311 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
312 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
311 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
312 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
313 | 313 | $give_options = give_get_settings(); |
314 | 314 | |
315 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
316 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php'; |
|
317 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
318 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
319 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
320 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
321 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
322 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
323 | - |
|
324 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
325 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
326 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
327 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
328 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
329 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php'; |
|
330 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
331 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
332 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
333 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
334 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
335 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
336 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
337 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
338 | - |
|
339 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
340 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
341 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
342 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
343 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
344 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
345 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
346 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
347 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
348 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
349 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
350 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
351 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
352 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
353 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
354 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
355 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
356 | - |
|
357 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
358 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
359 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
360 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
361 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
362 | - |
|
363 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
364 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
365 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
366 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
367 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
368 | - |
|
369 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
370 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
371 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
372 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
373 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
374 | - |
|
375 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
376 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
315 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
316 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php'; |
|
317 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
318 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
319 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
320 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
321 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
322 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
323 | + |
|
324 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
325 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
326 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
327 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
328 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
329 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php'; |
|
330 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
331 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
332 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
333 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
334 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
335 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
336 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
337 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
338 | + |
|
339 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
340 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
341 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
342 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
343 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
344 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
345 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
346 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
347 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
348 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
349 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
350 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
351 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
352 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
353 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
354 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
355 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
356 | + |
|
357 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
358 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
359 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
360 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
361 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
362 | + |
|
363 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
364 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
365 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
366 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
367 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
368 | + |
|
369 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
370 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
371 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
372 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
373 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
374 | + |
|
375 | + if (defined('WP_CLI') && WP_CLI) { |
|
376 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
377 | 377 | } |
378 | 378 | |
379 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
380 | - |
|
381 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
382 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
383 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
384 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
385 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
386 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
387 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
388 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
389 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
390 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
391 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
392 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
393 | - |
|
394 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
395 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
396 | - |
|
397 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
398 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
399 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
400 | - |
|
401 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
402 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
403 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
404 | - |
|
405 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php'; |
|
406 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php'; |
|
407 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php'; |
|
408 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php'; |
|
409 | - |
|
410 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
411 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
412 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
413 | - |
|
414 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php'; |
|
415 | - |
|
416 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
417 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
418 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
419 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
420 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
421 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
422 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
423 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
424 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
425 | - |
|
426 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
427 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
379 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
380 | + |
|
381 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
382 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
383 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
384 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
385 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
386 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
387 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
388 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
389 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
390 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
391 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
392 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
393 | + |
|
394 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
395 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
396 | + |
|
397 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
398 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
399 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
400 | + |
|
401 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
402 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
403 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
404 | + |
|
405 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php'; |
|
406 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php'; |
|
407 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php'; |
|
408 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php'; |
|
409 | + |
|
410 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
411 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
412 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
413 | + |
|
414 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php'; |
|
415 | + |
|
416 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
417 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
418 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
419 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
420 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
421 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
422 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
423 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
424 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
425 | + |
|
426 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
427 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
428 | 428 | |
429 | 429 | } |
430 | 430 | |
431 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
431 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
432 | 432 | |
433 | 433 | } |
434 | 434 | |
@@ -442,26 +442,26 @@ discard block |
||
442 | 442 | */ |
443 | 443 | public function load_textdomain() { |
444 | 444 | // Set filter for Give's languages directory |
445 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
446 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
445 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
446 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
447 | 447 | |
448 | 448 | // Traditional WordPress plugin locale filter |
449 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
450 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
449 | + $locale = apply_filters('plugin_locale', get_locale(), 'give'); |
|
450 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale); |
|
451 | 451 | |
452 | 452 | // Setup paths to current locale file |
453 | - $mofile_local = $give_lang_dir . $mofile; |
|
454 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
453 | + $mofile_local = $give_lang_dir.$mofile; |
|
454 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
455 | 455 | |
456 | - if ( file_exists( $mofile_global ) ) { |
|
456 | + if (file_exists($mofile_global)) { |
|
457 | 457 | // Look in global /wp-content/languages/give folder |
458 | - load_textdomain( 'give', $mofile_global ); |
|
459 | - } elseif ( file_exists( $mofile_local ) ) { |
|
458 | + load_textdomain('give', $mofile_global); |
|
459 | + } elseif (file_exists($mofile_local)) { |
|
460 | 460 | // Look in local location from filter `give_languages_directory` |
461 | - load_textdomain( 'give', $mofile_local ); |
|
461 | + load_textdomain('give', $mofile_local); |
|
462 | 462 | } else { |
463 | 463 | // Load the default language files packaged up w/ Give |
464 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
464 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
465 | 465 | } |
466 | 466 | } |
467 | 467 |
@@ -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 | |
@@ -62,50 +62,50 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return bool If the gravatar exists or not |
64 | 64 | */ |
65 | - public function validate_gravatar( $id_or_email ) { |
|
65 | + public function validate_gravatar($id_or_email) { |
|
66 | 66 | //id or email code borrowed from wp-includes/pluggable.php |
67 | 67 | $email = ''; |
68 | - if ( is_numeric( $id_or_email ) ) { |
|
68 | + if (is_numeric($id_or_email)) { |
|
69 | 69 | $id = (int) $id_or_email; |
70 | - $user = get_userdata( $id ); |
|
71 | - if ( $user ) { |
|
70 | + $user = get_userdata($id); |
|
71 | + if ($user) { |
|
72 | 72 | $email = $user->user_email; |
73 | 73 | } |
74 | - } elseif ( is_object( $id_or_email ) ) { |
|
74 | + } elseif (is_object($id_or_email)) { |
|
75 | 75 | // No avatar for pingbacks or trackbacks |
76 | - $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) ); |
|
77 | - if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) { |
|
76 | + $allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment')); |
|
77 | + if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) { |
|
78 | 78 | return false; |
79 | 79 | } |
80 | 80 | |
81 | - if ( ! empty( $id_or_email->user_id ) ) { |
|
81 | + if ( ! empty($id_or_email->user_id)) { |
|
82 | 82 | $id = (int) $id_or_email->user_id; |
83 | - $user = get_userdata( $id ); |
|
84 | - if ( $user ) { |
|
83 | + $user = get_userdata($id); |
|
84 | + if ($user) { |
|
85 | 85 | $email = $user->user_email; |
86 | 86 | } |
87 | - } elseif ( ! empty( $id_or_email->comment_author_email ) ) { |
|
87 | + } elseif ( ! empty($id_or_email->comment_author_email)) { |
|
88 | 88 | $email = $id_or_email->comment_author_email; |
89 | 89 | } |
90 | 90 | } else { |
91 | 91 | $email = $id_or_email; |
92 | 92 | } |
93 | 93 | |
94 | - $hashkey = md5( strtolower( trim( $email ) ) ); |
|
95 | - $uri = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404'; |
|
94 | + $hashkey = md5(strtolower(trim($email))); |
|
95 | + $uri = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404'; |
|
96 | 96 | |
97 | - $data = wp_cache_get( $hashkey ); |
|
98 | - if ( false === $data ) { |
|
99 | - $response = wp_remote_head( $uri ); |
|
100 | - if ( is_wp_error( $response ) ) { |
|
97 | + $data = wp_cache_get($hashkey); |
|
98 | + if (false === $data) { |
|
99 | + $response = wp_remote_head($uri); |
|
100 | + if (is_wp_error($response)) { |
|
101 | 101 | $data = 'not200'; |
102 | 102 | } else { |
103 | 103 | $data = $response['response']['code']; |
104 | 104 | } |
105 | - wp_cache_set( $hashkey, $data, $group = '', $expire = 60 * 5 ); |
|
105 | + wp_cache_set($hashkey, $data, $group = '', $expire = 60 * 5); |
|
106 | 106 | |
107 | 107 | } |
108 | - if ( $data == '200' ) { |
|
108 | + if ($data == '200') { |
|
109 | 109 | return true; |
110 | 110 | } else { |
111 | 111 | return false; |
@@ -122,19 +122,19 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @return array IDs if logs, false otherwise |
124 | 124 | */ |
125 | - public function get_log_ids( $form_id = '' ) { |
|
125 | + public function get_log_ids($form_id = '') { |
|
126 | 126 | |
127 | 127 | // get Give_Logging class |
128 | 128 | global $give_logs; |
129 | 129 | |
130 | 130 | // get log for this form |
131 | - $logs = $give_logs->get_logs( $form_id ); |
|
131 | + $logs = $give_logs->get_logs($form_id); |
|
132 | 132 | |
133 | - if ( $logs ) { |
|
133 | + if ($logs) { |
|
134 | 134 | $log_ids = array(); |
135 | 135 | |
136 | 136 | // make an array with all the donor IDs |
137 | - foreach ( $logs as $log ) { |
|
137 | + foreach ($logs as $log) { |
|
138 | 138 | $log_ids[] = $log->ID; |
139 | 139 | } |
140 | 140 | |
@@ -155,51 +155,51 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return mixed |
157 | 157 | */ |
158 | - public function get_payment_ids( $form_id = '' ) { |
|
158 | + public function get_payment_ids($form_id = '') { |
|
159 | 159 | |
160 | 160 | $give_options = give_get_settings(); |
161 | 161 | |
162 | - $log_ids = $this->get_log_ids( $form_id ); |
|
162 | + $log_ids = $this->get_log_ids($form_id); |
|
163 | 163 | |
164 | - if ( $log_ids ) { |
|
164 | + if ($log_ids) { |
|
165 | 165 | |
166 | 166 | $payment_ids = array(); |
167 | 167 | |
168 | - foreach ( $log_ids as $id ) { |
|
168 | + foreach ($log_ids as $id) { |
|
169 | 169 | // get the payment ID for each corresponding log ID |
170 | - $payment_ids[] = give_get_meta( $id, '_give_log_payment_id', true ); |
|
170 | + $payment_ids[] = give_get_meta($id, '_give_log_payment_id', true); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | // remove donors who have donated more than once so we can have unique avatars |
174 | 174 | $unique_emails = array(); |
175 | 175 | |
176 | - foreach ( $payment_ids as $key => $id ) { |
|
176 | + foreach ($payment_ids as $key => $id) { |
|
177 | 177 | |
178 | - $email = give_get_meta( $id, '_give_payment_user_email', true ); |
|
178 | + $email = give_get_meta($id, '_give_payment_user_email', true); |
|
179 | 179 | |
180 | - if ( isset ( $give_options['give_donors_gravatars_has_gravatar_account'] ) ) { |
|
181 | - if ( ! $this->validate_gravatar( $email ) ) { |
|
180 | + if (isset ($give_options['give_donors_gravatars_has_gravatar_account'])) { |
|
181 | + if ( ! $this->validate_gravatar($email)) { |
|
182 | 182 | continue; |
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
186 | - $unique_emails[ $id ] = give_get_meta( $id, '_give_payment_user_email', true ); |
|
186 | + $unique_emails[$id] = give_get_meta($id, '_give_payment_user_email', true); |
|
187 | 187 | |
188 | 188 | } |
189 | 189 | |
190 | 190 | $unique_ids = array(); |
191 | 191 | |
192 | 192 | // strip duplicate emails |
193 | - $unique_emails = array_unique( $unique_emails ); |
|
193 | + $unique_emails = array_unique($unique_emails); |
|
194 | 194 | |
195 | 195 | // convert the unique IDs back into simple array |
196 | - foreach ( $unique_emails as $id => $email ) { |
|
196 | + foreach ($unique_emails as $id => $email) { |
|
197 | 197 | $unique_ids[] = $id; |
198 | 198 | } |
199 | 199 | |
200 | 200 | // randomize the payment IDs if enabled |
201 | - if ( isset( $give_options['give_donors_gravatars_random_gravatars'] ) ) { |
|
202 | - shuffle( $unique_ids ); |
|
201 | + if (isset($give_options['give_donors_gravatars_random_gravatars'])) { |
|
202 | + shuffle($unique_ids); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | // return our unique IDs |
@@ -220,22 +220,22 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @return string |
222 | 222 | */ |
223 | - public function gravatars( $form_id = false, $title = '' ) { |
|
223 | + public function gravatars($form_id = false, $title = '') { |
|
224 | 224 | |
225 | 225 | // unique $payment_ids |
226 | - $payment_ids = $this->get_payment_ids( $form_id ); |
|
226 | + $payment_ids = $this->get_payment_ids($form_id); |
|
227 | 227 | |
228 | 228 | $give_options = give_get_settings(); |
229 | 229 | |
230 | 230 | // return if no ID |
231 | - if ( ! $form_id ) { |
|
231 | + if ( ! $form_id) { |
|
232 | 232 | return; |
233 | 233 | } |
234 | 234 | |
235 | 235 | // minimum amount of donations before showing gravatars |
236 | 236 | // if the number of items in array is not greater or equal to the number specified, then exit |
237 | - if ( isset( $give_options['give_donors_gravatars_min_purchases_required'] ) && '' != $give_options['give_donors_gravatars_min_purchases_required'] ) { |
|
238 | - if ( ! ( count( $payment_ids ) >= $give_options['give_donors_gravatars_min_purchases_required'] ) ) { |
|
237 | + if (isset($give_options['give_donors_gravatars_min_purchases_required']) && '' != $give_options['give_donors_gravatars_min_purchases_required']) { |
|
238 | + if ( ! (count($payment_ids) >= $give_options['give_donors_gravatars_min_purchases_required'])) { |
|
239 | 239 | return; |
240 | 240 | } |
241 | 241 | } |
@@ -246,51 +246,51 @@ discard block |
||
246 | 246 | echo '<div id="give-purchase-gravatars">'; |
247 | 247 | |
248 | 248 | |
249 | - if ( isset ( $title ) ) { |
|
249 | + if (isset ($title)) { |
|
250 | 250 | |
251 | - if ( $title ) { |
|
252 | - echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $title ) . '</h3>' ); |
|
253 | - } elseif ( isset( $give_options['give_donors_gravatars_heading'] ) ) { |
|
254 | - echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $give_options['give_donors_gravatars_heading'] ) . '</h2>' ); |
|
251 | + if ($title) { |
|
252 | + echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($title).'</h3>'); |
|
253 | + } elseif (isset($give_options['give_donors_gravatars_heading'])) { |
|
254 | + echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($give_options['give_donors_gravatars_heading']).'</h2>'); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | } |
258 | 258 | echo '<ul class="give-purchase-gravatars-list">'; |
259 | 259 | $i = 0; |
260 | 260 | |
261 | - if ( $payment_ids ) { |
|
262 | - foreach ( $payment_ids as $id ) { |
|
261 | + if ($payment_ids) { |
|
262 | + foreach ($payment_ids as $id) { |
|
263 | 263 | |
264 | 264 | // Give saves a blank option even when the control is turned off, hence the extra check |
265 | - if ( isset( $give_options['give_donors_gravatars_maximum_number'] ) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number'] ) { |
|
265 | + if (isset($give_options['give_donors_gravatars_maximum_number']) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number']) { |
|
266 | 266 | continue; |
267 | 267 | } |
268 | 268 | |
269 | 269 | // get the payment meta |
270 | - $payment_meta = give_get_meta( $id, '_give_payment_meta', true ); |
|
270 | + $payment_meta = give_get_meta($id, '_give_payment_meta', true); |
|
271 | 271 | |
272 | 272 | // unserialize the payment meta |
273 | - $user_info = maybe_unserialize( $payment_meta['user_info'] ); |
|
273 | + $user_info = maybe_unserialize($payment_meta['user_info']); |
|
274 | 274 | |
275 | 275 | // get donor's first name |
276 | 276 | $name = $user_info['first_name']; |
277 | 277 | |
278 | 278 | // get donor's email |
279 | - $email = give_get_meta( $id, '_give_payment_user_email', true ); |
|
279 | + $email = give_get_meta($id, '_give_payment_user_email', true); |
|
280 | 280 | |
281 | 281 | // set gravatar size and provide filter |
282 | - $size = isset( $give_options['give_donors_gravatars_gravatar_size'] ) ? apply_filters( 'give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size'] ) : ''; |
|
282 | + $size = isset($give_options['give_donors_gravatars_gravatar_size']) ? apply_filters('give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size']) : ''; |
|
283 | 283 | |
284 | 284 | // default image |
285 | - $default_image = apply_filters( 'give_donors_gravatars_gravatar_default_image', false ); |
|
285 | + $default_image = apply_filters('give_donors_gravatars_gravatar_default_image', false); |
|
286 | 286 | |
287 | 287 | // assemble output |
288 | 288 | $output .= '<li>'; |
289 | 289 | |
290 | - $output .= get_avatar( $email, $size, $default_image, $name ); |
|
290 | + $output .= get_avatar($email, $size, $default_image, $name); |
|
291 | 291 | $output .= '</li>'; |
292 | 292 | |
293 | - $i ++; |
|
293 | + $i++; |
|
294 | 294 | |
295 | 295 | } // end foreach |
296 | 296 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | echo '</ul>'; |
300 | 300 | echo '</div>'; |
301 | 301 | |
302 | - return apply_filters( 'give_donors_gravatars', ob_get_clean() ); |
|
302 | + return apply_filters('give_donors_gravatars', ob_get_clean()); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | /** |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | * @return void |
312 | 312 | */ |
313 | 313 | public function register_widget() { |
314 | - register_widget( 'Give_Donors_Gravatars_Widget' ); |
|
314 | + register_widget('Give_Donors_Gravatars_Widget'); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -325,19 +325,19 @@ discard block |
||
325 | 325 | * |
326 | 326 | * @return string |
327 | 327 | */ |
328 | - public function shortcode( $atts, $content = null ) { |
|
328 | + public function shortcode($atts, $content = null) { |
|
329 | 329 | |
330 | - $atts = shortcode_atts( array( |
|
330 | + $atts = shortcode_atts(array( |
|
331 | 331 | 'id' => '', |
332 | 332 | 'title' => '' |
333 | - ), $atts, 'give_donors_gravatars' ); |
|
333 | + ), $atts, 'give_donors_gravatars'); |
|
334 | 334 | |
335 | 335 | // if no ID is passed on single give_forms pages, get the correct ID |
336 | - if ( is_singular( 'give_forms' ) ) { |
|
336 | + if (is_singular('give_forms')) { |
|
337 | 337 | $id = get_the_ID(); |
338 | 338 | } |
339 | 339 | |
340 | - $content = $this->gravatars( $atts['id'], $atts['title'] ); |
|
340 | + $content = $this->gravatars($atts['id'], $atts['title']); |
|
341 | 341 | |
342 | 342 | return $content; |
343 | 343 | |
@@ -353,56 +353,56 @@ discard block |
||
353 | 353 | * |
354 | 354 | * @return array Gravatar settings. |
355 | 355 | */ |
356 | - public function settings( $settings ) { |
|
356 | + public function settings($settings) { |
|
357 | 357 | |
358 | 358 | $give_gravatar_settings = array( |
359 | 359 | array( |
360 | - 'name' => esc_html__( 'Donator Gravatars', 'give' ), |
|
360 | + 'name' => esc_html__('Donator Gravatars', 'give'), |
|
361 | 361 | 'desc' => '<hr>', |
362 | 362 | 'id' => 'give_title', |
363 | 363 | 'type' => 'give_title' |
364 | 364 | ), |
365 | 365 | array( |
366 | - 'name' => esc_html__( 'Heading', 'give' ), |
|
367 | - 'desc' => esc_html__( 'The heading to display above the Gravatars.', 'give' ), |
|
366 | + 'name' => esc_html__('Heading', 'give'), |
|
367 | + 'desc' => esc_html__('The heading to display above the Gravatars.', 'give'), |
|
368 | 368 | 'type' => 'text', |
369 | 369 | 'id' => 'give_donors_gravatars_heading' |
370 | 370 | ), |
371 | 371 | array( |
372 | - 'name' => esc_html__( 'Gravatar Size', 'give' ), |
|
373 | - 'desc' => esc_html__( 'The size of each Gravatar in pixels (512px maximum).', 'give' ), |
|
372 | + 'name' => esc_html__('Gravatar Size', 'give'), |
|
373 | + 'desc' => esc_html__('The size of each Gravatar in pixels (512px maximum).', 'give'), |
|
374 | 374 | 'type' => 'text_small', |
375 | 375 | 'id' => 'give_donors_gravatars_gravatar_size', |
376 | 376 | 'default' => '64' |
377 | 377 | ), |
378 | 378 | array( |
379 | - 'name' => esc_html__( 'Minimum Unique Donations Required', 'give' ), |
|
380 | - 'desc' => esc_html__( 'The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ), |
|
379 | + 'name' => esc_html__('Minimum Unique Donations Required', 'give'), |
|
380 | + 'desc' => esc_html__('The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give'), |
|
381 | 381 | 'type' => 'text_small', |
382 | 382 | 'id' => 'give_donors_gravatars_min_purchases_required', |
383 | 383 | ), |
384 | 384 | array( |
385 | - 'name' => esc_html__( 'Maximum Gravatars To Show', 'give' ), |
|
386 | - 'desc' => esc_html__( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ), |
|
385 | + 'name' => esc_html__('Maximum Gravatars To Show', 'give'), |
|
386 | + 'desc' => esc_html__('The maximum number of gravatars to show. Leave blank for no limit.', 'give'), |
|
387 | 387 | 'type' => 'text', |
388 | 388 | 'id' => 'give_donors_gravatars_maximum_number', |
389 | 389 | 'default' => '20', |
390 | 390 | ), |
391 | 391 | array( |
392 | - 'name' => esc_html__( 'Gravatar Visibility', 'give' ), |
|
393 | - 'desc' => esc_html__( 'Show only donors with a Gravatar account.', 'give' ), |
|
392 | + 'name' => esc_html__('Gravatar Visibility', 'give'), |
|
393 | + 'desc' => esc_html__('Show only donors with a Gravatar account.', 'give'), |
|
394 | 394 | 'id' => 'give_donors_gravatars_has_gravatar_account', |
395 | 395 | 'type' => 'checkbox', |
396 | 396 | ), |
397 | 397 | array( |
398 | - 'name' => esc_html__( 'Randomize Gravatars', 'give' ), |
|
399 | - 'desc' => esc_html__( 'Randomize the Gravatars.', 'give' ), |
|
398 | + 'name' => esc_html__('Randomize Gravatars', 'give'), |
|
399 | + 'desc' => esc_html__('Randomize the Gravatars.', 'give'), |
|
400 | 400 | 'id' => 'give_donors_gravatars_random_gravatars', |
401 | 401 | 'type' => 'checkbox', |
402 | 402 | ), |
403 | 403 | ); |
404 | 404 | |
405 | - return array_merge( $settings, $give_gravatar_settings ); |
|
405 | + return array_merge($settings, $give_gravatar_settings); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | } |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | // widget settings |
429 | 429 | $widget_ops = array( |
430 | 430 | 'classname' => 'give-donors-gravatars', |
431 | - 'description' => esc_html__( 'Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give' ), |
|
431 | + 'description' => esc_html__('Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give'), |
|
432 | 432 | ); |
433 | 433 | |
434 | 434 | // widget control settings |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | // create the widget |
442 | 442 | parent::__construct( |
443 | 443 | 'give_donors_gravatars_widget', |
444 | - esc_html__( 'Give Donors Gravatars', 'give' ), |
|
444 | + esc_html__('Give Donors Gravatars', 'give'), |
|
445 | 445 | $widget_ops, |
446 | 446 | $control_ops |
447 | 447 | ); |
@@ -461,29 +461,29 @@ discard block |
||
461 | 461 | * |
462 | 462 | * @return void |
463 | 463 | */ |
464 | - public function widget( $args, $instance ) { |
|
464 | + public function widget($args, $instance) { |
|
465 | 465 | |
466 | 466 | //@TODO: Don't extract it!!! |
467 | - extract( $args ); |
|
467 | + extract($args); |
|
468 | 468 | |
469 | - if ( ! is_singular( 'give_forms' ) ) { |
|
469 | + if ( ! is_singular('give_forms')) { |
|
470 | 470 | return; |
471 | 471 | } |
472 | 472 | |
473 | 473 | // Variables from widget settings |
474 | - $title = apply_filters( 'widget_title', $instance['title'] ); |
|
474 | + $title = apply_filters('widget_title', $instance['title']); |
|
475 | 475 | |
476 | 476 | // Used by themes. Opens the widget |
477 | 477 | echo $before_widget; |
478 | 478 | |
479 | 479 | // Display the widget title |
480 | - if ( $title ) { |
|
481 | - echo $before_title . $title . $after_title; |
|
480 | + if ($title) { |
|
481 | + echo $before_title.$title.$after_title; |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | $gravatars = new Give_Donors_Gravatars(); |
485 | 485 | |
486 | - echo $gravatars->gravatars( get_the_ID(), null ); // remove title |
|
486 | + echo $gravatars->gravatars(get_the_ID(), null); // remove title |
|
487 | 487 | |
488 | 488 | // Used by themes. Closes the widget |
489 | 489 | echo $after_widget; |
@@ -503,11 +503,11 @@ discard block |
||
503 | 503 | * |
504 | 504 | * @return array Updated settings to save. |
505 | 505 | */ |
506 | - public function update( $new_instance, $old_instance ) { |
|
506 | + public function update($new_instance, $old_instance) { |
|
507 | 507 | |
508 | 508 | $instance = $old_instance; |
509 | 509 | |
510 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
510 | + $instance['title'] = strip_tags($new_instance['title']); |
|
511 | 511 | |
512 | 512 | return $instance; |
513 | 513 | |
@@ -525,19 +525,19 @@ discard block |
||
525 | 525 | * |
526 | 526 | * @return void |
527 | 527 | */ |
528 | - public function form( $instance ) { |
|
528 | + public function form($instance) { |
|
529 | 529 | |
530 | 530 | // Set up some default widget settings. |
531 | 531 | $defaults = array( |
532 | 532 | 'title' => '', |
533 | 533 | ); |
534 | 534 | |
535 | - $instance = wp_parse_args( (array) $instance, $defaults ); ?> |
|
535 | + $instance = wp_parse_args((array) $instance, $defaults); ?> |
|
536 | 536 | |
537 | 537 | <!-- Title --> |
538 | 538 | <p> |
539 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ) ?></label> |
|
540 | - <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" /> |
|
539 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give') ?></label> |
|
540 | + <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" /> |
|
541 | 541 | </p> |
542 | 542 | |
543 | 543 | <?php |