@@ -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,11 +62,11 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @since 1.0 |
64 | 64 | */ |
65 | - public function __construct( $shortcode ) { |
|
65 | + public function __construct($shortcode) { |
|
66 | 66 | |
67 | 67 | $this->shortcode_tag = $shortcode; |
68 | 68 | |
69 | - add_action( 'admin_init', array( $this, 'init' ) ); |
|
69 | + add_action('admin_init', array($this, 'init')); |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function init() { |
79 | 79 | |
80 | - if ( $this->shortcode_tag ) { |
|
80 | + if ($this->shortcode_tag) { |
|
81 | 81 | |
82 | - $this->self = get_class( $this ); |
|
82 | + $this->self = get_class($this); |
|
83 | 83 | |
84 | 84 | $this->errors = array(); |
85 | 85 | $this->required = array(); |
@@ -88,18 +88,18 @@ discard block |
||
88 | 88 | $fields = $this->get_fields(); |
89 | 89 | |
90 | 90 | $defaults = array( |
91 | - 'btn_close' => esc_html__( 'Close', 'give' ), |
|
92 | - 'btn_okay' => esc_html__( 'Insert Shortcode', 'give' ), |
|
91 | + 'btn_close' => esc_html__('Close', 'give'), |
|
92 | + 'btn_okay' => esc_html__('Insert Shortcode', 'give'), |
|
93 | 93 | 'errors' => $this->errors, |
94 | 94 | 'fields' => $fields, |
95 | - 'label' => '[' . $this->shortcode_tag . ']', |
|
95 | + 'label' => '['.$this->shortcode_tag.']', |
|
96 | 96 | 'required' => $this->required, |
97 | - 'title' => esc_html__( 'Insert Shortcode', 'give' ), |
|
97 | + 'title' => esc_html__('Insert Shortcode', 'give'), |
|
98 | 98 | ); |
99 | 99 | |
100 | - if ( user_can_richedit() ) { |
|
100 | + if (user_can_richedit()) { |
|
101 | 101 | |
102 | - Give_Shortcode_Button::$shortcodes[ $this->shortcode_tag ] = wp_parse_args( $this->shortcode, $defaults ); |
|
102 | + Give_Shortcode_Button::$shortcodes[$this->shortcode_tag] = wp_parse_args($this->shortcode, $defaults); |
|
103 | 103 | |
104 | 104 | } |
105 | 105 | } |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @since 1.0 |
130 | 130 | */ |
131 | - protected function generate_fields( $defined_fields ) { |
|
131 | + protected function generate_fields($defined_fields) { |
|
132 | 132 | |
133 | 133 | $fields = array(); |
134 | 134 | |
135 | - if ( is_array( $defined_fields ) ) { |
|
135 | + if (is_array($defined_fields)) { |
|
136 | 136 | |
137 | - foreach ( $defined_fields as $field ) { |
|
137 | + foreach ($defined_fields as $field) { |
|
138 | 138 | |
139 | 139 | $defaults = array( |
140 | 140 | 'label' => false, |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | 'type' => '', |
146 | 146 | ); |
147 | 147 | |
148 | - $field = wp_parse_args( (array) $field, $defaults ); |
|
149 | - $method = 'generate_' . strtolower( $field['type'] ); |
|
148 | + $field = wp_parse_args((array) $field, $defaults); |
|
149 | + $method = 'generate_'.strtolower($field['type']); |
|
150 | 150 | |
151 | - if ( method_exists( $this, $method ) ) { |
|
151 | + if (method_exists($this, $method)) { |
|
152 | 152 | |
153 | - $field = call_user_func( array( $this, $method ), $field ); |
|
153 | + $field = call_user_func(array($this, $method), $field); |
|
154 | 154 | |
155 | - if ( $field ) { |
|
155 | + if ($field) { |
|
156 | 156 | $fields[] = $field; |
157 | 157 | } |
158 | 158 | } |
@@ -172,23 +172,23 @@ discard block |
||
172 | 172 | protected function get_fields() { |
173 | 173 | |
174 | 174 | $defined_fields = $this->define_fields(); |
175 | - $generated_fields = $this->generate_fields( $defined_fields ); |
|
175 | + $generated_fields = $this->generate_fields($defined_fields); |
|
176 | 176 | |
177 | 177 | $errors = array(); |
178 | 178 | |
179 | - if ( ! empty( $this->errors ) ) { |
|
180 | - foreach ( $this->required as $name => $alert ) { |
|
179 | + if ( ! empty($this->errors)) { |
|
180 | + foreach ($this->required as $name => $alert) { |
|
181 | 181 | // Using WordPress function in place of array_column wp_list_pluck as it support older version as well. |
182 | - if ( false === array_search( $name, give_list_pluck( $generated_fields, 'name' ) ) ) { |
|
182 | + if (false === array_search($name, give_list_pluck($generated_fields, 'name'))) { |
|
183 | 183 | |
184 | - $errors[] = $this->errors[ $name ]; |
|
184 | + $errors[] = $this->errors[$name]; |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | 188 | $this->errors = $errors; |
189 | 189 | } |
190 | 190 | |
191 | - if ( ! empty( $errors ) ) { |
|
191 | + if ( ! empty($errors)) { |
|
192 | 192 | |
193 | 193 | return $errors; |
194 | 194 | } |
@@ -205,9 +205,9 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @since 1.0 |
207 | 207 | */ |
208 | - protected function generate_container( $field ) { |
|
208 | + protected function generate_container($field) { |
|
209 | 209 | |
210 | - if ( array_key_exists( 'html', $field ) ) { |
|
210 | + if (array_key_exists('html', $field)) { |
|
211 | 211 | |
212 | 212 | return array( |
213 | 213 | 'type' => $field['type'], |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @since 1.0 |
229 | 229 | */ |
230 | - protected function generate_listbox( $field ) { |
|
230 | + protected function generate_listbox($field) { |
|
231 | 231 | |
232 | - $listbox = shortcode_atts( array( |
|
232 | + $listbox = shortcode_atts(array( |
|
233 | 233 | 'label' => '', |
234 | 234 | 'minWidth' => '', |
235 | 235 | 'name' => false, |
@@ -237,27 +237,27 @@ discard block |
||
237 | 237 | 'type' => '', |
238 | 238 | 'value' => '', |
239 | 239 | 'classes' => '' |
240 | - ), $field ); |
|
240 | + ), $field); |
|
241 | 241 | |
242 | - if ( $this->validate( $field ) ) { |
|
242 | + if ($this->validate($field)) { |
|
243 | 243 | |
244 | 244 | $new_listbox = array(); |
245 | 245 | |
246 | - foreach ( $listbox as $key => $value ) { |
|
246 | + foreach ($listbox as $key => $value) { |
|
247 | 247 | |
248 | - if ( $key == 'value' && empty( $value ) ) { |
|
249 | - $new_listbox[ $key ] = $listbox['name']; |
|
250 | - } else if ( $value ) { |
|
251 | - $new_listbox[ $key ] = $value; |
|
248 | + if ($key == 'value' && empty($value)) { |
|
249 | + $new_listbox[$key] = $listbox['name']; |
|
250 | + } else if ($value) { |
|
251 | + $new_listbox[$key] = $value; |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | 255 | // do not reindex array! |
256 | 256 | $field['options'] = array( |
257 | - '' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ), |
|
257 | + '' => ($field['placeholder'] ? $field['placeholder'] : esc_attr__('- Select -', 'give')), |
|
258 | 258 | ) + $field['options']; |
259 | 259 | |
260 | - foreach ( $field['options'] as $value => $text ) { |
|
260 | + foreach ($field['options'] as $value => $text) { |
|
261 | 261 | $new_listbox['values'][] = array( |
262 | 262 | 'text' => $text, |
263 | 263 | 'value' => $value, |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @since 1.0 |
281 | 281 | */ |
282 | - protected function generate_post( $field ) { |
|
282 | + protected function generate_post($field) { |
|
283 | 283 | |
284 | 284 | $args = array( |
285 | 285 | 'post_type' => 'post', |
@@ -289,26 +289,26 @@ discard block |
||
289 | 289 | 'suppress_filters' => false, |
290 | 290 | ); |
291 | 291 | |
292 | - $args = wp_parse_args( (array) $field['query_args'], $args ); |
|
292 | + $args = wp_parse_args((array) $field['query_args'], $args); |
|
293 | 293 | |
294 | - $posts = get_posts( $args ); |
|
294 | + $posts = get_posts($args); |
|
295 | 295 | $options = array(); |
296 | 296 | |
297 | - if ( ! empty( $posts ) ) { |
|
298 | - foreach ( $posts as $post ) { |
|
299 | - $options[ absint( $post->ID ) ] = empty( $post->post_title ) |
|
300 | - ? sprintf( __( 'Untitled (#%s)', 'give' ), $post->ID ) |
|
301 | - : apply_filters( 'the_title', $post->post_title ); |
|
297 | + if ( ! empty($posts)) { |
|
298 | + foreach ($posts as $post) { |
|
299 | + $options[absint($post->ID)] = empty($post->post_title) |
|
300 | + ? sprintf(__('Untitled (#%s)', 'give'), $post->ID) |
|
301 | + : apply_filters('the_title', $post->post_title); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | $field['type'] = 'listbox'; |
305 | 305 | $field['options'] = $options; |
306 | 306 | |
307 | - return $this->generate_listbox( $field ); |
|
307 | + return $this->generate_listbox($field); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | // perform validation here before returning false |
311 | - $this->validate( $field ); |
|
311 | + $this->validate($field); |
|
312 | 312 | |
313 | 313 | return false; |
314 | 314 | } |
@@ -322,9 +322,9 @@ discard block |
||
322 | 322 | * |
323 | 323 | * @since 1.0 |
324 | 324 | */ |
325 | - protected function generate_textbox( $field ) { |
|
325 | + protected function generate_textbox($field) { |
|
326 | 326 | |
327 | - $textbox = shortcode_atts( array( |
|
327 | + $textbox = shortcode_atts(array( |
|
328 | 328 | 'label' => '', |
329 | 329 | 'maxLength' => '', |
330 | 330 | 'minHeight' => '', |
@@ -336,15 +336,15 @@ discard block |
||
336 | 336 | 'value' => '', |
337 | 337 | 'classes' => '', |
338 | 338 | 'placeholder' => '' |
339 | - ), $field ); |
|
339 | + ), $field); |
|
340 | 340 | |
341 | 341 | // Remove empty placeholder. |
342 | - if( empty( $textbox['placeholder'] ) ) { |
|
343 | - unset( $textbox['placeholder'] ); |
|
342 | + if (empty($textbox['placeholder'])) { |
|
343 | + unset($textbox['placeholder']); |
|
344 | 344 | } |
345 | 345 | |
346 | - if ( $this->validate( $field ) ) { |
|
347 | - return array_filter( $textbox, array( $this, 'return_textbox_value' ) ); |
|
346 | + if ($this->validate($field)) { |
|
347 | + return array_filter($textbox, array($this, 'return_textbox_value')); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | return false; |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | * |
358 | 358 | * @return bool |
359 | 359 | */ |
360 | - function return_textbox_value( $value ) { |
|
360 | + function return_textbox_value($value) { |
|
361 | 361 | return $value !== ''; |
362 | 362 | } |
363 | 363 | |
@@ -373,9 +373,9 @@ discard block |
||
373 | 373 | * |
374 | 374 | * @since 1.0 |
375 | 375 | */ |
376 | - protected function validate( $field ) { |
|
376 | + protected function validate($field) { |
|
377 | 377 | |
378 | - extract( shortcode_atts( |
|
378 | + extract(shortcode_atts( |
|
379 | 379 | array( |
380 | 380 | 'name' => false, |
381 | 381 | 'required' => false, |
@@ -383,36 +383,36 @@ discard block |
||
383 | 383 | ), $field ) |
384 | 384 | ); |
385 | 385 | |
386 | - if ( $name ) { |
|
386 | + if ($name) { |
|
387 | 387 | |
388 | - if ( isset( $required['error'] ) ) { |
|
388 | + if (isset($required['error'])) { |
|
389 | 389 | |
390 | 390 | $error = array( |
391 | 391 | 'type' => 'container', |
392 | 392 | 'html' => $required['error'], |
393 | 393 | ); |
394 | 394 | |
395 | - $this->errors[ $name ] = $this->generate_container( $error ); |
|
395 | + $this->errors[$name] = $this->generate_container($error); |
|
396 | 396 | } |
397 | 397 | |
398 | - if ( ! ! $required || is_array( $required ) ) { |
|
398 | + if ( ! ! $required || is_array($required)) { |
|
399 | 399 | |
400 | - $alert = esc_html__( 'Some of the shortcode options are required.', 'give' ); |
|
400 | + $alert = esc_html__('Some of the shortcode options are required.', 'give'); |
|
401 | 401 | |
402 | - if ( isset( $required['alert'] ) ) { |
|
402 | + if (isset($required['alert'])) { |
|
403 | 403 | |
404 | 404 | $alert = $required['alert']; |
405 | 405 | |
406 | - } else if ( ! empty( $label ) ) { |
|
406 | + } else if ( ! empty($label)) { |
|
407 | 407 | |
408 | 408 | $alert = sprintf( |
409 | 409 | /* translators: %s: option label */ |
410 | - esc_html__( 'The "%s" option is required.', 'give' ), |
|
411 | - str_replace( ':', '', $label ) |
|
410 | + esc_html__('The "%s" option is required.', 'give'), |
|
411 | + str_replace(':', '', $label) |
|
412 | 412 | ); |
413 | 413 | } |
414 | 414 | |
415 | - $this->required[ $name ] = $alert; |
|
415 | + $this->required[$name] = $alert; |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | return true; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,19 +23,19 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array An array of updated action links. |
25 | 25 | */ |
26 | -function give_plugin_action_links( $actions ) { |
|
26 | +function give_plugin_action_links($actions) { |
|
27 | 27 | $new_actions = array( |
28 | 28 | 'settings' => sprintf( |
29 | 29 | '<a href="%1$s">%2$s</a>', |
30 | - admin_url( 'edit.php?post_type=give_forms&page=give-settings' ), |
|
31 | - __( 'Settings', 'give' ) |
|
30 | + admin_url('edit.php?post_type=give_forms&page=give-settings'), |
|
31 | + __('Settings', 'give') |
|
32 | 32 | ), |
33 | 33 | ); |
34 | 34 | |
35 | - return array_merge( $new_actions, $actions ); |
|
35 | + return array_merge($new_actions, $actions); |
|
36 | 36 | } |
37 | 37 | |
38 | -add_filter( 'plugin_action_links_' . GIVE_PLUGIN_BASENAME, 'give_plugin_action_links' ); |
|
38 | +add_filter('plugin_action_links_'.GIVE_PLUGIN_BASENAME, 'give_plugin_action_links'); |
|
39 | 39 | |
40 | 40 | |
41 | 41 | /** |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return array |
50 | 50 | */ |
51 | -function give_plugin_row_meta( $plugin_meta, $plugin_file ) { |
|
52 | - if ( GIVE_PLUGIN_BASENAME !== $plugin_file ) { |
|
51 | +function give_plugin_row_meta($plugin_meta, $plugin_file) { |
|
52 | + if (GIVE_PLUGIN_BASENAME !== $plugin_file) { |
|
53 | 53 | return $plugin_meta; |
54 | 54 | } |
55 | 55 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ), 'https://givewp.com/documentation/' |
66 | 66 | ) |
67 | 67 | ), |
68 | - __( 'Documentation', 'give' ) |
|
68 | + __('Documentation', 'give') |
|
69 | 69 | ), |
70 | 70 | sprintf( |
71 | 71 | '<a href="%1$s" target="_blank">%2$s</a>', |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | ), 'https://givewp.com/addons/' |
79 | 79 | ) |
80 | 80 | ), |
81 | - __( 'Add-ons', 'give' ) |
|
81 | + __('Add-ons', 'give') |
|
82 | 82 | ), |
83 | 83 | ); |
84 | 84 | |
85 | - return array_merge( $plugin_meta, $new_meta_links ); |
|
85 | + return array_merge($plugin_meta, $new_meta_links); |
|
86 | 86 | } |
87 | 87 | |
88 | -add_filter( 'plugin_row_meta', 'give_plugin_row_meta', 10, 2 ); |
|
88 | +add_filter('plugin_row_meta', 'give_plugin_row_meta', 10, 2); |
|
89 | 89 | |
90 | 90 | |
91 | 91 | /** |
@@ -103,19 +103,18 @@ discard block |
||
103 | 103 | $title = ''; |
104 | 104 | global $submenu, $plugin_page; |
105 | 105 | |
106 | - foreach ( array_keys( $submenu ) as $parent ) { |
|
107 | - if ( 'edit.php?post_type=give_forms' !== $parent ) { |
|
106 | + foreach (array_keys($submenu) as $parent) { |
|
107 | + if ('edit.php?post_type=give_forms' !== $parent) { |
|
108 | 108 | continue; |
109 | 109 | } |
110 | 110 | |
111 | - foreach ( $submenu[ $parent ] as $submenu_array ) { |
|
112 | - if ( $plugin_page !== $submenu_array[2] ) { |
|
111 | + foreach ($submenu[$parent] as $submenu_array) { |
|
112 | + if ($plugin_page !== $submenu_array[2]) { |
|
113 | 113 | continue; |
114 | 114 | } |
115 | 115 | |
116 | - $title = isset( $submenu_array[0] ) ? |
|
117 | - $submenu_array[0] : |
|
118 | - $submenu_array[3]; |
|
116 | + $title = isset($submenu_array[0]) ? |
|
117 | + $submenu_array[0] : $submenu_array[3]; |
|
119 | 118 | } |
120 | 119 | } |
121 | 120 | |
@@ -129,11 +128,11 @@ discard block |
||
129 | 128 | */ |
130 | 129 | function give_recently_activated_addons() { |
131 | 130 | // Check if action is set. |
132 | - if ( isset( $_REQUEST['action'] ) ) { |
|
133 | - $plugin_action = ( '-1' !== $_REQUEST['action'] ) ? $_REQUEST['action'] : ( isset( $_REQUEST['action2'] ) ? $_REQUEST['action2'] : '' ); |
|
131 | + if (isset($_REQUEST['action'])) { |
|
132 | + $plugin_action = ('-1' !== $_REQUEST['action']) ? $_REQUEST['action'] : (isset($_REQUEST['action2']) ? $_REQUEST['action2'] : ''); |
|
134 | 133 | $plugins = array(); |
135 | 134 | |
136 | - switch ( $plugin_action ) { |
|
135 | + switch ($plugin_action) { |
|
137 | 136 | case 'activate': // Single add-on activation. |
138 | 137 | $plugins[] = $_REQUEST['plugin']; |
139 | 138 | break; |
@@ -143,27 +142,27 @@ discard block |
||
143 | 142 | } |
144 | 143 | |
145 | 144 | |
146 | - if ( ! empty( $plugins ) ) { |
|
145 | + if ( ! empty($plugins)) { |
|
147 | 146 | |
148 | 147 | $give_addons = give_get_recently_activated_addons(); |
149 | 148 | |
150 | - foreach ( $plugins as $plugin ) { |
|
149 | + foreach ($plugins as $plugin) { |
|
151 | 150 | // Get plugins which has 'Give-' as prefix. |
152 | - if ( stripos( $plugin, 'Give-' ) !== false ) { |
|
151 | + if (stripos($plugin, 'Give-') !== false) { |
|
153 | 152 | $give_addons[] = $plugin; |
154 | 153 | } |
155 | 154 | } |
156 | 155 | |
157 | - if ( ! empty( $give_addons ) ) { |
|
156 | + if ( ! empty($give_addons)) { |
|
158 | 157 | // Update the Give's activated add-ons. |
159 | - update_option( 'give_recently_activated_addons', $give_addons ); |
|
158 | + update_option('give_recently_activated_addons', $give_addons); |
|
160 | 159 | } |
161 | 160 | } |
162 | 161 | } |
163 | 162 | } |
164 | 163 | |
165 | 164 | // Add add-on plugins to wp option table. |
166 | -add_action( 'activated_plugin', 'give_recently_activated_addons', 10 ); |
|
165 | +add_action('activated_plugin', 'give_recently_activated_addons', 10); |
|
167 | 166 | |
168 | 167 | /** |
169 | 168 | * Create new menu in plugin section that include all the add-on |
@@ -174,19 +173,19 @@ discard block |
||
174 | 173 | * |
175 | 174 | * @return mixed |
176 | 175 | */ |
177 | -function give_filter_addons_do_filter_addons( $plugin_menu ) { |
|
176 | +function give_filter_addons_do_filter_addons($plugin_menu) { |
|
178 | 177 | global $plugins; |
179 | 178 | |
180 | - foreach ( $plugins['all'] as $plugin_slug => $plugin_data ) { |
|
179 | + foreach ($plugins['all'] as $plugin_slug => $plugin_data) { |
|
181 | 180 | |
182 | - if ( false !== strpos( $plugin_data['Name'], 'Give' ) && false !== strpos( $plugin_data['AuthorName'], 'WordImpress' ) ) { |
|
183 | - $plugins['give'][ $plugin_slug ] = $plugins['all'][ $plugin_slug ]; |
|
184 | - $plugins['give'][ $plugin_slug ]['plugin'] = $plugin_slug; |
|
181 | + if (false !== strpos($plugin_data['Name'], 'Give') && false !== strpos($plugin_data['AuthorName'], 'WordImpress')) { |
|
182 | + $plugins['give'][$plugin_slug] = $plugins['all'][$plugin_slug]; |
|
183 | + $plugins['give'][$plugin_slug]['plugin'] = $plugin_slug; |
|
185 | 184 | // replicate the next step. |
186 | - if ( current_user_can( 'update_plugins' ) ) { |
|
187 | - $current = get_site_transient( 'update_plugins' ); |
|
188 | - if ( isset( $current->response[ $plugin_slug ] ) ) { |
|
189 | - $plugins['give'][ $plugin_slug ]['update'] = true; |
|
185 | + if (current_user_can('update_plugins')) { |
|
186 | + $current = get_site_transient('update_plugins'); |
|
187 | + if (isset($current->response[$plugin_slug])) { |
|
188 | + $plugins['give'][$plugin_slug]['update'] = true; |
|
190 | 189 | } |
191 | 190 | } |
192 | 191 | } |
@@ -196,7 +195,7 @@ discard block |
||
196 | 195 | |
197 | 196 | } |
198 | 197 | |
199 | -add_filter( 'show_advanced_plugins', 'give_filter_addons_do_filter_addons' ); |
|
198 | +add_filter('show_advanced_plugins', 'give_filter_addons_do_filter_addons'); |
|
200 | 199 | |
201 | 200 | /** |
202 | 201 | * Make the Give Menu as an default menu and update the Menu Name |
@@ -207,29 +206,29 @@ discard block |
||
207 | 206 | * |
208 | 207 | * @return mixed |
209 | 208 | */ |
210 | -function give_filter_addons_filter_addons( $views ) { |
|
209 | +function give_filter_addons_filter_addons($views) { |
|
211 | 210 | |
212 | 211 | global $status, $plugins; |
213 | 212 | |
214 | - if ( ! empty( $plugins['give'] ) ) { |
|
213 | + if ( ! empty($plugins['give'])) { |
|
215 | 214 | $class = ''; |
216 | 215 | |
217 | - if ( 'give' === $status ) { |
|
216 | + if ('give' === $status) { |
|
218 | 217 | $class = 'current'; |
219 | 218 | } |
220 | 219 | |
221 | 220 | $views['give'] = sprintf( |
222 | 221 | '<a class="%s" href="plugins.php?plugin_status=give"> %s <span class="count">(%s) </span></a>', |
223 | 222 | $class, |
224 | - __( 'Give', 'give' ), |
|
225 | - count( $plugins['give'] ) |
|
223 | + __('Give', 'give'), |
|
224 | + count($plugins['give']) |
|
226 | 225 | ); |
227 | 226 | } |
228 | 227 | |
229 | 228 | return $views; |
230 | 229 | } |
231 | 230 | |
232 | -add_filter( 'views_plugins', 'give_filter_addons_filter_addons' ); |
|
231 | +add_filter('views_plugins', 'give_filter_addons_filter_addons'); |
|
233 | 232 | |
234 | 233 | /** |
235 | 234 | * Set the Give as the Main menu when admin click on the Give Menu in Plugin section. |
@@ -240,17 +239,17 @@ discard block |
||
240 | 239 | * |
241 | 240 | * @return mixed |
242 | 241 | */ |
243 | -function give_prepare_filter_addons( $plugins ) { |
|
242 | +function give_prepare_filter_addons($plugins) { |
|
244 | 243 | global $status; |
245 | 244 | |
246 | - if ( isset( $_REQUEST['plugin_status'] ) && 'give' === $_REQUEST['plugin_status'] ) { |
|
245 | + if (isset($_REQUEST['plugin_status']) && 'give' === $_REQUEST['plugin_status']) { |
|
247 | 246 | $status = 'give'; |
248 | 247 | } |
249 | 248 | |
250 | 249 | return $plugins; |
251 | 250 | } |
252 | 251 | |
253 | -add_filter( 'all_plugins', 'give_prepare_filter_addons' ); |
|
252 | +add_filter('all_plugins', 'give_prepare_filter_addons'); |
|
254 | 253 | |
255 | 254 | |
256 | 255 | /** |
@@ -261,26 +260,26 @@ discard block |
||
261 | 260 | * |
262 | 261 | * @since 2.1 |
263 | 262 | */ |
264 | -function give_in_plugin_update_message( $data, $response ) { |
|
263 | +function give_in_plugin_update_message($data, $response) { |
|
265 | 264 | $new_version = $data['new_version']; |
266 | - $current_version_parts = explode( '.', GIVE_VERSION ); |
|
267 | - $new_version_parts = explode( '.', $new_version ); |
|
265 | + $current_version_parts = explode('.', GIVE_VERSION); |
|
266 | + $new_version_parts = explode('.', $new_version); |
|
268 | 267 | |
269 | 268 | // If it is a minor upgrade then return. |
270 | - if ( version_compare( $current_version_parts[0] . '.' . $current_version_parts[1], $new_version_parts[0] . '.' . $new_version_parts[1], '=' ) ) { |
|
269 | + if (version_compare($current_version_parts[0].'.'.$current_version_parts[1], $new_version_parts[0].'.'.$new_version_parts[1], '=')) { |
|
271 | 270 | |
272 | 271 | return; |
273 | 272 | } |
274 | 273 | |
275 | 274 | // Get the upgrade notice from the trunk. |
276 | - $upgrade_notice = give_get_plugin_upgrade_notice( $new_version ); |
|
275 | + $upgrade_notice = give_get_plugin_upgrade_notice($new_version); |
|
277 | 276 | |
278 | 277 | // Display upgrade notice. |
279 | - echo apply_filters( 'give_in_plugin_update_message', $upgrade_notice ? '</p>' . wp_kses_post( $upgrade_notice ) . '<p class="dummy">' : '' ); |
|
278 | + echo apply_filters('give_in_plugin_update_message', $upgrade_notice ? '</p>'.wp_kses_post($upgrade_notice).'<p class="dummy">' : ''); |
|
280 | 279 | } |
281 | 280 | |
282 | 281 | // Display upgrade notice. |
283 | -add_action( 'in_plugin_update_message-' . GIVE_PLUGIN_BASENAME, 'give_in_plugin_update_message', 10, 2 ); |
|
282 | +add_action('in_plugin_update_message-'.GIVE_PLUGIN_BASENAME, 'give_in_plugin_update_message', 10, 2); |
|
284 | 283 | |
285 | 284 | |
286 | 285 | /** |
@@ -294,18 +293,18 @@ discard block |
||
294 | 293 | * |
295 | 294 | * @return string |
296 | 295 | */ |
297 | -function give_get_plugin_upgrade_notice( $new_version ) { |
|
296 | +function give_get_plugin_upgrade_notice($new_version) { |
|
298 | 297 | |
299 | 298 | // Cache the upgrade notice. |
300 | 299 | $transient_name = "give_upgrade_notice_{$new_version}"; |
301 | - $upgrade_notice = get_transient( $transient_name ); |
|
300 | + $upgrade_notice = get_transient($transient_name); |
|
302 | 301 | |
303 | - if ( false === $upgrade_notice ) { |
|
304 | - $response = wp_safe_remote_get( 'https://plugins.svn.wordpress.org/give/trunk/readme.txt' ); |
|
302 | + if (false === $upgrade_notice) { |
|
303 | + $response = wp_safe_remote_get('https://plugins.svn.wordpress.org/give/trunk/readme.txt'); |
|
305 | 304 | |
306 | - if ( ! is_wp_error( $response ) && ! empty( $response['body'] ) ) { |
|
307 | - $upgrade_notice = give_parse_plugin_update_notice( $response['body'], $new_version ); |
|
308 | - set_transient( $transient_name, $upgrade_notice, DAY_IN_SECONDS ); |
|
305 | + if ( ! is_wp_error($response) && ! empty($response['body'])) { |
|
306 | + $upgrade_notice = give_parse_plugin_update_notice($response['body'], $new_version); |
|
307 | + set_transient($transient_name, $upgrade_notice, DAY_IN_SECONDS); |
|
309 | 308 | } |
310 | 309 | } |
311 | 310 | |
@@ -325,46 +324,46 @@ discard block |
||
325 | 324 | * |
326 | 325 | * @return string |
327 | 326 | */ |
328 | -function give_parse_plugin_update_notice( $content, $new_version ) { |
|
329 | - $version_parts = explode( '.', $new_version ); |
|
327 | +function give_parse_plugin_update_notice($content, $new_version) { |
|
328 | + $version_parts = explode('.', $new_version); |
|
330 | 329 | $check_for_notices = array( |
331 | - $version_parts[0] . '.0', |
|
332 | - $version_parts[0] . '.0.0', |
|
333 | - $version_parts[0] . '.' . $version_parts[1] . '.' . '0', |
|
330 | + $version_parts[0].'.0', |
|
331 | + $version_parts[0].'.0.0', |
|
332 | + $version_parts[0].'.'.$version_parts[1].'.'.'0', |
|
334 | 333 | ); |
335 | 334 | |
336 | 335 | // Regex to extract Upgrade notice from the readme.txt file. |
337 | - $notice_regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( $new_version ) . '\s*=|$)~Uis'; |
|
336 | + $notice_regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*'.preg_quote($new_version).'\s*=|$)~Uis'; |
|
338 | 337 | |
339 | 338 | $upgrade_notice = ''; |
340 | 339 | |
341 | - foreach ( $check_for_notices as $check_version ) { |
|
342 | - if ( version_compare( GIVE_VERSION, $check_version, '>' ) ) { |
|
340 | + foreach ($check_for_notices as $check_version) { |
|
341 | + if (version_compare(GIVE_VERSION, $check_version, '>')) { |
|
343 | 342 | continue; |
344 | 343 | } |
345 | 344 | |
346 | 345 | $matches = null; |
347 | 346 | |
348 | - if ( preg_match( $notice_regexp, $content, $matches ) ) { |
|
349 | - $notices = (array) preg_split( '~[\r\n]+~', trim( $matches[2] ) ); |
|
347 | + if (preg_match($notice_regexp, $content, $matches)) { |
|
348 | + $notices = (array) preg_split('~[\r\n]+~', trim($matches[2])); |
|
350 | 349 | |
351 | - if ( version_compare( trim( $matches[1] ), $check_version, '=' ) ) { |
|
350 | + if (version_compare(trim($matches[1]), $check_version, '=')) { |
|
352 | 351 | $upgrade_notice .= '<p class="give-plugin-upgrade-notice">'; |
353 | 352 | |
354 | - foreach ( $notices as $index => $line ) { |
|
355 | - $upgrade_notice .= preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ); |
|
353 | + foreach ($notices as $index => $line) { |
|
354 | + $upgrade_notice .= preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line); |
|
356 | 355 | } |
357 | 356 | |
358 | 357 | $upgrade_notice .= '</p>'; |
359 | 358 | } |
360 | 359 | |
361 | - if ( ! empty( $upgrade_notice ) ) { |
|
360 | + if ( ! empty($upgrade_notice)) { |
|
362 | 361 | break; |
363 | 362 | } |
364 | 363 | } |
365 | 364 | } |
366 | 365 | |
367 | - return wp_kses_post( $upgrade_notice ); |
|
366 | + return wp_kses_post($upgrade_notice); |
|
368 | 367 | } |
369 | 368 | |
370 | 369 | |
@@ -401,7 +400,7 @@ discard block |
||
401 | 400 | <?php |
402 | 401 | } |
403 | 402 | |
404 | -add_action( 'admin_head', 'give_plugin_notice_css' ); |
|
403 | +add_action('admin_head', 'give_plugin_notice_css'); |
|
405 | 404 | |
406 | 405 | /** |
407 | 406 | * Get list of add-on last activated. |
@@ -411,5 +410,5 @@ discard block |
||
411 | 410 | * @return mixed|array list of recently activated add-on |
412 | 411 | */ |
413 | 412 | function give_get_recently_activated_addons() { |
414 | - return get_option( 'give_recently_activated_addons', array() ); |
|
413 | + return get_option('give_recently_activated_addons', array()); |
|
415 | 414 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // Exit if accessed directly. |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if ( ! defined('ABSPATH')) { |
|
11 | 11 | exit; |
12 | 12 | } |
13 | 13 | |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | * 'testing' => false, // (required) Never leave as "true" in production!!! |
36 | 36 | * } |
37 | 37 | */ |
38 | - function __construct( $_banner_details ) { |
|
38 | + function __construct($_banner_details) { |
|
39 | 39 | global $give_addons, $pagenow; |
40 | 40 | |
41 | 41 | // Append add-on information to the global variable. |
42 | 42 | $give_addons[] = $_banner_details; |
43 | 43 | |
44 | - if ( 'plugins.php' === $pagenow ) { |
|
44 | + if ('plugins.php' === $pagenow) { |
|
45 | 45 | |
46 | 46 | // Get the current user. |
47 | 47 | $current_user = wp_get_current_user(); |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | $this->add_addon_activate_meta(); |
55 | 55 | |
56 | 56 | // Check if notice callback is already hooked. |
57 | - if ( ! $this->is_banner_notice_hooked() ) { |
|
57 | + if ( ! $this->is_banner_notice_hooked()) { |
|
58 | 58 | // If multiple add-on are activated then show activation banner in tab view. |
59 | - add_action( 'admin_notices', array( $this, 'addon_activation_banner_notices' ), 10 ); |
|
59 | + add_action('admin_notices', array($this, 'addon_activation_banner_notices'), 10); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | } |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return string |
71 | 71 | */ |
72 | - public static function get_banner_user_meta_key( $addon_banner_key ) { |
|
73 | - $addon_slug = sanitize_text_field( $addon_banner_key ); |
|
72 | + public static function get_banner_user_meta_key($addon_banner_key) { |
|
73 | + $addon_slug = sanitize_text_field($addon_banner_key); |
|
74 | 74 | |
75 | 75 | return "give_addon_{$addon_slug}_active_by_user"; |
76 | 76 | } |
@@ -85,24 +85,24 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function init() { |
87 | 87 | // Get the current page to add the notice to |
88 | - add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) ); |
|
88 | + add_action('current_screen', array($this, 'give_addon_notice_ignore')); |
|
89 | 89 | |
90 | 90 | // Get the Give add-ons. |
91 | 91 | $give_addons = $this->get_plugin_file_names(); |
92 | 92 | |
93 | - if ( ! empty( $give_addons ) ) { |
|
93 | + if ( ! empty($give_addons)) { |
|
94 | 94 | |
95 | 95 | // Go through each of the add-on and hook deactivate action. |
96 | - foreach ( $give_addons as $addon_name => $give_addon ) { |
|
96 | + foreach ($give_addons as $addon_name => $give_addon) { |
|
97 | 97 | |
98 | 98 | // Testing? |
99 | - if ( true === $give_addon['testing'] ) { |
|
100 | - $nag_meta_key = 'give_addon_activation_ignore_' . $addon_name; |
|
101 | - delete_user_meta( $this->user_id, $nag_meta_key ); |
|
99 | + if (true === $give_addon['testing']) { |
|
100 | + $nag_meta_key = 'give_addon_activation_ignore_'.$addon_name; |
|
101 | + delete_user_meta($this->user_id, $nag_meta_key); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | // Add deactivate hook. |
105 | - add_action( 'deactivate_' . $give_addon['plugin_main_file'], array( $this, 'remove_addon_activate_meta' ) ); |
|
105 | + add_action('deactivate_'.$give_addon['plugin_main_file'], array($this, 'remove_addon_activate_meta')); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |
@@ -118,29 +118,29 @@ discard block |
||
118 | 118 | global $give_addons; |
119 | 119 | |
120 | 120 | // Get recently activated plugins. |
121 | - $active_plugins = get_option( 'active_plugins' ); |
|
121 | + $active_plugins = get_option('active_plugins'); |
|
122 | 122 | |
123 | 123 | $file_names = array(); |
124 | 124 | |
125 | - if ( empty( $give_addons ) ) { |
|
125 | + if (empty($give_addons)) { |
|
126 | 126 | return $file_names; |
127 | 127 | } |
128 | 128 | |
129 | 129 | // Go through each addon and get the plugin file url. |
130 | - foreach ( $give_addons as $give_addon ) { |
|
130 | + foreach ($give_addons as $give_addon) { |
|
131 | 131 | $file_name = ''; |
132 | - $file_path = explode( '/plugins/', $give_addon['file'] ); |
|
133 | - if ( $file_path ) { |
|
134 | - $file_path = array_pop( $file_path ); |
|
135 | - $file_name = current( explode( '/', $file_path ) ); |
|
132 | + $file_path = explode('/plugins/', $give_addon['file']); |
|
133 | + if ($file_path) { |
|
134 | + $file_path = array_pop($file_path); |
|
135 | + $file_name = current(explode('/', $file_path)); |
|
136 | 136 | } |
137 | 137 | |
138 | - if ( ! empty( $file_name ) ) { |
|
139 | - foreach ( $active_plugins as $plugin ) { |
|
140 | - if ( false !== strpos( $plugin, $file_name ) ) { |
|
141 | - $add_on_key = sanitize_title( $give_addon['name'] ); |
|
138 | + if ( ! empty($file_name)) { |
|
139 | + foreach ($active_plugins as $plugin) { |
|
140 | + if (false !== strpos($plugin, $file_name)) { |
|
141 | + $add_on_key = sanitize_title($give_addon['name']); |
|
142 | 142 | $give_addon['plugin_main_file'] = $plugin; // Include plugin file. |
143 | - $file_names[ $add_on_key ] = $give_addon; |
|
143 | + $file_names[$add_on_key] = $give_addon; |
|
144 | 144 | break; |
145 | 145 | } |
146 | 146 | } |
@@ -160,16 +160,16 @@ discard block |
||
160 | 160 | // Get all activated add-ons. |
161 | 161 | $give_addons = $this->get_plugin_file_names(); |
162 | 162 | |
163 | - if ( ! empty( $give_addons ) ) { |
|
163 | + if ( ! empty($give_addons)) { |
|
164 | 164 | |
165 | 165 | // Go through rach add-ons and add meta data. |
166 | - foreach ( $give_addons as $banner_addon_name => $addon ) { |
|
166 | + foreach ($give_addons as $banner_addon_name => $addon) { |
|
167 | 167 | |
168 | 168 | // User meta key. |
169 | - $user_id = __give_get_active_by_user_meta( $banner_addon_name ); |
|
169 | + $user_id = __give_get_active_by_user_meta($banner_addon_name); |
|
170 | 170 | |
171 | - if ( ! $user_id ) { |
|
172 | - update_option( self::get_banner_user_meta_key( $banner_addon_name ), $this->user_id, '' ); |
|
171 | + if ( ! $user_id) { |
|
172 | + update_option(self::get_banner_user_meta_key($banner_addon_name), $this->user_id, ''); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | global $wp_filter; |
187 | 187 | $notice_already_hooked = false; |
188 | 188 | |
189 | - if ( isset( $wp_filter['admin_notices']->callbacks[10] ) ) { |
|
189 | + if (isset($wp_filter['admin_notices']->callbacks[10])) { |
|
190 | 190 | // Get all of the hooks. |
191 | - $admin_notice_callbacks = array_keys( $wp_filter['admin_notices']->callbacks[10] ); |
|
191 | + $admin_notice_callbacks = array_keys($wp_filter['admin_notices']->callbacks[10]); |
|
192 | 192 | |
193 | - if ( ! empty( $admin_notice_callbacks ) ) { |
|
194 | - foreach ( $admin_notice_callbacks as $key ) { |
|
193 | + if ( ! empty($admin_notice_callbacks)) { |
|
194 | + foreach ($admin_notice_callbacks as $key) { |
|
195 | 195 | //If the key is found in your string, set $found to true |
196 | - if ( false !== strpos( $key, 'addon_activation_banner_notices' ) ) { |
|
196 | + if (false !== strpos($key, 'addon_activation_banner_notices')) { |
|
197 | 197 | $notice_already_hooked = true; |
198 | 198 | } |
199 | 199 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | global $pagenow, $give_addons; |
213 | 213 | |
214 | 214 | // Bailout. |
215 | - if ( 'plugins.php' !== $pagenow ) { |
|
215 | + if ('plugins.php' !== $pagenow) { |
|
216 | 216 | return false; |
217 | 217 | } |
218 | 218 | |
@@ -224,55 +224,55 @@ discard block |
||
224 | 224 | $latest_addon = array(); |
225 | 225 | |
226 | 226 | // Get the plugin folder name, because many give-addon not sending proper plugin_file. |
227 | - if ( ! empty( $recent_activated ) ) { |
|
228 | - foreach ( $recent_activated as $recent_addon ) { |
|
227 | + if ( ! empty($recent_activated)) { |
|
228 | + foreach ($recent_activated as $recent_addon) { |
|
229 | 229 | // Get the add-on folder name. |
230 | - $latest_addon[] = substr( $recent_addon, 0, strpos( $recent_addon, '/' ) ); |
|
230 | + $latest_addon[] = substr($recent_addon, 0, strpos($recent_addon, '/')); |
|
231 | 231 | } |
232 | 232 | } |
233 | 233 | |
234 | 234 | // Go through each of the give add-on. |
235 | - foreach ( $give_addons as $addon ) { |
|
236 | - $addon_sanitized_name = sanitize_title( $addon['name'] ); |
|
235 | + foreach ($give_addons as $addon) { |
|
236 | + $addon_sanitized_name = sanitize_title($addon['name']); |
|
237 | 237 | |
238 | 238 | // Get the add-on dismiss status. |
239 | - $add_on_state = get_user_meta( $this->user_id, "give_addon_activation_ignore_{$addon_sanitized_name}", true ); |
|
239 | + $add_on_state = get_user_meta($this->user_id, "give_addon_activation_ignore_{$addon_sanitized_name}", true); |
|
240 | 240 | |
241 | 241 | // Get the option key. |
242 | - $activate_by_user = (int) __give_get_active_by_user_meta( $addon_sanitized_name ); |
|
242 | + $activate_by_user = (int) __give_get_active_by_user_meta($addon_sanitized_name); |
|
243 | 243 | |
244 | 244 | // Remove plugin file and get the Add-on's folder name only. |
245 | - $file_path = $this->get_plugin_folder_name( $addon['file'] ); |
|
245 | + $file_path = $this->get_plugin_folder_name($addon['file']); |
|
246 | 246 | |
247 | 247 | // If add-on were never dismissed. |
248 | - if ( 'true' !== $add_on_state && $this->user_id === $activate_by_user ) { |
|
249 | - if ( ! empty( $latest_addon ) && ( in_array( $file_path, $latest_addon, true ) || empty( $latest_addon ) ) ) { |
|
248 | + if ('true' !== $add_on_state && $this->user_id === $activate_by_user) { |
|
249 | + if ( ! empty($latest_addon) && (in_array($file_path, $latest_addon, true) || empty($latest_addon))) { |
|
250 | 250 | $addon_to_display[] = $addon; |
251 | 251 | } |
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | - if ( ! empty( $addon_to_display ) ) { |
|
255 | + if ( ! empty($addon_to_display)) { |
|
256 | 256 | ob_start(); |
257 | 257 | |
258 | 258 | // Output inline styles here because there's no reason |
259 | 259 | // to enqueued them after the alert is dismissed. |
260 | 260 | $this->print_css_js(); |
261 | 261 | ?> |
262 | - <div class="<?php echo ( 1 !== count( $addon_to_display ) ) ? 'give-alert-tab-wrapper' : ''; ?> updated give-addon-alert give-notice"> |
|
262 | + <div class="<?php echo (1 !== count($addon_to_display)) ? 'give-alert-tab-wrapper' : ''; ?> updated give-addon-alert give-notice"> |
|
263 | 263 | <?php |
264 | 264 | // If multiple add-on are activated. |
265 | - if ( 1 !== count( $addon_to_display ) ) { |
|
265 | + if (1 !== count($addon_to_display)) { |
|
266 | 266 | ?> |
267 | 267 | <div class="give-vertical-tab"> |
268 | 268 | <div class="give-addon-tab-list"> |
269 | 269 | <ul class="give-alert-addon-list"> |
270 | 270 | <?php |
271 | 271 | $is_first = true; |
272 | - foreach ( $addon_to_display as $banner ) { |
|
272 | + foreach ($addon_to_display as $banner) { |
|
273 | 273 | ?> |
274 | - <li class="give-tab-list<?php echo ( true === $is_first ) ? ' active' : ''; ?>" id="give-addon-<?php echo esc_attr( basename( $banner['file'], '.php' ) ); ?>"> |
|
275 | - <a href="#"><?php echo esc_html( $banner['name'] ); ?></a> |
|
274 | + <li class="give-tab-list<?php echo (true === $is_first) ? ' active' : ''; ?>" id="give-addon-<?php echo esc_attr(basename($banner['file'], '.php')); ?>"> |
|
275 | + <a href="#"><?php echo esc_html($banner['name']); ?></a> |
|
276 | 276 | </li> |
277 | 277 | <?php |
278 | 278 | $is_first = false; |
@@ -282,11 +282,11 @@ discard block |
||
282 | 282 | </ul> |
283 | 283 | </div> |
284 | 284 | <div class="give-right-side-block"> |
285 | - <?php foreach ( $addon_to_display as $banner ) : ?> |
|
286 | - <div class="give-tab-details <?php echo ( true === $is_first ) ? ' active' : ''; ?> " id="give-addon-<?php echo esc_attr( basename( $banner['file'], '.php' ) ); ?>"> |
|
285 | + <?php foreach ($addon_to_display as $banner) : ?> |
|
286 | + <div class="give-tab-details <?php echo (true === $is_first) ? ' active' : ''; ?> " id="give-addon-<?php echo esc_attr(basename($banner['file'], '.php')); ?>"> |
|
287 | 287 | <?php |
288 | 288 | // Render single add banner. |
289 | - $this->render_single_addon_banner( $banner, false ); |
|
289 | + $this->render_single_addon_banner($banner, false); |
|
290 | 290 | $is_first = false; |
291 | 291 | ?> |
292 | 292 | </div> |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | </div> |
296 | 296 | <?php |
297 | 297 | } else { |
298 | - $this->render_single_addon_banner( $addon_to_display[0], true ); |
|
298 | + $this->render_single_addon_banner($addon_to_display[0], true); |
|
299 | 299 | } |
300 | 300 | ?> |
301 | 301 | </div> |
@@ -303,12 +303,12 @@ discard block |
||
303 | 303 | $notice_html = ob_get_clean(); |
304 | 304 | |
305 | 305 | // Register notice. |
306 | - Give()->notices->register_notice( array( |
|
306 | + Give()->notices->register_notice(array( |
|
307 | 307 | 'id' => 'give_add_on_activation_notice', |
308 | 308 | 'type' => 'updated', |
309 | 309 | 'description_html' => $notice_html, |
310 | 310 | 'show' => true, |
311 | - ) ); |
|
311 | + )); |
|
312 | 312 | } |
313 | 313 | } |
314 | 314 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * @param array $banner_arr Banner options. |
321 | 321 | * @param bool $is_single Is single. |
322 | 322 | */ |
323 | - private function render_single_addon_banner( $banner_arr, $is_single ) { |
|
323 | + private function render_single_addon_banner($banner_arr, $is_single) { |
|
324 | 324 | // Get all give add-on. |
325 | 325 | $give_addons = give_get_plugins(); |
326 | 326 | |
@@ -328,80 +328,80 @@ discard block |
||
328 | 328 | $plugin_file = $banner_arr['file']; |
329 | 329 | |
330 | 330 | // Get the plugin main file. |
331 | - foreach ( $give_addons as $main_file => $addon ) { |
|
331 | + foreach ($give_addons as $main_file => $addon) { |
|
332 | 332 | // Plugin should be activated. |
333 | - if ( ! is_plugin_active( $main_file ) ) { |
|
333 | + if ( ! is_plugin_active($main_file)) { |
|
334 | 334 | continue; |
335 | 335 | } |
336 | 336 | |
337 | 337 | if ( |
338 | - isset( $banner_arr['name'] ) |
|
338 | + isset($banner_arr['name']) |
|
339 | 339 | && 'add-on' === $addon['Type'] |
340 | - && $this->get_plugin_folder_name( $main_file ) === $this->get_plugin_folder_name( $plugin_file ) |
|
340 | + && $this->get_plugin_folder_name($main_file) === $this->get_plugin_folder_name($plugin_file) |
|
341 | 341 | ) { |
342 | - $plugin_file = WP_PLUGIN_DIR . '/' . $main_file; |
|
342 | + $plugin_file = WP_PLUGIN_DIR.'/'.$main_file; |
|
343 | 343 | break; |
344 | 344 | } |
345 | 345 | } |
346 | 346 | |
347 | 347 | // Create dismiss URL. |
348 | 348 | $dismiss_url = $is_single |
349 | - ? admin_url( 'plugins.php?give_addon_activation_ignore=1&give_addon=' . sanitize_title( $banner_arr['name'] ) ) |
|
350 | - : admin_url( 'plugins.php?give_addon_activation_ignore=1&give_addon=all' ); |
|
349 | + ? admin_url('plugins.php?give_addon_activation_ignore=1&give_addon='.sanitize_title($banner_arr['name'])) |
|
350 | + : admin_url('plugins.php?give_addon_activation_ignore=1&give_addon=all'); |
|
351 | 351 | |
352 | 352 | // Get the add-on details. |
353 | - $plugin_data = get_plugin_data( $plugin_file ); |
|
353 | + $plugin_data = get_plugin_data($plugin_file); |
|
354 | 354 | ?> |
355 | - <img src="<?php echo esc_url( GIVE_PLUGIN_URL . 'assets/dist/images/give-icon-full-circle.svg' ); ?>" class="give-logo" /> |
|
355 | + <img src="<?php echo esc_url(GIVE_PLUGIN_URL.'assets/dist/images/give-icon-full-circle.svg'); ?>" class="give-logo" /> |
|
356 | 356 | <div class="give-alert-message"> |
357 | 357 | <h3> |
358 | 358 | <?php |
359 | 359 | printf( |
360 | 360 | /* translators: %s: Add-on name */ |
361 | 361 | '%s<span>%s</span>', |
362 | - __( 'New Give Add-on Activated: ', 'give' ), |
|
363 | - esc_html( $banner_arr['name'] ) |
|
362 | + __('New Give Add-on Activated: ', 'give'), |
|
363 | + esc_html($banner_arr['name']) |
|
364 | 364 | ); |
365 | 365 | ?> |
366 | 366 | </h3> |
367 | - <a href="<?php echo esc_url( $dismiss_url ); ?>" class="dismiss"> |
|
367 | + <a href="<?php echo esc_url($dismiss_url); ?>" class="dismiss"> |
|
368 | 368 | <span class="dashicons dashicons-dismiss"></span> |
369 | 369 | </a> |
370 | 370 | <div class="alert-actions"> |
371 | 371 | <?php |
372 | 372 | //Point them to your settings page. |
373 | - if ( ! empty( $plugin_data['Description'] ) ) { |
|
373 | + if ( ! empty($plugin_data['Description'])) { |
|
374 | 374 | ?> |
375 | 375 | <span class="give-addon-description"> |
376 | - <em><?php echo esc_html( strip_tags( $plugin_data['Description'] ) ); ?></em></span><br /> |
|
376 | + <em><?php echo esc_html(strip_tags($plugin_data['Description'])); ?></em></span><br /> |
|
377 | 377 | <?php |
378 | 378 | } |
379 | - if ( isset( $banner_arr['settings_url'] ) ) { |
|
379 | + if (isset($banner_arr['settings_url'])) { |
|
380 | 380 | printf( |
381 | 381 | '<a href="%s"><span class="dashicons dashicons-admin-settings"></span>%s</a>', |
382 | - esc_url( $banner_arr['settings_url'] ), |
|
383 | - esc_html__( 'Go to Settings', 'give' ) |
|
382 | + esc_url($banner_arr['settings_url']), |
|
383 | + esc_html__('Go to Settings', 'give') |
|
384 | 384 | ); |
385 | 385 | } |
386 | 386 | // Show them how to configure the Addon. |
387 | - if ( isset( $banner_arr['documentation_url'] ) ) { |
|
387 | + if (isset($banner_arr['documentation_url'])) { |
|
388 | 388 | printf( |
389 | 389 | '<a href="%s" target="_blank"><span class="dashicons dashicons-media-text"></span>%s</a>', |
390 | - esc_url( $banner_arr['documentation_url'] ), |
|
390 | + esc_url($banner_arr['documentation_url']), |
|
391 | 391 | sprintf( |
392 | 392 | /* translators: %s: Add-on name */ |
393 | - esc_html__( 'Documentation: %s Add-on', 'give' ), |
|
394 | - esc_html( $banner_arr['name'] ) |
|
393 | + esc_html__('Documentation: %s Add-on', 'give'), |
|
394 | + esc_html($banner_arr['name']) |
|
395 | 395 | ) |
396 | 396 | ); |
397 | 397 | } |
398 | 398 | |
399 | 399 | //Let them signup for plugin updates |
400 | - if ( isset( $banner_arr['support_url'] ) ) { |
|
400 | + if (isset($banner_arr['support_url'])) { |
|
401 | 401 | printf( |
402 | 402 | '<a href="%s" target="_blank"><span class="dashicons dashicons-sos"></span>%s</a>', |
403 | - esc_url( $banner_arr['support_url'] ), |
|
404 | - esc_html__( 'Get Support', 'give' ) |
|
403 | + esc_url($banner_arr['support_url']), |
|
404 | + esc_html__('Get Support', 'give') |
|
405 | 405 | ); |
406 | 406 | } |
407 | 407 | ?> |
@@ -424,30 +424,30 @@ discard block |
||
424 | 424 | * See here: http://codex.wordpress.org/Function_Reference/add_user_meta |
425 | 425 | */ |
426 | 426 | if ( |
427 | - isset( $_GET['give_addon'], $_GET['give_addon_activation_ignore'] ) |
|
427 | + isset($_GET['give_addon'], $_GET['give_addon_activation_ignore']) |
|
428 | 428 | && '1' === $_GET['give_addon_activation_ignore'] |
429 | 429 | ) { |
430 | 430 | // Get the value of the 'give_addon' query string. |
431 | - $addon_query_arg = sanitize_text_field( wp_unslash( $_GET['give_addon'] ) ); |
|
431 | + $addon_query_arg = sanitize_text_field(wp_unslash($_GET['give_addon'])); |
|
432 | 432 | $deactivated_addons = array(); |
433 | 433 | |
434 | 434 | // If All add-on requested to dismiss. |
435 | - if ( 'all' === $addon_query_arg ) { |
|
435 | + if ('all' === $addon_query_arg) { |
|
436 | 436 | // Get all activated add-ons. |
437 | 437 | $give_addons = $this->get_plugin_file_names(); |
438 | 438 | |
439 | - if ( ! empty( $give_addons ) ) { |
|
440 | - $deactivated_addons = array_keys( $give_addons ); |
|
439 | + if ( ! empty($give_addons)) { |
|
440 | + $deactivated_addons = array_keys($give_addons); |
|
441 | 441 | } |
442 | 442 | } else { |
443 | 443 | // Store the addon to deactivate. |
444 | 444 | $deactivated_addons[] = $addon_query_arg; |
445 | 445 | } |
446 | 446 | |
447 | - if ( ! empty( $deactivated_addons ) ) { |
|
448 | - foreach ( $deactivated_addons as $addon ) { |
|
447 | + if ( ! empty($deactivated_addons)) { |
|
448 | + foreach ($deactivated_addons as $addon) { |
|
449 | 449 | // Record it user meta. |
450 | - add_user_meta( $this->user_id, "give_addon_activation_ignore_{$addon}", 'true', true ); |
|
450 | + add_user_meta($this->user_id, "give_addon_activation_ignore_{$addon}", 'true', true); |
|
451 | 451 | } |
452 | 452 | } |
453 | 453 | } |
@@ -462,26 +462,26 @@ discard block |
||
462 | 462 | */ |
463 | 463 | public function remove_addon_activate_meta() { |
464 | 464 | // Get the hook name and then grab the plugin file from it. |
465 | - $plugin_file = str_replace( 'deactivate_', '', current_action() ); |
|
465 | + $plugin_file = str_replace('deactivate_', '', current_action()); |
|
466 | 466 | |
467 | 467 | // Get all activated add-ons. |
468 | 468 | $give_addons = $this->get_plugin_file_names(); |
469 | 469 | |
470 | - if ( ! empty( $give_addons ) ) { |
|
471 | - foreach ( $give_addons as $banner_addon_name => $addon ) { |
|
472 | - if ( $plugin_file === $addon['plugin_main_file'] ) { |
|
470 | + if ( ! empty($give_addons)) { |
|
471 | + foreach ($give_addons as $banner_addon_name => $addon) { |
|
472 | + if ($plugin_file === $addon['plugin_main_file']) { |
|
473 | 473 | |
474 | 474 | // Get the user meta key. |
475 | - $user_id = (int) __give_get_active_by_user_meta( $banner_addon_name ); |
|
475 | + $user_id = (int) __give_get_active_by_user_meta($banner_addon_name); |
|
476 | 476 | |
477 | - if ( $user_id ) { |
|
477 | + if ($user_id) { |
|
478 | 478 | // Get user meta for this add-on. |
479 | 479 | $nag_meta_key = "give_addon_activation_ignore_{$banner_addon_name}"; |
480 | 480 | |
481 | 481 | // Delete plugin activation option key. |
482 | - delete_option( self::get_banner_user_meta_key( $banner_addon_name ) ); |
|
482 | + delete_option(self::get_banner_user_meta_key($banner_addon_name)); |
|
483 | 483 | // Delete user meta of plugin activation. |
484 | - delete_user_meta( $user_id, $nag_meta_key ); |
|
484 | + delete_user_meta($user_id, $nag_meta_key); |
|
485 | 485 | } |
486 | 486 | } |
487 | 487 | } |
@@ -508,11 +508,11 @@ discard block |
||
508 | 508 | * |
509 | 509 | * @return bool|mixed|string |
510 | 510 | */ |
511 | - public function get_plugin_folder_name( $main_file ) { |
|
511 | + public function get_plugin_folder_name($main_file) { |
|
512 | 512 | // Remove plugin file and get the Add-on's folder name only. |
513 | - $file_path = explode( '/plugins/', $main_file ); |
|
514 | - $addon_file_path = array_pop( $file_path ); |
|
515 | - $addon_file_path = substr( $addon_file_path, 0, strpos( $addon_file_path, '/' ) ); |
|
513 | + $file_path = explode('/plugins/', $main_file); |
|
514 | + $addon_file_path = array_pop($file_path); |
|
515 | + $addon_file_path = substr($addon_file_path, 0, strpos($addon_file_path, '/')); |
|
516 | 516 | |
517 | 517 | return $addon_file_path; |
518 | 518 | } |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Gateways' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Gateways')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Gateways. |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'gateways'; |
30 | - $this->label = esc_html__( 'Payment Gateways', 'give' ); |
|
30 | + $this->label = esc_html__('Payment Gateways', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'gateways-settings'; |
33 | 33 | |
34 | 34 | parent::__construct(); |
35 | 35 | |
36 | 36 | // Do not use main form for this tab. |
37 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
38 | - add_action( 'give_admin_field_enabled_gateways', array( $this, 'render_enabled_gateways' ), 10, 2 ); |
|
37 | + if (give_get_current_setting_tab() === $this->id) { |
|
38 | + add_action('give_admin_field_enabled_gateways', array($this, 'render_enabled_gateways'), 10, 2); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $settings = array(); |
50 | 50 | $current_section = give_get_current_setting_section(); |
51 | 51 | |
52 | - switch ( $current_section ) { |
|
52 | + switch ($current_section) { |
|
53 | 53 | case 'paypal-standard': |
54 | 54 | $settings = array( |
55 | 55 | // Section 2: PayPal Standard. |
@@ -58,55 +58,55 @@ discard block |
||
58 | 58 | 'id' => 'give_title_gateway_settings_2', |
59 | 59 | ), |
60 | 60 | array( |
61 | - 'name' => __( 'PayPal Email', 'give' ), |
|
62 | - 'desc' => __( 'Enter your PayPal account\'s email.', 'give' ), |
|
61 | + 'name' => __('PayPal Email', 'give'), |
|
62 | + 'desc' => __('Enter your PayPal account\'s email.', 'give'), |
|
63 | 63 | 'id' => 'paypal_email', |
64 | 64 | 'type' => 'email', |
65 | 65 | ), |
66 | 66 | array( |
67 | - 'name' => __( 'PayPal Page Style', 'give' ), |
|
68 | - 'desc' => __( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ), |
|
67 | + 'name' => __('PayPal Page Style', 'give'), |
|
68 | + 'desc' => __('Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give'), |
|
69 | 69 | 'id' => 'paypal_page_style', |
70 | 70 | 'type' => 'text', |
71 | 71 | ), |
72 | 72 | array( |
73 | - 'name' => __( 'PayPal Transaction Type', 'give' ), |
|
74 | - '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' ), |
|
73 | + 'name' => __('PayPal Transaction Type', 'give'), |
|
74 | + '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'), |
|
75 | 75 | 'id' => 'paypal_button_type', |
76 | 76 | 'type' => 'radio_inline', |
77 | 77 | 'options' => array( |
78 | - 'donation' => __( 'Donation', 'give' ), |
|
79 | - 'standard' => __( 'Standard Transaction', 'give' ) |
|
78 | + 'donation' => __('Donation', 'give'), |
|
79 | + 'standard' => __('Standard Transaction', 'give') |
|
80 | 80 | ), |
81 | 81 | 'default' => 'donation', |
82 | 82 | ), |
83 | 83 | array( |
84 | - 'name' => __( 'Billing Details', 'give' ), |
|
85 | - 'desc' => __( 'This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give' ), |
|
84 | + 'name' => __('Billing Details', 'give'), |
|
85 | + 'desc' => __('This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give'), |
|
86 | 86 | 'id' => 'paypal_standard_billing_details', |
87 | 87 | 'type' => 'radio_inline', |
88 | 88 | 'default' => 'disabled', |
89 | 89 | 'options' => array( |
90 | - 'enabled' => __( 'Enabled', 'give' ), |
|
91 | - 'disabled' => __( 'Disabled', 'give' ), |
|
90 | + 'enabled' => __('Enabled', 'give'), |
|
91 | + 'disabled' => __('Disabled', 'give'), |
|
92 | 92 | ) |
93 | 93 | ), |
94 | 94 | array( |
95 | - 'name' => __( 'PayPal IPN Verification', 'give' ), |
|
96 | - 'desc' => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ), |
|
95 | + 'name' => __('PayPal IPN Verification', 'give'), |
|
96 | + 'desc' => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'), |
|
97 | 97 | 'id' => 'paypal_verification', |
98 | 98 | 'type' => 'radio_inline', |
99 | 99 | 'default' => 'enabled', |
100 | 100 | 'options' => array( |
101 | - 'enabled' => __( 'Enabled', 'give' ), |
|
102 | - 'disabled' => __( 'Disabled', 'give' ), |
|
101 | + 'enabled' => __('Enabled', 'give'), |
|
102 | + 'disabled' => __('Disabled', 'give'), |
|
103 | 103 | ) |
104 | 104 | ), |
105 | 105 | array( |
106 | - 'name' => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ), |
|
106 | + 'name' => __('PayPal Standard Gateway Settings Docs Link', 'give'), |
|
107 | 107 | 'id' => 'paypal_standard_gateway_settings_docs_link', |
108 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ), |
|
109 | - 'title' => __( 'PayPal Standard Gateway Settings', 'give' ), |
|
108 | + 'url' => esc_url('http://docs.givewp.com/settings-gateway-paypal-standard'), |
|
109 | + 'title' => __('PayPal Standard Gateway Settings', 'give'), |
|
110 | 110 | 'type' => 'give_docs_link', |
111 | 111 | ), |
112 | 112 | array( |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | 'id' => 'give_title_gateway_settings_3', |
125 | 125 | ), |
126 | 126 | array( |
127 | - 'name' => __( 'Collect Billing Details', 'give' ), |
|
128 | - 'desc' => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ), |
|
127 | + 'name' => __('Collect Billing Details', 'give'), |
|
128 | + 'desc' => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'), |
|
129 | 129 | 'id' => 'give_offline_donation_enable_billing_fields', |
130 | 130 | 'type' => 'radio_inline', |
131 | 131 | 'default' => 'disabled', |
132 | 132 | 'options' => array( |
133 | - 'enabled' => __( 'Enabled', 'give' ), |
|
134 | - 'disabled' => __( 'Disabled', 'give' ) |
|
133 | + 'enabled' => __('Enabled', 'give'), |
|
134 | + 'disabled' => __('Disabled', 'give') |
|
135 | 135 | ) |
136 | 136 | ), |
137 | 137 | array( |
138 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
139 | - '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' ), |
|
138 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
139 | + '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'), |
|
140 | 140 | 'id' => 'global_offline_donation_content', |
141 | 141 | 'default' => give_get_default_offline_donation_content(), |
142 | 142 | 'type' => 'wysiwyg', |
@@ -145,10 +145,10 @@ discard block |
||
145 | 145 | ) |
146 | 146 | ), |
147 | 147 | array( |
148 | - 'name' => esc_html__( 'Offline Donations Settings Docs Link', 'give' ), |
|
148 | + 'name' => esc_html__('Offline Donations Settings Docs Link', 'give'), |
|
149 | 149 | 'id' => 'offline_gateway_settings_docs_link', |
150 | - 'url' => esc_url( 'http://docs.givewp.com/offlinegateway' ), |
|
151 | - 'title' => __( 'Offline Gateway Settings', 'give' ), |
|
150 | + 'url' => esc_url('http://docs.givewp.com/offlinegateway'), |
|
151 | + 'title' => __('Offline Gateway Settings', 'give'), |
|
152 | 152 | 'type' => 'give_docs_link', |
153 | 153 | ), |
154 | 154 | array( |
@@ -166,19 +166,19 @@ discard block |
||
166 | 166 | 'type' => 'title' |
167 | 167 | ), |
168 | 168 | array( |
169 | - 'name' => __( 'Test Mode', 'give' ), |
|
170 | - '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' ), |
|
169 | + 'name' => __('Test Mode', 'give'), |
|
170 | + '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'), |
|
171 | 171 | 'id' => 'test_mode', |
172 | 172 | 'type' => 'radio_inline', |
173 | 173 | 'default' => 'disabled', |
174 | 174 | 'options' => array( |
175 | - 'enabled' => __( 'Enabled', 'give' ), |
|
176 | - 'disabled' => __( 'Disabled', 'give' ), |
|
175 | + 'enabled' => __('Enabled', 'give'), |
|
176 | + 'disabled' => __('Disabled', 'give'), |
|
177 | 177 | ) |
178 | 178 | ), |
179 | 179 | array( |
180 | - 'name' => __( 'Enabled Gateways', 'give' ), |
|
181 | - 'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ), |
|
180 | + 'name' => __('Enabled Gateways', 'give'), |
|
181 | + 'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'), |
|
182 | 182 | 'id' => 'gateways', |
183 | 183 | 'type' => 'enabled_gateways' |
184 | 184 | ), |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * This setting will not render on admin setting screen but help internal code to recognize "gateways_label" setting and add them to give setting when save. |
191 | 191 | */ |
192 | 192 | array( |
193 | - 'name' => __( 'Gateways Label', 'give' ), |
|
193 | + 'name' => __('Gateways Label', 'give'), |
|
194 | 194 | 'desc' => '', |
195 | 195 | 'id' => 'gateways_label', |
196 | 196 | 'type' => 'gateways_label_hidden' |
@@ -203,17 +203,17 @@ discard block |
||
203 | 203 | * This setting will not render on admin setting screen but help internal code to recognize "default_gateway" setting and add them to give setting when save. |
204 | 204 | */ |
205 | 205 | array( |
206 | - 'name' => __( 'Default Gateway', 'give' ), |
|
207 | - 'desc' => __( 'The gateway that will be selected by default.', 'give' ), |
|
206 | + 'name' => __('Default Gateway', 'give'), |
|
207 | + 'desc' => __('The gateway that will be selected by default.', 'give'), |
|
208 | 208 | 'id' => 'default_gateway', |
209 | 209 | 'type' => 'default_gateway_hidden' |
210 | 210 | ), |
211 | 211 | |
212 | 212 | array( |
213 | - 'name' => __( 'Gateways Docs Link', 'give' ), |
|
213 | + 'name' => __('Gateways Docs Link', 'give'), |
|
214 | 214 | 'id' => 'gateway_settings_docs_link', |
215 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateways' ), |
|
216 | - 'title' => __( 'Gateway Settings', 'give' ), |
|
215 | + 'url' => esc_url('http://docs.givewp.com/settings-gateways'), |
|
216 | + 'title' => __('Gateway Settings', 'give'), |
|
217 | 217 | 'type' => 'give_docs_link', |
218 | 218 | ), |
219 | 219 | array( |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * Filter the payment gateways settings. |
229 | 229 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
230 | 230 | */ |
231 | - $settings = apply_filters( 'give_settings_gateways', $settings ); |
|
231 | + $settings = apply_filters('give_settings_gateways', $settings); |
|
232 | 232 | |
233 | 233 | /** |
234 | 234 | * Filter the settings. |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @param array $settings |
239 | 239 | */ |
240 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
240 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
241 | 241 | |
242 | 242 | // Output. |
243 | 243 | return $settings; |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | */ |
252 | 252 | public function get_sections() { |
253 | 253 | $sections = array( |
254 | - 'gateways-settings' => __( 'Gateways', 'give' ), |
|
255 | - 'paypal-standard' => __( 'PayPal Standard', 'give' ), |
|
256 | - 'offline-donations' => __( 'Offline Donations', 'give' ) |
|
254 | + 'gateways-settings' => __('Gateways', 'give'), |
|
255 | + 'paypal-standard' => __('PayPal Standard', 'give'), |
|
256 | + 'offline-donations' => __('Offline Donations', 'give') |
|
257 | 257 | ); |
258 | 258 | |
259 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
259 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * @param $field |
270 | 270 | * @param $settings |
271 | 271 | */ |
272 | - public function render_enabled_gateways( $field, $settings ) { |
|
272 | + public function render_enabled_gateways($field, $settings) { |
|
273 | 273 | $id = $field['id']; |
274 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
275 | - $gateways_label = give_get_option( 'gateways_label', array() ); |
|
276 | - $default_gateway = give_get_option( 'default_gateway', current( array_keys( $gateways ) ) ); |
|
274 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
275 | + $gateways_label = give_get_option('gateways_label', array()); |
|
276 | + $default_gateway = give_get_option('default_gateway', current(array_keys($gateways))); |
|
277 | 277 | |
278 | 278 | ob_start(); |
279 | 279 | |
@@ -288,51 +288,51 @@ discard block |
||
288 | 288 | <span>%3$s</span> |
289 | 289 | <span>%4$s</span> |
290 | 290 | ', |
291 | - __( 'Gateway', 'give' ), |
|
292 | - __( 'Label', 'give' ), |
|
293 | - __( 'Default', 'give' ), |
|
294 | - __( 'Enabled', 'give' ) |
|
291 | + __('Gateway', 'give'), |
|
292 | + __('Label', 'give'), |
|
293 | + __('Default', 'give'), |
|
294 | + __('Enabled', 'give') |
|
295 | 295 | ); |
296 | 296 | echo '</div>'; |
297 | 297 | |
298 | 298 | echo '<ul class="give-checklist-fields give-payment-gatways-list">'; |
299 | - foreach ( $gateways as $key => $option ) : |
|
299 | + foreach ($gateways as $key => $option) : |
|
300 | 300 | $enabled = null; |
301 | - if ( is_array( $settings ) && array_key_exists( $key, $settings ) ) { |
|
301 | + if (is_array($settings) && array_key_exists($key, $settings)) { |
|
302 | 302 | $enabled = '1'; |
303 | 303 | } |
304 | 304 | |
305 | 305 | echo '<li>'; |
306 | - printf( '<span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span>' ); |
|
307 | - printf( '<span class="admin-label">%s</span>', esc_html( $option['admin_label'] ) ); |
|
306 | + printf('<span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span>'); |
|
307 | + printf('<span class="admin-label">%s</span>', esc_html($option['admin_label'])); |
|
308 | 308 | |
309 | 309 | $label = ''; |
310 | - if ( ! empty( $gateways_label[ $key ] ) ) { |
|
311 | - $label = $gateways_label[ $key ]; |
|
310 | + if ( ! empty($gateways_label[$key])) { |
|
311 | + $label = $gateways_label[$key]; |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | printf( |
315 | 315 | '<input class="checkout-label" type="text" id="%1$s[%2$s]" name="%1$s[%2$s]" value="%3$s" placeholder="%4$s"/>', |
316 | 316 | 'gateways_label', |
317 | - esc_attr( $key ), |
|
318 | - esc_html( $label ), |
|
319 | - esc_html( $option['checkout_label'] ) |
|
317 | + esc_attr($key), |
|
318 | + esc_html($label), |
|
319 | + esc_html($option['checkout_label']) |
|
320 | 320 | ); |
321 | 321 | |
322 | 322 | printf( |
323 | 323 | '<input class="gateways-radio" type="radio" name="%1$s" value="%2$s" %3$s %4$s>', |
324 | 324 | 'default_gateway', |
325 | 325 | $key, |
326 | - checked( $key, $default_gateway, false ), |
|
327 | - disabled( NULL, $enabled, false ) |
|
326 | + checked($key, $default_gateway, false), |
|
327 | + disabled(NULL, $enabled, false) |
|
328 | 328 | ); |
329 | 329 | |
330 | 330 | printf( |
331 | 331 | '<input class="gateways-checkbox" name="%1$s[%2$s]" id="%1$s[%2$s]" type="checkbox" value="1" %3$s data-payment-gateway="%4$s"/>', |
332 | - esc_attr( $id ), |
|
333 | - esc_attr( $key ), |
|
334 | - checked( '1', $enabled, false ), |
|
335 | - esc_html( $option['admin_label'] ) |
|
332 | + esc_attr($id), |
|
333 | + esc_attr($key), |
|
334 | + checked('1', $enabled, false), |
|
335 | + esc_html($option['admin_label']) |
|
336 | 336 | ); |
337 | 337 | echo '</li>'; |
338 | 338 | endforeach; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // Exit if accessed directly. |
16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
16 | +if ( ! defined('ABSPATH')) { |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
@@ -25,70 +25,70 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_do_automatic_upgrades() { |
27 | 27 | $did_upgrade = false; |
28 | - $give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) ); |
|
28 | + $give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version')); |
|
29 | 29 | |
30 | - if ( ! $give_version ) { |
|
30 | + if ( ! $give_version) { |
|
31 | 31 | // 1.0 is the first version to use this option so we must add it. |
32 | 32 | $give_version = '1.0'; |
33 | 33 | } |
34 | 34 | |
35 | - switch ( true ) { |
|
35 | + switch (true) { |
|
36 | 36 | |
37 | - case version_compare( $give_version, '1.6', '<' ) : |
|
37 | + case version_compare($give_version, '1.6', '<') : |
|
38 | 38 | give_v16_upgrades(); |
39 | 39 | $did_upgrade = true; |
40 | 40 | |
41 | - case version_compare( $give_version, '1.7', '<' ) : |
|
41 | + case version_compare($give_version, '1.7', '<') : |
|
42 | 42 | give_v17_upgrades(); |
43 | 43 | $did_upgrade = true; |
44 | 44 | |
45 | - case version_compare( $give_version, '1.8', '<' ) : |
|
45 | + case version_compare($give_version, '1.8', '<') : |
|
46 | 46 | give_v18_upgrades(); |
47 | 47 | $did_upgrade = true; |
48 | 48 | |
49 | - case version_compare( $give_version, '1.8.7', '<' ) : |
|
49 | + case version_compare($give_version, '1.8.7', '<') : |
|
50 | 50 | give_v187_upgrades(); |
51 | 51 | $did_upgrade = true; |
52 | 52 | |
53 | - case version_compare( $give_version, '1.8.8', '<' ) : |
|
53 | + case version_compare($give_version, '1.8.8', '<') : |
|
54 | 54 | give_v188_upgrades(); |
55 | 55 | $did_upgrade = true; |
56 | 56 | |
57 | - case version_compare( $give_version, '1.8.9', '<' ) : |
|
57 | + case version_compare($give_version, '1.8.9', '<') : |
|
58 | 58 | give_v189_upgrades(); |
59 | 59 | $did_upgrade = true; |
60 | 60 | |
61 | - case version_compare( $give_version, '1.8.12', '<' ) : |
|
61 | + case version_compare($give_version, '1.8.12', '<') : |
|
62 | 62 | give_v1812_upgrades(); |
63 | 63 | $did_upgrade = true; |
64 | 64 | |
65 | - case version_compare( $give_version, '1.8.13', '<' ) : |
|
65 | + case version_compare($give_version, '1.8.13', '<') : |
|
66 | 66 | give_v1813_upgrades(); |
67 | 67 | $did_upgrade = true; |
68 | 68 | |
69 | - case version_compare( $give_version, '1.8.17', '<' ) : |
|
69 | + case version_compare($give_version, '1.8.17', '<') : |
|
70 | 70 | give_v1817_upgrades(); |
71 | 71 | $did_upgrade = true; |
72 | 72 | |
73 | - case version_compare( $give_version, '1.8.18', '<' ) : |
|
73 | + case version_compare($give_version, '1.8.18', '<') : |
|
74 | 74 | give_v1818_upgrades(); |
75 | 75 | $did_upgrade = true; |
76 | 76 | |
77 | - case version_compare( $give_version, '2.0', '<' ) : |
|
77 | + case version_compare($give_version, '2.0', '<') : |
|
78 | 78 | give_v20_upgrades(); |
79 | 79 | $did_upgrade = true; |
80 | 80 | |
81 | - case version_compare( $give_version, '2.0.1', '<' ) : |
|
81 | + case version_compare($give_version, '2.0.1', '<') : |
|
82 | 82 | // Do nothing on fresh install. |
83 | - if ( ! doing_action( 'give_upgrades' ) ) { |
|
83 | + if ( ! doing_action('give_upgrades')) { |
|
84 | 84 | give_v201_create_tables(); |
85 | - Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() ); |
|
85 | + Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance()); |
|
86 | 86 | Give_Updates::$background_updater->dispatch(); |
87 | 87 | } |
88 | 88 | |
89 | 89 | $did_upgrade = true; |
90 | 90 | |
91 | - case version_compare( $give_version, '2.0.2', '<' ) : |
|
91 | + case version_compare($give_version, '2.0.2', '<') : |
|
92 | 92 | // Remove 2.0.1 update to rerun on 2.0.2 |
93 | 93 | $completed_upgrades = give_get_completed_upgrades(); |
94 | 94 | $v201_updates = array( |
@@ -98,35 +98,35 @@ discard block |
||
98 | 98 | 'v201_logs_upgrades', |
99 | 99 | ); |
100 | 100 | |
101 | - foreach ( $v201_updates as $v201_update ) { |
|
102 | - if ( in_array( $v201_update, $completed_upgrades ) ) { |
|
103 | - unset( $completed_upgrades[ array_search( $v201_update, $completed_upgrades ) ] ); |
|
101 | + foreach ($v201_updates as $v201_update) { |
|
102 | + if (in_array($v201_update, $completed_upgrades)) { |
|
103 | + unset($completed_upgrades[array_search($v201_update, $completed_upgrades)]); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | - update_option( 'give_completed_upgrades', $completed_upgrades ); |
|
107 | + update_option('give_completed_upgrades', $completed_upgrades); |
|
108 | 108 | |
109 | 109 | // Do nothing on fresh install. |
110 | - if ( ! doing_action( 'give_upgrades' ) ) { |
|
110 | + if ( ! doing_action('give_upgrades')) { |
|
111 | 111 | give_v201_create_tables(); |
112 | - Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() ); |
|
112 | + Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance()); |
|
113 | 113 | Give_Updates::$background_updater->dispatch(); |
114 | 114 | } |
115 | 115 | |
116 | 116 | $did_upgrade = true; |
117 | 117 | |
118 | - case version_compare( $give_version, '2.0.3', '<' ) : |
|
118 | + case version_compare($give_version, '2.0.3', '<') : |
|
119 | 119 | give_v203_upgrades(); |
120 | 120 | $did_upgrade = true; |
121 | 121 | } |
122 | 122 | |
123 | - if ( $did_upgrade ) { |
|
124 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
123 | + if ($did_upgrade) { |
|
124 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | -add_action( 'admin_init', 'give_do_automatic_upgrades' ); |
|
129 | -add_action( 'give_upgrades', 'give_do_automatic_upgrades' ); |
|
128 | +add_action('admin_init', 'give_do_automatic_upgrades'); |
|
129 | +add_action('give_upgrades', 'give_do_automatic_upgrades'); |
|
130 | 130 | |
131 | 131 | /** |
132 | 132 | * Display Upgrade Notices. |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @return void |
142 | 142 | */ |
143 | -function give_show_upgrade_notices( $give_updates ) { |
|
143 | +function give_show_upgrade_notices($give_updates) { |
|
144 | 144 | // v1.3.2 Upgrades |
145 | 145 | $give_updates->register( |
146 | 146 | array( |
@@ -206,32 +206,32 @@ discard block |
||
206 | 206 | ); |
207 | 207 | |
208 | 208 | // v1.8.17 Upgrades for donations. |
209 | - $give_updates->register( array( |
|
209 | + $give_updates->register(array( |
|
210 | 210 | 'id' => 'v1817_update_donation_iranian_currency_code', |
211 | 211 | 'version' => '1.8.17', |
212 | 212 | 'callback' => 'give_v1817_update_donation_iranian_currency_code', |
213 | - ) ); |
|
213 | + )); |
|
214 | 214 | |
215 | 215 | // v1.8.17 Upgrades for cleanup of user roles. |
216 | - $give_updates->register( array( |
|
216 | + $give_updates->register(array( |
|
217 | 217 | 'id' => 'v1817_cleanup_user_roles', |
218 | 218 | 'version' => '1.8.17', |
219 | 219 | 'callback' => 'give_v1817_cleanup_user_roles', |
220 | - ) ); |
|
220 | + )); |
|
221 | 221 | |
222 | 222 | // v1.8.18 Upgrades for assigning custom amount to existing set donations. |
223 | - $give_updates->register( array( |
|
223 | + $give_updates->register(array( |
|
224 | 224 | 'id' => 'v1818_assign_custom_amount_set_donation', |
225 | 225 | 'version' => '1.8.18', |
226 | 226 | 'callback' => 'give_v1818_assign_custom_amount_set_donation', |
227 | - ) ); |
|
227 | + )); |
|
228 | 228 | |
229 | 229 | // v1.8.18 Cleanup the Give Worker Role Caps. |
230 | - $give_updates->register( array( |
|
230 | + $give_updates->register(array( |
|
231 | 231 | 'id' => 'v1818_give_worker_role_cleanup', |
232 | 232 | 'version' => '1.8.18', |
233 | 233 | 'callback' => 'give_v1818_give_worker_role_cleanup', |
234 | - ) ); |
|
234 | + )); |
|
235 | 235 | |
236 | 236 | // v2.0.0 Upgrades |
237 | 237 | $give_updates->register( |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | 'id' => 'v20_move_metadata_into_new_table', |
286 | 286 | 'version' => '2.0.0', |
287 | 287 | 'callback' => 'give_v20_move_metadata_into_new_table_callback', |
288 | - 'depend' => array( 'v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata' ), |
|
288 | + 'depend' => array('v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata'), |
|
289 | 289 | ) |
290 | 290 | ); |
291 | 291 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | 'id' => 'v201_move_metadata_into_new_table', |
332 | 332 | 'version' => '2.0.1', |
333 | 333 | 'callback' => 'give_v201_move_metadata_into_new_table_callback', |
334 | - 'depend' => array( 'v201_upgrades_payment_metadata', 'v201_add_missing_donors' ), |
|
334 | + 'depend' => array('v201_upgrades_payment_metadata', 'v201_add_missing_donors'), |
|
335 | 335 | ) |
336 | 336 | ); |
337 | 337 | |
@@ -359,13 +359,13 @@ discard block |
||
359 | 359 | 'id' => 'v213_delete_donation_meta', |
360 | 360 | 'version' => '2.1.3', |
361 | 361 | 'callback' => 'give_v213_delete_donation_meta_callback', |
362 | - 'depends' => array( 'v201_move_metadata_into_new_table' ) |
|
362 | + 'depends' => array('v201_move_metadata_into_new_table') |
|
363 | 363 | ) |
364 | 364 | ); |
365 | 365 | |
366 | 366 | } |
367 | 367 | |
368 | -add_action( 'give_register_updates', 'give_show_upgrade_notices' ); |
|
368 | +add_action('give_register_updates', 'give_show_upgrade_notices'); |
|
369 | 369 | |
370 | 370 | /** |
371 | 371 | * Triggers all upgrade functions |
@@ -377,29 +377,29 @@ discard block |
||
377 | 377 | */ |
378 | 378 | function give_trigger_upgrades() { |
379 | 379 | |
380 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
381 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
380 | + if ( ! current_user_can('manage_give_settings')) { |
|
381 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
382 | 382 | 'response' => 403, |
383 | - ) ); |
|
383 | + )); |
|
384 | 384 | } |
385 | 385 | |
386 | - $give_version = get_option( 'give_version' ); |
|
386 | + $give_version = get_option('give_version'); |
|
387 | 387 | |
388 | - if ( ! $give_version ) { |
|
388 | + if ( ! $give_version) { |
|
389 | 389 | // 1.0 is the first version to use this option so we must add it. |
390 | 390 | $give_version = '1.0'; |
391 | - add_option( 'give_version', $give_version ); |
|
391 | + add_option('give_version', $give_version); |
|
392 | 392 | } |
393 | 393 | |
394 | - update_option( 'give_version', GIVE_VERSION ); |
|
395 | - delete_option( 'give_doing_upgrade' ); |
|
394 | + update_option('give_version', GIVE_VERSION); |
|
395 | + delete_option('give_doing_upgrade'); |
|
396 | 396 | |
397 | - if ( DOING_AJAX ) { |
|
398 | - die( 'complete' ); |
|
397 | + if (DOING_AJAX) { |
|
398 | + die('complete'); |
|
399 | 399 | } // End if(). |
400 | 400 | } |
401 | 401 | |
402 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
402 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
403 | 403 | |
404 | 404 | |
405 | 405 | /** |
@@ -417,10 +417,10 @@ discard block |
||
417 | 417 | |
418 | 418 | // UPDATE DB METAKEYS. |
419 | 419 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
420 | - $query = $wpdb->query( $sql ); |
|
420 | + $query = $wpdb->query($sql); |
|
421 | 421 | |
422 | 422 | $give_updates->percentage = 100; |
423 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
423 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | |
@@ -444,24 +444,24 @@ discard block |
||
444 | 444 | $where .= "AND ( p.post_status = 'abandoned' )"; |
445 | 445 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
446 | 446 | |
447 | - $sql = $select . $join . $where; |
|
448 | - $found_payments = $wpdb->get_col( $sql ); |
|
447 | + $sql = $select.$join.$where; |
|
448 | + $found_payments = $wpdb->get_col($sql); |
|
449 | 449 | |
450 | - foreach ( $found_payments as $payment ) { |
|
450 | + foreach ($found_payments as $payment) { |
|
451 | 451 | |
452 | 452 | // Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves. |
453 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
453 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
454 | 454 | |
455 | 455 | // 1450124863 = 12/10/2015 20:42:25. |
456 | - if ( $modified_time >= 1450124863 ) { |
|
456 | + if ($modified_time >= 1450124863) { |
|
457 | 457 | |
458 | - give_update_payment_status( $payment, 'pending' ); |
|
458 | + give_update_payment_status($payment, 'pending'); |
|
459 | 459 | |
460 | 460 | } |
461 | 461 | } |
462 | 462 | |
463 | 463 | $give_updates->percentage = 100; |
464 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
464 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | |
@@ -474,17 +474,17 @@ discard block |
||
474 | 474 | */ |
475 | 475 | function give_v152_cleanup_users() { |
476 | 476 | |
477 | - $give_version = get_option( 'give_version' ); |
|
477 | + $give_version = get_option('give_version'); |
|
478 | 478 | |
479 | - if ( ! $give_version ) { |
|
479 | + if ( ! $give_version) { |
|
480 | 480 | // 1.0 is the first version to use this option so we must add it. |
481 | 481 | $give_version = '1.0'; |
482 | 482 | } |
483 | 483 | |
484 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
484 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
485 | 485 | |
486 | 486 | // v1.5.2 Upgrades |
487 | - if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) { |
|
487 | + if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) { |
|
488 | 488 | |
489 | 489 | // Delete all caps with "ss". |
490 | 490 | // Also delete all unused "campaign" roles. |
@@ -531,9 +531,9 @@ discard block |
||
531 | 531 | ); |
532 | 532 | |
533 | 533 | global $wp_roles; |
534 | - foreach ( $delete_caps as $cap ) { |
|
535 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
536 | - $wp_roles->remove_cap( $role, $cap ); |
|
534 | + foreach ($delete_caps as $cap) { |
|
535 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
536 | + $wp_roles->remove_cap($role, $cap); |
|
537 | 537 | } |
538 | 538 | } |
539 | 539 | |
@@ -543,15 +543,15 @@ discard block |
||
543 | 543 | $roles->add_caps(); |
544 | 544 | |
545 | 545 | // The Update Ran. |
546 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
547 | - give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' ); |
|
548 | - delete_option( 'give_doing_upgrade' ); |
|
546 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
547 | + give_set_upgrade_complete('upgrade_give_user_caps_cleanup'); |
|
548 | + delete_option('give_doing_upgrade'); |
|
549 | 549 | |
550 | 550 | }// End if(). |
551 | 551 | |
552 | 552 | } |
553 | 553 | |
554 | -add_action( 'admin_init', 'give_v152_cleanup_users' ); |
|
554 | +add_action('admin_init', 'give_v152_cleanup_users'); |
|
555 | 555 | |
556 | 556 | /** |
557 | 557 | * 1.6 Upgrade routine to create the customer meta table. |
@@ -594,53 +594,53 @@ discard block |
||
594 | 594 | |
595 | 595 | // Get addons license key. |
596 | 596 | $addons = array(); |
597 | - foreach ( $give_options as $key => $value ) { |
|
598 | - if ( false !== strpos( $key, '_license_key' ) ) { |
|
599 | - $addons[ $key ] = $value; |
|
597 | + foreach ($give_options as $key => $value) { |
|
598 | + if (false !== strpos($key, '_license_key')) { |
|
599 | + $addons[$key] = $value; |
|
600 | 600 | } |
601 | 601 | } |
602 | 602 | |
603 | 603 | // Bailout: We do not have any addon license data to upgrade. |
604 | - if ( empty( $addons ) ) { |
|
604 | + if (empty($addons)) { |
|
605 | 605 | return false; |
606 | 606 | } |
607 | 607 | |
608 | - foreach ( $addons as $key => $addon_license ) { |
|
608 | + foreach ($addons as $key => $addon_license) { |
|
609 | 609 | |
610 | 610 | // Get addon shortname. |
611 | - $shortname = str_replace( '_license_key', '', $key ); |
|
611 | + $shortname = str_replace('_license_key', '', $key); |
|
612 | 612 | |
613 | 613 | // Addon license option name. |
614 | - $addon_license_option_name = $shortname . '_license_active'; |
|
614 | + $addon_license_option_name = $shortname.'_license_active'; |
|
615 | 615 | |
616 | 616 | // bailout if license is empty. |
617 | - if ( empty( $addon_license ) ) { |
|
618 | - delete_option( $addon_license_option_name ); |
|
617 | + if (empty($addon_license)) { |
|
618 | + delete_option($addon_license_option_name); |
|
619 | 619 | continue; |
620 | 620 | } |
621 | 621 | |
622 | 622 | // Get addon name. |
623 | 623 | $addon_name = array(); |
624 | - $addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) ); |
|
625 | - foreach ( $addon_name_parts as $name_part ) { |
|
624 | + $addon_name_parts = explode('_', str_replace('give_', '', $shortname)); |
|
625 | + foreach ($addon_name_parts as $name_part) { |
|
626 | 626 | |
627 | 627 | // Fix addon name |
628 | - switch ( $name_part ) { |
|
628 | + switch ($name_part) { |
|
629 | 629 | case 'authorizenet' : |
630 | 630 | $name_part = 'authorize.net'; |
631 | 631 | break; |
632 | 632 | } |
633 | 633 | |
634 | - $addon_name[] = ucfirst( $name_part ); |
|
634 | + $addon_name[] = ucfirst($name_part); |
|
635 | 635 | } |
636 | 636 | |
637 | - $addon_name = implode( ' ', $addon_name ); |
|
637 | + $addon_name = implode(' ', $addon_name); |
|
638 | 638 | |
639 | 639 | // Data to send to the API. |
640 | 640 | $api_params = array( |
641 | 641 | 'edd_action' => 'activate_license', // never change from "edd_" to "give_"! |
642 | 642 | 'license' => $addon_license, |
643 | - 'item_name' => urlencode( $addon_name ), |
|
643 | + 'item_name' => urlencode($addon_name), |
|
644 | 644 | 'url' => home_url(), |
645 | 645 | ); |
646 | 646 | |
@@ -655,17 +655,17 @@ discard block |
||
655 | 655 | ); |
656 | 656 | |
657 | 657 | // Make sure there are no errors. |
658 | - if ( is_wp_error( $response ) ) { |
|
659 | - delete_option( $addon_license_option_name ); |
|
658 | + if (is_wp_error($response)) { |
|
659 | + delete_option($addon_license_option_name); |
|
660 | 660 | continue; |
661 | 661 | } |
662 | 662 | |
663 | 663 | // Tell WordPress to look for updates. |
664 | - set_site_transient( 'update_plugins', null ); |
|
664 | + set_site_transient('update_plugins', null); |
|
665 | 665 | |
666 | 666 | // Decode license data. |
667 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
668 | - update_option( $addon_license_option_name, $license_data ); |
|
667 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
668 | + update_option($addon_license_option_name, $license_data); |
|
669 | 669 | }// End foreach(). |
670 | 670 | } |
671 | 671 | |
@@ -695,9 +695,9 @@ discard block |
||
695 | 695 | ); |
696 | 696 | |
697 | 697 | global $wp_roles; |
698 | - foreach ( $delete_caps as $cap ) { |
|
699 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
700 | - $wp_roles->remove_cap( $role, $cap ); |
|
698 | + foreach ($delete_caps as $cap) { |
|
699 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
700 | + $wp_roles->remove_cap($role, $cap); |
|
701 | 701 | } |
702 | 702 | } |
703 | 703 | |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | function give_v18_upgrades_core_setting() { |
732 | 732 | // Core settings which changes from checkbox to radio. |
733 | 733 | $core_setting_names = array_merge( |
734 | - array_keys( give_v18_renamed_core_settings() ), |
|
734 | + array_keys(give_v18_renamed_core_settings()), |
|
735 | 735 | array( |
736 | 736 | 'uninstall_on_delete', |
737 | 737 | 'scripts_footer', |
@@ -743,48 +743,48 @@ discard block |
||
743 | 743 | ); |
744 | 744 | |
745 | 745 | // Bailout: If not any setting define. |
746 | - if ( $give_settings = get_option( 'give_settings' ) ) { |
|
746 | + if ($give_settings = get_option('give_settings')) { |
|
747 | 747 | |
748 | 748 | $setting_changed = false; |
749 | 749 | |
750 | 750 | // Loop: check each setting field. |
751 | - foreach ( $core_setting_names as $setting_name ) { |
|
751 | + foreach ($core_setting_names as $setting_name) { |
|
752 | 752 | // New setting name. |
753 | - $new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name ); |
|
753 | + $new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name); |
|
754 | 754 | |
755 | 755 | // Continue: If setting already set. |
756 | 756 | if ( |
757 | - array_key_exists( $new_setting_name, $give_settings ) |
|
758 | - && in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) ) |
|
757 | + array_key_exists($new_setting_name, $give_settings) |
|
758 | + && in_array($give_settings[$new_setting_name], array('enabled', 'disabled')) |
|
759 | 759 | ) { |
760 | 760 | continue; |
761 | 761 | } |
762 | 762 | |
763 | 763 | // Set checkbox value to radio value. |
764 | - $give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' ); |
|
764 | + $give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled'); |
|
765 | 765 | |
766 | 766 | // @see https://github.com/WordImpress/Give/issues/1063. |
767 | - if ( false !== strpos( $setting_name, 'disable_' ) ) { |
|
767 | + if (false !== strpos($setting_name, 'disable_')) { |
|
768 | 768 | |
769 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' ); |
|
770 | - } elseif ( false !== strpos( $setting_name, 'enable_' ) ) { |
|
769 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled'); |
|
770 | + } elseif (false !== strpos($setting_name, 'enable_')) { |
|
771 | 771 | |
772 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' ); |
|
772 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled'); |
|
773 | 773 | } |
774 | 774 | |
775 | 775 | // Tell bot to update core setting to db. |
776 | - if ( ! $setting_changed ) { |
|
776 | + if ( ! $setting_changed) { |
|
777 | 777 | $setting_changed = true; |
778 | 778 | } |
779 | 779 | } |
780 | 780 | |
781 | 781 | // Update setting only if they changed. |
782 | - if ( $setting_changed ) { |
|
783 | - update_option( 'give_settings', $give_settings ); |
|
782 | + if ($setting_changed) { |
|
783 | + update_option('give_settings', $give_settings); |
|
784 | 784 | } |
785 | 785 | }// End if(). |
786 | 786 | |
787 | - give_set_upgrade_complete( 'v18_upgrades_core_setting' ); |
|
787 | + give_set_upgrade_complete('v18_upgrades_core_setting'); |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | /** |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | $give_updates = Give_Updates::get_instance(); |
799 | 799 | |
800 | 800 | // form query |
801 | - $forms = new WP_Query( array( |
|
801 | + $forms = new WP_Query(array( |
|
802 | 802 | 'paged' => $give_updates->step, |
803 | 803 | 'status' => 'any', |
804 | 804 | 'order' => 'ASC', |
@@ -807,41 +807,41 @@ discard block |
||
807 | 807 | ) |
808 | 808 | ); |
809 | 809 | |
810 | - if ( $forms->have_posts() ) { |
|
811 | - $give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) ); |
|
810 | + if ($forms->have_posts()) { |
|
811 | + $give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20)); |
|
812 | 812 | |
813 | - while ( $forms->have_posts() ) { |
|
813 | + while ($forms->have_posts()) { |
|
814 | 814 | $forms->the_post(); |
815 | 815 | |
816 | 816 | // Form content. |
817 | 817 | // Note in version 1.8 display content setting split into display content and content placement setting. |
818 | 818 | // You can delete _give_content_option in future. |
819 | - $show_content = give_get_meta( get_the_ID(), '_give_content_option', true ); |
|
820 | - if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) { |
|
821 | - $field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' ); |
|
822 | - give_update_meta( get_the_ID(), '_give_display_content', $field_value ); |
|
819 | + $show_content = give_get_meta(get_the_ID(), '_give_content_option', true); |
|
820 | + if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) { |
|
821 | + $field_value = ('none' !== $show_content ? 'enabled' : 'disabled'); |
|
822 | + give_update_meta(get_the_ID(), '_give_display_content', $field_value); |
|
823 | 823 | |
824 | - $field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' ); |
|
825 | - give_update_meta( get_the_ID(), '_give_content_placement', $field_value ); |
|
824 | + $field_value = ('none' !== $show_content ? $show_content : 'give_pre_form'); |
|
825 | + give_update_meta(get_the_ID(), '_give_content_placement', $field_value); |
|
826 | 826 | } |
827 | 827 | |
828 | 828 | // "Disable" Guest Donation. Checkbox. |
829 | 829 | // See: https://github.com/WordImpress/Give/issues/1470. |
830 | - $guest_donation = give_get_meta( get_the_ID(), '_give_logged_in_only', true ); |
|
831 | - $guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' ); |
|
832 | - give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval ); |
|
830 | + $guest_donation = give_get_meta(get_the_ID(), '_give_logged_in_only', true); |
|
831 | + $guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled'); |
|
832 | + give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval); |
|
833 | 833 | |
834 | 834 | // Offline Donations. |
835 | 835 | // See: https://github.com/WordImpress/Give/issues/1579. |
836 | - $offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true ); |
|
837 | - if ( 'no' === $offline_donation ) { |
|
836 | + $offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true); |
|
837 | + if ('no' === $offline_donation) { |
|
838 | 838 | $offline_donation_newval = 'global'; |
839 | - } elseif ( 'yes' === $offline_donation ) { |
|
839 | + } elseif ('yes' === $offline_donation) { |
|
840 | 840 | $offline_donation_newval = 'enabled'; |
841 | 841 | } else { |
842 | 842 | $offline_donation_newval = 'disabled'; |
843 | 843 | } |
844 | - give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval ); |
|
844 | + give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval); |
|
845 | 845 | |
846 | 846 | // Convert yes/no setting field to enabled/disabled. |
847 | 847 | $form_radio_settings = array( |
@@ -861,15 +861,15 @@ discard block |
||
861 | 861 | '_give_offline_donation_enable_billing_fields_single', |
862 | 862 | ); |
863 | 863 | |
864 | - foreach ( $form_radio_settings as $meta_key ) { |
|
864 | + foreach ($form_radio_settings as $meta_key) { |
|
865 | 865 | // Get value. |
866 | - $field_value = give_get_meta( get_the_ID(), $meta_key, true ); |
|
866 | + $field_value = give_get_meta(get_the_ID(), $meta_key, true); |
|
867 | 867 | |
868 | 868 | // Convert meta value only if it is in yes/no/none. |
869 | - if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) { |
|
869 | + if (in_array($field_value, array('yes', 'on', 'no', 'none'))) { |
|
870 | 870 | |
871 | - $field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' ); |
|
872 | - give_update_meta( get_the_ID(), $meta_key, $field_value ); |
|
871 | + $field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled'); |
|
872 | + give_update_meta(get_the_ID(), $meta_key, $field_value); |
|
873 | 873 | } |
874 | 874 | } |
875 | 875 | }// End while(). |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | |
879 | 879 | } else { |
880 | 880 | // No more forms found, finish up. |
881 | - give_set_upgrade_complete( 'v18_upgrades_form_metadata' ); |
|
881 | + give_set_upgrade_complete('v18_upgrades_form_metadata'); |
|
882 | 882 | } |
883 | 883 | } |
884 | 884 | |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | '%_transient_give_stats_%', |
946 | 946 | 'give_cache%', |
947 | 947 | '%_transient_give_add_ons_feed%', |
948 | - '%_transient__give_ajax_works' . |
|
948 | + '%_transient__give_ajax_works'. |
|
949 | 949 | '%_transient_give_total_api_keys%', |
950 | 950 | '%_transient_give_i18n_give_promo_hide%', |
951 | 951 | '%_transient_give_contributors%', |
@@ -972,24 +972,24 @@ discard block |
||
972 | 972 | ARRAY_A |
973 | 973 | ); |
974 | 974 | |
975 | - if ( ! empty( $user_apikey_options ) ) { |
|
976 | - foreach ( $user_apikey_options as $user ) { |
|
977 | - $cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] ); |
|
978 | - $cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] ); |
|
979 | - $cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] ); |
|
975 | + if ( ! empty($user_apikey_options)) { |
|
976 | + foreach ($user_apikey_options as $user) { |
|
977 | + $cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']); |
|
978 | + $cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']); |
|
979 | + $cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']); |
|
980 | 980 | } |
981 | 981 | } |
982 | 982 | |
983 | - if ( ! empty( $cached_options ) ) { |
|
984 | - foreach ( $cached_options as $option ) { |
|
985 | - switch ( true ) { |
|
986 | - case ( false !== strpos( $option, 'transient' ) ): |
|
987 | - $option = str_replace( '_transient_', '', $option ); |
|
988 | - delete_transient( $option ); |
|
983 | + if ( ! empty($cached_options)) { |
|
984 | + foreach ($cached_options as $option) { |
|
985 | + switch (true) { |
|
986 | + case (false !== strpos($option, 'transient')): |
|
987 | + $option = str_replace('_transient_', '', $option); |
|
988 | + delete_transient($option); |
|
989 | 989 | break; |
990 | 990 | |
991 | 991 | default: |
992 | - delete_option( $option ); |
|
992 | + delete_option($option); |
|
993 | 993 | } |
994 | 994 | } |
995 | 995 | } |
@@ -1007,7 +1007,7 @@ discard block |
||
1007 | 1007 | global $wp_roles; |
1008 | 1008 | |
1009 | 1009 | // Get the role object. |
1010 | - $give_worker = get_role( 'give_worker' ); |
|
1010 | + $give_worker = get_role('give_worker'); |
|
1011 | 1011 | |
1012 | 1012 | // A list of capabilities to add for give workers. |
1013 | 1013 | $caps_to_add = array( |
@@ -1015,9 +1015,9 @@ discard block |
||
1015 | 1015 | 'edit_pages', |
1016 | 1016 | ); |
1017 | 1017 | |
1018 | - foreach ( $caps_to_add as $cap ) { |
|
1018 | + foreach ($caps_to_add as $cap) { |
|
1019 | 1019 | // Add the capability. |
1020 | - $give_worker->add_cap( $cap ); |
|
1020 | + $give_worker->add_cap($cap); |
|
1021 | 1021 | } |
1022 | 1022 | |
1023 | 1023 | } |
@@ -1034,7 +1034,7 @@ discard block |
||
1034 | 1034 | $give_updates = Give_Updates::get_instance(); |
1035 | 1035 | |
1036 | 1036 | // form query. |
1037 | - $donation_forms = new WP_Query( array( |
|
1037 | + $donation_forms = new WP_Query(array( |
|
1038 | 1038 | 'paged' => $give_updates->step, |
1039 | 1039 | 'status' => 'any', |
1040 | 1040 | 'order' => 'ASC', |
@@ -1043,10 +1043,10 @@ discard block |
||
1043 | 1043 | ) |
1044 | 1044 | ); |
1045 | 1045 | |
1046 | - if ( $donation_forms->have_posts() ) { |
|
1047 | - $give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) ); |
|
1046 | + if ($donation_forms->have_posts()) { |
|
1047 | + $give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20)); |
|
1048 | 1048 | |
1049 | - while ( $donation_forms->have_posts() ) { |
|
1049 | + while ($donation_forms->have_posts()) { |
|
1050 | 1050 | $donation_forms->the_post(); |
1051 | 1051 | $form_id = get_the_ID(); |
1052 | 1052 | |
@@ -1054,41 +1054,41 @@ discard block |
||
1054 | 1054 | update_post_meta( |
1055 | 1055 | $form_id, |
1056 | 1056 | '_give_set_price', |
1057 | - give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) ) |
|
1057 | + give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true)) |
|
1058 | 1058 | ); |
1059 | 1059 | |
1060 | 1060 | // Remove formatting from _give_custom_amount_minimum. |
1061 | 1061 | update_post_meta( |
1062 | 1062 | $form_id, |
1063 | 1063 | '_give_custom_amount_minimum', |
1064 | - give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) ) |
|
1064 | + give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true)) |
|
1065 | 1065 | ); |
1066 | 1066 | |
1067 | 1067 | // Bailout. |
1068 | - if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) { |
|
1068 | + if ('set' === get_post_meta($form_id, '_give_price_option', true)) { |
|
1069 | 1069 | continue; |
1070 | 1070 | } |
1071 | 1071 | |
1072 | - $donation_levels = get_post_meta( $form_id, '_give_donation_levels', true ); |
|
1072 | + $donation_levels = get_post_meta($form_id, '_give_donation_levels', true); |
|
1073 | 1073 | |
1074 | - if ( ! empty( $donation_levels ) ) { |
|
1074 | + if ( ! empty($donation_levels)) { |
|
1075 | 1075 | |
1076 | - foreach ( $donation_levels as $index => $donation_level ) { |
|
1077 | - if ( isset( $donation_level['_give_amount'] ) ) { |
|
1078 | - $donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] ); |
|
1076 | + foreach ($donation_levels as $index => $donation_level) { |
|
1077 | + if (isset($donation_level['_give_amount'])) { |
|
1078 | + $donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']); |
|
1079 | 1079 | } |
1080 | 1080 | } |
1081 | 1081 | |
1082 | - update_post_meta( $form_id, '_give_donation_levels', $donation_levels ); |
|
1082 | + update_post_meta($form_id, '_give_donation_levels', $donation_levels); |
|
1083 | 1083 | |
1084 | - $donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' ); |
|
1084 | + $donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount'); |
|
1085 | 1085 | |
1086 | - $min_amount = min( $donation_levels_amounts ); |
|
1087 | - $max_amount = max( $donation_levels_amounts ); |
|
1086 | + $min_amount = min($donation_levels_amounts); |
|
1087 | + $max_amount = max($donation_levels_amounts); |
|
1088 | 1088 | |
1089 | 1089 | // Set Minimum and Maximum amount for Multi Level Donation Forms |
1090 | - give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 ); |
|
1091 | - give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 ); |
|
1090 | + give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0); |
|
1091 | + give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0); |
|
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | } |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | wp_reset_postdata(); |
1098 | 1098 | } else { |
1099 | 1099 | // The Update Ran. |
1100 | - give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' ); |
|
1100 | + give_set_upgrade_complete('v189_upgrades_levels_post_meta'); |
|
1101 | 1101 | } |
1102 | 1102 | |
1103 | 1103 | } |
@@ -1147,7 +1147,7 @@ discard block |
||
1147 | 1147 | */ |
1148 | 1148 | function give_v20_upgrades() { |
1149 | 1149 | // Update cache setting. |
1150 | - give_update_option( 'cache', 'enabled' ); |
|
1150 | + give_update_option('cache', 'enabled'); |
|
1151 | 1151 | |
1152 | 1152 | // Upgrade email settings. |
1153 | 1153 | give_v20_upgrades_email_setting(); |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | $all_setting = give_get_settings(); |
1167 | 1167 | |
1168 | 1168 | // Bailout on fresh install. |
1169 | - if ( empty( $all_setting ) ) { |
|
1169 | + if (empty($all_setting)) { |
|
1170 | 1170 | return; |
1171 | 1171 | } |
1172 | 1172 | |
@@ -1185,19 +1185,19 @@ discard block |
||
1185 | 1185 | 'admin_notices' => 'new-donation_notification', |
1186 | 1186 | ); |
1187 | 1187 | |
1188 | - foreach ( $settings as $old_setting => $new_setting ) { |
|
1188 | + foreach ($settings as $old_setting => $new_setting) { |
|
1189 | 1189 | // Do not update already modified |
1190 | - if ( ! is_array( $new_setting ) ) { |
|
1191 | - if ( array_key_exists( $new_setting, $all_setting ) || ! array_key_exists( $old_setting, $all_setting ) ) { |
|
1190 | + if ( ! is_array($new_setting)) { |
|
1191 | + if (array_key_exists($new_setting, $all_setting) || ! array_key_exists($old_setting, $all_setting)) { |
|
1192 | 1192 | continue; |
1193 | 1193 | } |
1194 | 1194 | } |
1195 | 1195 | |
1196 | - switch ( $old_setting ) { |
|
1196 | + switch ($old_setting) { |
|
1197 | 1197 | case 'admin_notices': |
1198 | - $notification_status = give_get_option( $old_setting, 'enabled' ); |
|
1198 | + $notification_status = give_get_option($old_setting, 'enabled'); |
|
1199 | 1199 | |
1200 | - give_update_option( $new_setting, $notification_status ); |
|
1200 | + give_update_option($new_setting, $notification_status); |
|
1201 | 1201 | |
1202 | 1202 | // @todo: Delete this option later ( version > 2.0 ), We need this for per form email addon. |
1203 | 1203 | // give_delete_option( $old_setting ); |
@@ -1208,19 +1208,19 @@ discard block |
||
1208 | 1208 | case 'admin_notice_emails': |
1209 | 1209 | $recipients = give_get_admin_notice_emails(); |
1210 | 1210 | |
1211 | - foreach ( $new_setting as $setting ) { |
|
1211 | + foreach ($new_setting as $setting) { |
|
1212 | 1212 | // bailout if setting already exist. |
1213 | - if ( array_key_exists( $setting, $all_setting ) ) { |
|
1213 | + if (array_key_exists($setting, $all_setting)) { |
|
1214 | 1214 | continue; |
1215 | 1215 | } |
1216 | 1216 | |
1217 | - give_update_option( $setting, $recipients ); |
|
1217 | + give_update_option($setting, $recipients); |
|
1218 | 1218 | } |
1219 | 1219 | break; |
1220 | 1220 | |
1221 | 1221 | default: |
1222 | - give_update_option( $new_setting, give_get_option( $old_setting ) ); |
|
1223 | - give_delete_option( $old_setting ); |
|
1222 | + give_update_option($new_setting, give_get_option($old_setting)); |
|
1223 | + give_delete_option($old_setting); |
|
1224 | 1224 | } |
1225 | 1225 | } |
1226 | 1226 | } |
@@ -1237,22 +1237,22 @@ discard block |
||
1237 | 1237 | $give_settings = give_get_settings(); |
1238 | 1238 | $give_setting_updated = false; |
1239 | 1239 | |
1240 | - if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) { |
|
1240 | + if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) { |
|
1241 | 1241 | $give_settings['number_decimals'] = 0; |
1242 | 1242 | $give_settings['decimal_separator'] = ''; |
1243 | 1243 | $give_setting_updated = true; |
1244 | 1244 | |
1245 | - } elseif ( empty( $give_settings['decimal_separator'] ) ) { |
|
1245 | + } elseif (empty($give_settings['decimal_separator'])) { |
|
1246 | 1246 | $give_settings['number_decimals'] = 0; |
1247 | 1247 | $give_setting_updated = true; |
1248 | 1248 | |
1249 | - } elseif ( 6 < absint( $give_settings['number_decimals'] ) ) { |
|
1249 | + } elseif (6 < absint($give_settings['number_decimals'])) { |
|
1250 | 1250 | $give_settings['number_decimals'] = 5; |
1251 | 1251 | $give_setting_updated = true; |
1252 | 1252 | } |
1253 | 1253 | |
1254 | - if ( $give_setting_updated ) { |
|
1255 | - update_option( 'give_settings', $give_settings ); |
|
1254 | + if ($give_setting_updated) { |
|
1255 | + update_option('give_settings', $give_settings); |
|
1256 | 1256 | } |
1257 | 1257 | } |
1258 | 1258 | |
@@ -1271,69 +1271,69 @@ discard block |
||
1271 | 1271 | $give_updates = Give_Updates::get_instance(); |
1272 | 1272 | |
1273 | 1273 | // form query. |
1274 | - $donation_forms = new WP_Query( array( |
|
1274 | + $donation_forms = new WP_Query(array( |
|
1275 | 1275 | 'paged' => $give_updates->step, |
1276 | 1276 | 'status' => 'any', |
1277 | 1277 | 'order' => 'ASC', |
1278 | - 'post_type' => array( 'give_forms', 'give_payment' ), |
|
1278 | + 'post_type' => array('give_forms', 'give_payment'), |
|
1279 | 1279 | 'posts_per_page' => 20, |
1280 | 1280 | ) |
1281 | 1281 | ); |
1282 | - if ( $donation_forms->have_posts() ) { |
|
1283 | - $give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) ); |
|
1282 | + if ($donation_forms->have_posts()) { |
|
1283 | + $give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20)); |
|
1284 | 1284 | |
1285 | - while ( $donation_forms->have_posts() ) { |
|
1285 | + while ($donation_forms->have_posts()) { |
|
1286 | 1286 | $donation_forms->the_post(); |
1287 | 1287 | global $post; |
1288 | 1288 | |
1289 | - $meta = get_post_meta( $post->ID ); |
|
1289 | + $meta = get_post_meta($post->ID); |
|
1290 | 1290 | |
1291 | - switch ( $post->post_type ) { |
|
1291 | + switch ($post->post_type) { |
|
1292 | 1292 | case 'give_forms': |
1293 | 1293 | // _give_set_price. |
1294 | - if ( ! empty( $meta['_give_set_price'][0] ) ) { |
|
1295 | - update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) ); |
|
1294 | + if ( ! empty($meta['_give_set_price'][0])) { |
|
1295 | + update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0])); |
|
1296 | 1296 | } |
1297 | 1297 | |
1298 | 1298 | // _give_custom_amount_minimum. |
1299 | - if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) { |
|
1300 | - update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) ); |
|
1299 | + if ( ! empty($meta['_give_custom_amount_minimum'][0])) { |
|
1300 | + update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0])); |
|
1301 | 1301 | } |
1302 | 1302 | |
1303 | 1303 | // _give_levels_minimum_amount. |
1304 | - if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) { |
|
1305 | - update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) ); |
|
1304 | + if ( ! empty($meta['_give_levels_minimum_amount'][0])) { |
|
1305 | + update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0])); |
|
1306 | 1306 | } |
1307 | 1307 | |
1308 | 1308 | // _give_levels_maximum_amount. |
1309 | - if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) { |
|
1310 | - update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) ); |
|
1309 | + if ( ! empty($meta['_give_levels_maximum_amount'][0])) { |
|
1310 | + update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0])); |
|
1311 | 1311 | } |
1312 | 1312 | |
1313 | 1313 | // _give_set_goal. |
1314 | - if ( ! empty( $meta['_give_set_goal'][0] ) ) { |
|
1315 | - update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) ); |
|
1314 | + if ( ! empty($meta['_give_set_goal'][0])) { |
|
1315 | + update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0])); |
|
1316 | 1316 | } |
1317 | 1317 | |
1318 | 1318 | // _give_form_earnings. |
1319 | - if ( ! empty( $meta['_give_form_earnings'][0] ) ) { |
|
1320 | - update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) ); |
|
1319 | + if ( ! empty($meta['_give_form_earnings'][0])) { |
|
1320 | + update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0])); |
|
1321 | 1321 | } |
1322 | 1322 | |
1323 | 1323 | // _give_custom_amount_minimum. |
1324 | - if ( ! empty( $meta['_give_donation_levels'][0] ) ) { |
|
1325 | - $donation_levels = unserialize( $meta['_give_donation_levels'][0] ); |
|
1324 | + if ( ! empty($meta['_give_donation_levels'][0])) { |
|
1325 | + $donation_levels = unserialize($meta['_give_donation_levels'][0]); |
|
1326 | 1326 | |
1327 | - foreach ( $donation_levels as $index => $level ) { |
|
1328 | - if ( empty( $level['_give_amount'] ) ) { |
|
1327 | + foreach ($donation_levels as $index => $level) { |
|
1328 | + if (empty($level['_give_amount'])) { |
|
1329 | 1329 | continue; |
1330 | 1330 | } |
1331 | 1331 | |
1332 | - $donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] ); |
|
1332 | + $donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']); |
|
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | $meta['_give_donation_levels'] = $donation_levels; |
1336 | - update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] ); |
|
1336 | + update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']); |
|
1337 | 1337 | } |
1338 | 1338 | |
1339 | 1339 | |
@@ -1341,8 +1341,8 @@ discard block |
||
1341 | 1341 | |
1342 | 1342 | case 'give_payment': |
1343 | 1343 | // _give_payment_total. |
1344 | - if ( ! empty( $meta['_give_payment_total'][0] ) ) { |
|
1345 | - update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) ); |
|
1344 | + if ( ! empty($meta['_give_payment_total'][0])) { |
|
1345 | + update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0])); |
|
1346 | 1346 | } |
1347 | 1347 | |
1348 | 1348 | break; |
@@ -1353,7 +1353,7 @@ discard block |
||
1353 | 1353 | wp_reset_postdata(); |
1354 | 1354 | } else { |
1355 | 1355 | // The Update Ran. |
1356 | - give_set_upgrade_complete( 'v1812_update_amount_values' ); |
|
1356 | + give_set_upgrade_complete('v1812_update_amount_values'); |
|
1357 | 1357 | } |
1358 | 1358 | } |
1359 | 1359 | |
@@ -1372,22 +1372,22 @@ discard block |
||
1372 | 1372 | $give_updates = Give_Updates::get_instance(); |
1373 | 1373 | |
1374 | 1374 | // form query. |
1375 | - $donors = Give()->donors->get_donors( array( |
|
1375 | + $donors = Give()->donors->get_donors(array( |
|
1376 | 1376 | 'number' => 20, |
1377 | - 'offset' => $give_updates->get_offset( 20 ), |
|
1377 | + 'offset' => $give_updates->get_offset(20), |
|
1378 | 1378 | ) |
1379 | 1379 | ); |
1380 | 1380 | |
1381 | - if ( ! empty( $donors ) ) { |
|
1382 | - $give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) ); |
|
1381 | + if ( ! empty($donors)) { |
|
1382 | + $give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20)); |
|
1383 | 1383 | |
1384 | 1384 | /* @var Object $donor */ |
1385 | - foreach ( $donors as $donor ) { |
|
1386 | - Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) ); |
|
1385 | + foreach ($donors as $donor) { |
|
1386 | + Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value))); |
|
1387 | 1387 | } |
1388 | 1388 | } else { |
1389 | 1389 | // The Update Ran. |
1390 | - give_set_upgrade_complete( 'v1812_update_donor_purchase_values' ); |
|
1390 | + give_set_upgrade_complete('v1812_update_donor_purchase_values'); |
|
1391 | 1391 | } |
1392 | 1392 | } |
1393 | 1393 | |
@@ -1401,25 +1401,25 @@ discard block |
||
1401 | 1401 | $give_updates = Give_Updates::get_instance(); |
1402 | 1402 | |
1403 | 1403 | // Fetch all the existing donors. |
1404 | - $donors = Give()->donors->get_donors( array( |
|
1404 | + $donors = Give()->donors->get_donors(array( |
|
1405 | 1405 | 'number' => 20, |
1406 | - 'offset' => $give_updates->get_offset( 20 ), |
|
1406 | + 'offset' => $give_updates->get_offset(20), |
|
1407 | 1407 | ) |
1408 | 1408 | ); |
1409 | 1409 | |
1410 | - if ( ! empty( $donors ) ) { |
|
1411 | - $give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) ); |
|
1410 | + if ( ! empty($donors)) { |
|
1411 | + $give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20)); |
|
1412 | 1412 | |
1413 | 1413 | /* @var Object $donor */ |
1414 | - foreach ( $donors as $donor ) { |
|
1414 | + foreach ($donors as $donor) { |
|
1415 | 1415 | $user_id = $donor->user_id; |
1416 | 1416 | |
1417 | 1417 | // Proceed, if donor is attached with user. |
1418 | - if ( $user_id ) { |
|
1419 | - $user = get_userdata( $user_id ); |
|
1418 | + if ($user_id) { |
|
1419 | + $user = get_userdata($user_id); |
|
1420 | 1420 | |
1421 | 1421 | // Update user role, if user has subscriber role. |
1422 | - if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) { |
|
1422 | + if (is_array($user->roles) && in_array('subscriber', $user->roles)) { |
|
1423 | 1423 | wp_update_user( |
1424 | 1424 | array( |
1425 | 1425 | 'ID' => $user_id, |
@@ -1431,7 +1431,7 @@ discard block |
||
1431 | 1431 | } |
1432 | 1432 | } else { |
1433 | 1433 | // The Update Ran. |
1434 | - give_set_upgrade_complete( 'v1813_update_donor_user_roles' ); |
|
1434 | + give_set_upgrade_complete('v1813_update_donor_user_roles'); |
|
1435 | 1435 | } |
1436 | 1436 | } |
1437 | 1437 | |
@@ -1443,7 +1443,7 @@ discard block |
||
1443 | 1443 | */ |
1444 | 1444 | function give_v1813_upgrades() { |
1445 | 1445 | // Update admin setting. |
1446 | - give_update_option( 'donor_default_user_role', 'give_donor' ); |
|
1446 | + give_update_option('donor_default_user_role', 'give_donor'); |
|
1447 | 1447 | |
1448 | 1448 | // Update Give roles. |
1449 | 1449 | $roles = new Give_Roles(); |
@@ -1461,33 +1461,33 @@ discard block |
||
1461 | 1461 | $give_updates = Give_Updates::get_instance(); |
1462 | 1462 | |
1463 | 1463 | // form query. |
1464 | - $payments = new WP_Query( array( |
|
1464 | + $payments = new WP_Query(array( |
|
1465 | 1465 | 'paged' => $give_updates->step, |
1466 | 1466 | 'status' => 'any', |
1467 | 1467 | 'order' => 'ASC', |
1468 | - 'post_type' => array( 'give_payment' ), |
|
1468 | + 'post_type' => array('give_payment'), |
|
1469 | 1469 | 'posts_per_page' => 100, |
1470 | 1470 | ) |
1471 | 1471 | ); |
1472 | 1472 | |
1473 | - if ( $payments->have_posts() ) { |
|
1474 | - $give_updates->set_percentage( $payments->found_posts, ( $give_updates->step * 100 ) ); |
|
1473 | + if ($payments->have_posts()) { |
|
1474 | + $give_updates->set_percentage($payments->found_posts, ($give_updates->step * 100)); |
|
1475 | 1475 | |
1476 | - while ( $payments->have_posts() ) { |
|
1476 | + while ($payments->have_posts()) { |
|
1477 | 1477 | $payments->the_post(); |
1478 | 1478 | |
1479 | - $payment_meta = give_get_payment_meta( get_the_ID() ); |
|
1479 | + $payment_meta = give_get_payment_meta(get_the_ID()); |
|
1480 | 1480 | |
1481 | - if ( 'RIAL' === $payment_meta['currency'] ) { |
|
1481 | + if ('RIAL' === $payment_meta['currency']) { |
|
1482 | 1482 | $payment_meta['currency'] = 'IRR'; |
1483 | - give_update_meta( get_the_ID(), '_give_payment_meta', $payment_meta ); |
|
1483 | + give_update_meta(get_the_ID(), '_give_payment_meta', $payment_meta); |
|
1484 | 1484 | } |
1485 | 1485 | |
1486 | 1486 | } |
1487 | 1487 | |
1488 | 1488 | } else { |
1489 | 1489 | // The Update Ran. |
1490 | - give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' ); |
|
1490 | + give_set_upgrade_complete('v1817_update_donation_iranian_currency_code'); |
|
1491 | 1491 | } |
1492 | 1492 | } |
1493 | 1493 | |
@@ -1500,9 +1500,9 @@ discard block |
||
1500 | 1500 | function give_v1817_upgrades() { |
1501 | 1501 | $give_settings = give_get_settings(); |
1502 | 1502 | |
1503 | - if ( 'RIAL' === $give_settings['currency'] ) { |
|
1503 | + if ('RIAL' === $give_settings['currency']) { |
|
1504 | 1504 | $give_settings['currency'] = 'IRR'; |
1505 | - update_option( 'give_settings', $give_settings ); |
|
1505 | + update_option('give_settings', $give_settings); |
|
1506 | 1506 | } |
1507 | 1507 | } |
1508 | 1508 | |
@@ -1515,7 +1515,7 @@ discard block |
||
1515 | 1515 | |
1516 | 1516 | global $wp_roles; |
1517 | 1517 | |
1518 | - if ( ! ( $wp_roles instanceof WP_Roles ) ) { |
|
1518 | + if ( ! ($wp_roles instanceof WP_Roles)) { |
|
1519 | 1519 | return; |
1520 | 1520 | } |
1521 | 1521 | |
@@ -1539,15 +1539,15 @@ discard block |
||
1539 | 1539 | ), |
1540 | 1540 | ); |
1541 | 1541 | |
1542 | - foreach ( $add_caps as $role => $caps ) { |
|
1543 | - foreach ( $caps as $cap ) { |
|
1544 | - $wp_roles->add_cap( $role, $cap ); |
|
1542 | + foreach ($add_caps as $role => $caps) { |
|
1543 | + foreach ($caps as $cap) { |
|
1544 | + $wp_roles->add_cap($role, $cap); |
|
1545 | 1545 | } |
1546 | 1546 | } |
1547 | 1547 | |
1548 | - foreach ( $remove_caps as $role => $caps ) { |
|
1549 | - foreach ( $caps as $cap ) { |
|
1550 | - $wp_roles->remove_cap( $role, $cap ); |
|
1548 | + foreach ($remove_caps as $role => $caps) { |
|
1549 | + foreach ($caps as $cap) { |
|
1550 | + $wp_roles->remove_cap($role, $cap); |
|
1551 | 1551 | } |
1552 | 1552 | } |
1553 | 1553 | |
@@ -1571,7 +1571,7 @@ discard block |
||
1571 | 1571 | $roles->add_roles(); |
1572 | 1572 | $roles->add_caps(); |
1573 | 1573 | |
1574 | - give_set_upgrade_complete( 'v1817_cleanup_user_roles' ); |
|
1574 | + give_set_upgrade_complete('v1817_cleanup_user_roles'); |
|
1575 | 1575 | } |
1576 | 1576 | |
1577 | 1577 | /** |
@@ -1582,7 +1582,7 @@ discard block |
||
1582 | 1582 | function give_v1818_upgrades() { |
1583 | 1583 | |
1584 | 1584 | // Remove email_access_installed from give_settings. |
1585 | - give_delete_option( 'email_access_installed' ); |
|
1585 | + give_delete_option('email_access_installed'); |
|
1586 | 1586 | } |
1587 | 1587 | |
1588 | 1588 | /** |
@@ -1595,23 +1595,23 @@ discard block |
||
1595 | 1595 | /* @var Give_Updates $give_updates */ |
1596 | 1596 | $give_updates = Give_Updates::get_instance(); |
1597 | 1597 | |
1598 | - $donations = new WP_Query( array( |
|
1598 | + $donations = new WP_Query(array( |
|
1599 | 1599 | 'paged' => $give_updates->step, |
1600 | 1600 | 'status' => 'any', |
1601 | 1601 | 'order' => 'ASC', |
1602 | - 'post_type' => array( 'give_payment' ), |
|
1602 | + 'post_type' => array('give_payment'), |
|
1603 | 1603 | 'posts_per_page' => 100, |
1604 | 1604 | ) |
1605 | 1605 | ); |
1606 | 1606 | |
1607 | - if ( $donations->have_posts() ) { |
|
1608 | - $give_updates->set_percentage( $donations->found_posts, $give_updates->step * 100 ); |
|
1607 | + if ($donations->have_posts()) { |
|
1608 | + $give_updates->set_percentage($donations->found_posts, $give_updates->step * 100); |
|
1609 | 1609 | |
1610 | - while ( $donations->have_posts() ) { |
|
1610 | + while ($donations->have_posts()) { |
|
1611 | 1611 | $donations->the_post(); |
1612 | 1612 | |
1613 | - $form = new Give_Donate_Form( give_get_meta( get_the_ID(), '_give_payment_form_id', true ) ); |
|
1614 | - $donation_meta = give_get_payment_meta( get_the_ID() ); |
|
1613 | + $form = new Give_Donate_Form(give_get_meta(get_the_ID(), '_give_payment_form_id', true)); |
|
1614 | + $donation_meta = give_get_payment_meta(get_the_ID()); |
|
1615 | 1615 | |
1616 | 1616 | // Update Donation meta with price_id set as custom, only if it is: |
1617 | 1617 | // 1. Donation Type = Set Donation. |
@@ -1620,19 +1620,19 @@ discard block |
||
1620 | 1620 | if ( |
1621 | 1621 | $form->ID && |
1622 | 1622 | $form->is_set_type_donation_form() && |
1623 | - ( 'custom' !== $donation_meta['price_id'] ) && |
|
1624 | - $form->is_custom_price( give_get_meta( get_the_ID(), '_give_payment_total', true ) ) |
|
1623 | + ('custom' !== $donation_meta['price_id']) && |
|
1624 | + $form->is_custom_price(give_get_meta(get_the_ID(), '_give_payment_total', true)) |
|
1625 | 1625 | ) { |
1626 | 1626 | $donation_meta['price_id'] = 'custom'; |
1627 | - give_update_meta( get_the_ID(), '_give_payment_meta', $donation_meta ); |
|
1628 | - give_update_meta( get_the_ID(), '_give_payment_price_id', 'custom' ); |
|
1627 | + give_update_meta(get_the_ID(), '_give_payment_meta', $donation_meta); |
|
1628 | + give_update_meta(get_the_ID(), '_give_payment_price_id', 'custom'); |
|
1629 | 1629 | } |
1630 | 1630 | } |
1631 | 1631 | |
1632 | 1632 | wp_reset_postdata(); |
1633 | 1633 | } else { |
1634 | 1634 | // Update Ran Successfully. |
1635 | - give_set_upgrade_complete( 'v1818_assign_custom_amount_set_donation' ); |
|
1635 | + give_set_upgrade_complete('v1818_assign_custom_amount_set_donation'); |
|
1636 | 1636 | } |
1637 | 1637 | } |
1638 | 1638 | |
@@ -1650,7 +1650,7 @@ discard block |
||
1650 | 1650 | |
1651 | 1651 | global $wp_roles; |
1652 | 1652 | |
1653 | - if ( ! ( $wp_roles instanceof WP_Roles ) ) { |
|
1653 | + if ( ! ($wp_roles instanceof WP_Roles)) { |
|
1654 | 1654 | return; |
1655 | 1655 | } |
1656 | 1656 | |
@@ -1668,9 +1668,9 @@ discard block |
||
1668 | 1668 | ), |
1669 | 1669 | ); |
1670 | 1670 | |
1671 | - foreach ( $remove_caps as $role => $caps ) { |
|
1672 | - foreach ( $caps as $cap ) { |
|
1673 | - $wp_roles->remove_cap( $role, $cap ); |
|
1671 | + foreach ($remove_caps as $role => $caps) { |
|
1672 | + foreach ($caps as $cap) { |
|
1673 | + $wp_roles->remove_cap($role, $cap); |
|
1674 | 1674 | } |
1675 | 1675 | } |
1676 | 1676 | |
@@ -1681,7 +1681,7 @@ discard block |
||
1681 | 1681 | $roles->add_roles(); |
1682 | 1682 | $roles->add_caps(); |
1683 | 1683 | |
1684 | - give_set_upgrade_complete( 'v1818_give_worker_role_cleanup' ); |
|
1684 | + give_set_upgrade_complete('v1818_give_worker_role_cleanup'); |
|
1685 | 1685 | } |
1686 | 1686 | |
1687 | 1687 | /** |
@@ -1695,7 +1695,7 @@ discard block |
||
1695 | 1695 | $give_updates = Give_Updates::get_instance(); |
1696 | 1696 | |
1697 | 1697 | // form query |
1698 | - $forms = new WP_Query( array( |
|
1698 | + $forms = new WP_Query(array( |
|
1699 | 1699 | 'paged' => $give_updates->step, |
1700 | 1700 | 'status' => 'any', |
1701 | 1701 | 'order' => 'ASC', |
@@ -1704,22 +1704,22 @@ discard block |
||
1704 | 1704 | ) |
1705 | 1705 | ); |
1706 | 1706 | |
1707 | - if ( $forms->have_posts() ) { |
|
1708 | - $give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) ); |
|
1707 | + if ($forms->have_posts()) { |
|
1708 | + $give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100)); |
|
1709 | 1709 | |
1710 | - while ( $forms->have_posts() ) { |
|
1710 | + while ($forms->have_posts()) { |
|
1711 | 1711 | $forms->the_post(); |
1712 | 1712 | global $post; |
1713 | 1713 | |
1714 | 1714 | // Update offline instruction email notification status. |
1715 | - $offline_instruction_notification_status = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true ); |
|
1716 | - $offline_instruction_notification_status = give_is_setting_enabled( $offline_instruction_notification_status, array( |
|
1715 | + $offline_instruction_notification_status = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true); |
|
1716 | + $offline_instruction_notification_status = give_is_setting_enabled($offline_instruction_notification_status, array( |
|
1717 | 1717 | 'enabled', |
1718 | 1718 | 'global', |
1719 | - ) ) |
|
1719 | + )) |
|
1720 | 1720 | ? $offline_instruction_notification_status |
1721 | 1721 | : 'global'; |
1722 | - update_post_meta( get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status ); |
|
1722 | + update_post_meta(get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status); |
|
1723 | 1723 | |
1724 | 1724 | // Update offline instruction email message. |
1725 | 1725 | update_post_meta( |
@@ -1751,7 +1751,7 @@ discard block |
||
1751 | 1751 | wp_reset_postdata(); |
1752 | 1752 | } else { |
1753 | 1753 | // No more forms found, finish up. |
1754 | - give_set_upgrade_complete( 'v20_upgrades_form_metadata' ); |
|
1754 | + give_set_upgrade_complete('v20_upgrades_form_metadata'); |
|
1755 | 1755 | } |
1756 | 1756 | } |
1757 | 1757 | |
@@ -1768,7 +1768,7 @@ discard block |
||
1768 | 1768 | $give_updates = Give_Updates::get_instance(); |
1769 | 1769 | |
1770 | 1770 | // form query |
1771 | - $forms = new WP_Query( array( |
|
1771 | + $forms = new WP_Query(array( |
|
1772 | 1772 | 'paged' => $give_updates->step, |
1773 | 1773 | 'status' => 'any', |
1774 | 1774 | 'order' => 'ASC', |
@@ -1777,19 +1777,19 @@ discard block |
||
1777 | 1777 | ) |
1778 | 1778 | ); |
1779 | 1779 | |
1780 | - if ( $forms->have_posts() ) { |
|
1781 | - $give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) ); |
|
1780 | + if ($forms->have_posts()) { |
|
1781 | + $give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100)); |
|
1782 | 1782 | |
1783 | - while ( $forms->have_posts() ) { |
|
1783 | + while ($forms->have_posts()) { |
|
1784 | 1784 | $forms->the_post(); |
1785 | 1785 | global $post; |
1786 | 1786 | |
1787 | 1787 | // Split _give_payment_meta meta. |
1788 | 1788 | // @todo Remove _give_payment_meta after releases 2.0 |
1789 | - $payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true ); |
|
1789 | + $payment_meta = give_get_meta($post->ID, '_give_payment_meta', true); |
|
1790 | 1790 | |
1791 | - if ( ! empty( $payment_meta ) ) { |
|
1792 | - _give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta ); |
|
1791 | + if ( ! empty($payment_meta)) { |
|
1792 | + _give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta); |
|
1793 | 1793 | } |
1794 | 1794 | |
1795 | 1795 | $deprecated_meta_keys = array( |
@@ -1798,9 +1798,9 @@ discard block |
||
1798 | 1798 | '_give_payment_user_ip' => '_give_payment_donor_ip', |
1799 | 1799 | ); |
1800 | 1800 | |
1801 | - foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) { |
|
1801 | + foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) { |
|
1802 | 1802 | // Do not add new meta key if already exist. |
1803 | - if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) { |
|
1803 | + if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) { |
|
1804 | 1804 | continue; |
1805 | 1805 | } |
1806 | 1806 | |
@@ -1809,25 +1809,25 @@ discard block |
||
1809 | 1809 | array( |
1810 | 1810 | 'post_id' => $post->ID, |
1811 | 1811 | 'meta_key' => $new_meta_key, |
1812 | - 'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ), |
|
1812 | + 'meta_value' => give_get_meta($post->ID, $old_meta_key, true), |
|
1813 | 1813 | ) |
1814 | 1814 | ); |
1815 | 1815 | } |
1816 | 1816 | |
1817 | 1817 | // Bailout |
1818 | - if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) { |
|
1818 | + if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) { |
|
1819 | 1819 | /* @var Give_Donor $donor */ |
1820 | - $donor = new Give_Donor( $donor_id ); |
|
1820 | + $donor = new Give_Donor($donor_id); |
|
1821 | 1821 | |
1822 | - $address['line1'] = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' ); |
|
1823 | - $address['line2'] = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' ); |
|
1824 | - $address['city'] = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' ); |
|
1825 | - $address['state'] = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' ); |
|
1826 | - $address['zip'] = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' ); |
|
1827 | - $address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' ); |
|
1822 | + $address['line1'] = give_get_meta($post->ID, '_give_donor_billing_address1', true, ''); |
|
1823 | + $address['line2'] = give_get_meta($post->ID, '_give_donor_billing_address2', true, ''); |
|
1824 | + $address['city'] = give_get_meta($post->ID, '_give_donor_billing_city', true, ''); |
|
1825 | + $address['state'] = give_get_meta($post->ID, '_give_donor_billing_state', true, ''); |
|
1826 | + $address['zip'] = give_get_meta($post->ID, '_give_donor_billing_zip', true, ''); |
|
1827 | + $address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, ''); |
|
1828 | 1828 | |
1829 | 1829 | // Save address. |
1830 | - $donor->add_address( 'billing[]', $address ); |
|
1830 | + $donor->add_address('billing[]', $address); |
|
1831 | 1831 | } |
1832 | 1832 | |
1833 | 1833 | }// End while(). |
@@ -1838,7 +1838,7 @@ discard block |
||
1838 | 1838 | // $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) ); |
1839 | 1839 | |
1840 | 1840 | // No more forms found, finish up. |
1841 | - give_set_upgrade_complete( 'v20_upgrades_payment_metadata' ); |
|
1841 | + give_set_upgrade_complete('v20_upgrades_payment_metadata'); |
|
1842 | 1842 | } |
1843 | 1843 | } |
1844 | 1844 | |
@@ -1854,7 +1854,7 @@ discard block |
||
1854 | 1854 | $give_updates = Give_Updates::get_instance(); |
1855 | 1855 | |
1856 | 1856 | // form query |
1857 | - $forms = new WP_Query( array( |
|
1857 | + $forms = new WP_Query(array( |
|
1858 | 1858 | 'paged' => $give_updates->step, |
1859 | 1859 | 'order' => 'DESC', |
1860 | 1860 | 'post_type' => 'give_log', |
@@ -1863,20 +1863,20 @@ discard block |
||
1863 | 1863 | ) |
1864 | 1864 | ); |
1865 | 1865 | |
1866 | - if ( $forms->have_posts() ) { |
|
1867 | - $give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 ); |
|
1866 | + if ($forms->have_posts()) { |
|
1867 | + $give_updates->set_percentage($forms->found_posts, $give_updates->step * 100); |
|
1868 | 1868 | |
1869 | - while ( $forms->have_posts() ) { |
|
1869 | + while ($forms->have_posts()) { |
|
1870 | 1870 | $forms->the_post(); |
1871 | 1871 | global $post; |
1872 | 1872 | |
1873 | - if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) { |
|
1873 | + if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) { |
|
1874 | 1874 | continue; |
1875 | 1875 | } |
1876 | 1876 | |
1877 | - $term = get_the_terms( $post->ID, 'give_log_type' ); |
|
1878 | - $term = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array(); |
|
1879 | - $term_name = ! empty( $term ) ? $term->slug : ''; |
|
1877 | + $term = get_the_terms($post->ID, 'give_log_type'); |
|
1878 | + $term = ! is_wp_error($term) && ! empty($term) ? $term[0] : array(); |
|
1879 | + $term_name = ! empty($term) ? $term->slug : ''; |
|
1880 | 1880 | |
1881 | 1881 | $log_data = array( |
1882 | 1882 | 'ID' => $post->ID, |
@@ -1889,29 +1889,29 @@ discard block |
||
1889 | 1889 | ); |
1890 | 1890 | $log_meta = array(); |
1891 | 1891 | |
1892 | - if ( $old_log_meta = get_post_meta( $post->ID ) ) { |
|
1893 | - foreach ( $old_log_meta as $meta_key => $meta_value ) { |
|
1894 | - switch ( $meta_key ) { |
|
1892 | + if ($old_log_meta = get_post_meta($post->ID)) { |
|
1893 | + foreach ($old_log_meta as $meta_key => $meta_value) { |
|
1894 | + switch ($meta_key) { |
|
1895 | 1895 | case '_give_log_payment_id': |
1896 | - $log_data['log_parent'] = current( $meta_value ); |
|
1896 | + $log_data['log_parent'] = current($meta_value); |
|
1897 | 1897 | $log_meta['_give_log_form_id'] = $post->post_parent; |
1898 | 1898 | break; |
1899 | 1899 | |
1900 | 1900 | default: |
1901 | - $log_meta[ $meta_key ] = current( $meta_value ); |
|
1901 | + $log_meta[$meta_key] = current($meta_value); |
|
1902 | 1902 | } |
1903 | 1903 | } |
1904 | 1904 | } |
1905 | 1905 | |
1906 | - if ( 'api_request' === $term_name ) { |
|
1906 | + if ('api_request' === $term_name) { |
|
1907 | 1907 | $log_meta['_give_log_api_query'] = $post->post_excerpt; |
1908 | 1908 | } |
1909 | 1909 | |
1910 | - $wpdb->insert( "{$wpdb->prefix}give_logs", $log_data ); |
|
1910 | + $wpdb->insert("{$wpdb->prefix}give_logs", $log_data); |
|
1911 | 1911 | |
1912 | - if ( ! empty( $log_meta ) ) { |
|
1913 | - foreach ( $log_meta as $meta_key => $meta_value ) { |
|
1914 | - Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value ); |
|
1912 | + if ( ! empty($log_meta)) { |
|
1913 | + foreach ($log_meta as $meta_key => $meta_value) { |
|
1914 | + Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value); |
|
1915 | 1915 | } |
1916 | 1916 | } |
1917 | 1917 | |
@@ -1953,7 +1953,7 @@ discard block |
||
1953 | 1953 | Give()->logs->delete_cache(); |
1954 | 1954 | |
1955 | 1955 | // No more forms found, finish up. |
1956 | - give_set_upgrade_complete( 'v20_logs_upgrades' ); |
|
1956 | + give_set_upgrade_complete('v20_logs_upgrades'); |
|
1957 | 1957 | } |
1958 | 1958 | } |
1959 | 1959 | |
@@ -1969,19 +1969,19 @@ discard block |
||
1969 | 1969 | $give_updates = Give_Updates::get_instance(); |
1970 | 1970 | |
1971 | 1971 | // form query |
1972 | - $payments = new WP_Query( array( |
|
1972 | + $payments = new WP_Query(array( |
|
1973 | 1973 | 'paged' => $give_updates->step, |
1974 | 1974 | 'status' => 'any', |
1975 | 1975 | 'order' => 'ASC', |
1976 | - 'post_type' => array( 'give_forms', 'give_payment' ), |
|
1976 | + 'post_type' => array('give_forms', 'give_payment'), |
|
1977 | 1977 | 'posts_per_page' => 100, |
1978 | 1978 | ) |
1979 | 1979 | ); |
1980 | 1980 | |
1981 | - if ( $payments->have_posts() ) { |
|
1982 | - $give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 ); |
|
1981 | + if ($payments->have_posts()) { |
|
1982 | + $give_updates->set_percentage($payments->found_posts, $give_updates->step * 100); |
|
1983 | 1983 | |
1984 | - while ( $payments->have_posts() ) { |
|
1984 | + while ($payments->have_posts()) { |
|
1985 | 1985 | $payments->the_post(); |
1986 | 1986 | global $post; |
1987 | 1987 | |
@@ -1993,19 +1993,19 @@ discard block |
||
1993 | 1993 | ARRAY_A |
1994 | 1994 | ); |
1995 | 1995 | |
1996 | - if ( ! empty( $meta_data ) ) { |
|
1997 | - foreach ( $meta_data as $index => $data ) { |
|
1996 | + if ( ! empty($meta_data)) { |
|
1997 | + foreach ($meta_data as $index => $data) { |
|
1998 | 1998 | // Check for duplicate meta values. |
1999 | - if ( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) { |
|
1999 | + if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) { |
|
2000 | 2000 | continue; |
2001 | 2001 | } |
2002 | 2002 | |
2003 | - switch ( $post->post_type ) { |
|
2003 | + switch ($post->post_type) { |
|
2004 | 2004 | case 'give_forms': |
2005 | 2005 | $data['form_id'] = $data['post_id']; |
2006 | - unset( $data['post_id'] ); |
|
2006 | + unset($data['post_id']); |
|
2007 | 2007 | |
2008 | - Give()->form_meta->insert( $data ); |
|
2008 | + Give()->form_meta->insert($data); |
|
2009 | 2009 | // @todo: delete form meta from post meta table after releases 2.0. |
2010 | 2010 | /*delete_post_meta( get_the_ID(), $data['meta_key'] );*/ |
2011 | 2011 | |
@@ -2013,9 +2013,9 @@ discard block |
||
2013 | 2013 | |
2014 | 2014 | case 'give_payment': |
2015 | 2015 | $data['payment_id'] = $data['post_id']; |
2016 | - unset( $data['post_id'] ); |
|
2016 | + unset($data['post_id']); |
|
2017 | 2017 | |
2018 | - Give()->payment_meta->insert( $data ); |
|
2018 | + Give()->payment_meta->insert($data); |
|
2019 | 2019 | |
2020 | 2020 | // @todo: delete donation meta from post meta table after releases 2.0. |
2021 | 2021 | /*delete_post_meta( get_the_ID(), $data['meta_key'] );*/ |
@@ -2030,7 +2030,7 @@ discard block |
||
2030 | 2030 | wp_reset_postdata(); |
2031 | 2031 | } else { |
2032 | 2032 | // No more forms found, finish up. |
2033 | - give_set_upgrade_complete( 'v20_move_metadata_into_new_table' ); |
|
2033 | + give_set_upgrade_complete('v20_move_metadata_into_new_table'); |
|
2034 | 2034 | } |
2035 | 2035 | |
2036 | 2036 | } |
@@ -2046,44 +2046,44 @@ discard block |
||
2046 | 2046 | /* @var Give_Updates $give_updates */ |
2047 | 2047 | $give_updates = Give_Updates::get_instance(); |
2048 | 2048 | |
2049 | - $donors = Give()->donors->get_donors( array( |
|
2049 | + $donors = Give()->donors->get_donors(array( |
|
2050 | 2050 | 'paged' => $give_updates->step, |
2051 | 2051 | 'number' => 100, |
2052 | - ) ); |
|
2052 | + )); |
|
2053 | 2053 | |
2054 | - if ( $donors ) { |
|
2055 | - $give_updates->set_percentage( count( $donors ), $give_updates->step * 100 ); |
|
2054 | + if ($donors) { |
|
2055 | + $give_updates->set_percentage(count($donors), $give_updates->step * 100); |
|
2056 | 2056 | // Loop through Donors |
2057 | - foreach ( $donors as $donor ) { |
|
2057 | + foreach ($donors as $donor) { |
|
2058 | 2058 | |
2059 | - $donor_name = explode( ' ', $donor->name, 2 ); |
|
2060 | - $donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' ); |
|
2061 | - $donor_last_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' ); |
|
2059 | + $donor_name = explode(' ', $donor->name, 2); |
|
2060 | + $donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name'); |
|
2061 | + $donor_last_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name'); |
|
2062 | 2062 | |
2063 | 2063 | // If first name meta of donor is not created, then create it. |
2064 | - if ( ! $donor_first_name && isset( $donor_name[0] ) ) { |
|
2065 | - Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] ); |
|
2064 | + if ( ! $donor_first_name && isset($donor_name[0])) { |
|
2065 | + Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]); |
|
2066 | 2066 | } |
2067 | 2067 | |
2068 | 2068 | // If last name meta of donor is not created, then create it. |
2069 | - if ( ! $donor_last_name && isset( $donor_name[1] ) ) { |
|
2070 | - Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] ); |
|
2069 | + if ( ! $donor_last_name && isset($donor_name[1])) { |
|
2070 | + Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]); |
|
2071 | 2071 | } |
2072 | 2072 | |
2073 | 2073 | // If Donor is connected with WP User then update user meta. |
2074 | - if ( $donor->user_id ) { |
|
2075 | - if ( isset( $donor_name[0] ) ) { |
|
2076 | - update_user_meta( $donor->user_id, 'first_name', $donor_name[0] ); |
|
2074 | + if ($donor->user_id) { |
|
2075 | + if (isset($donor_name[0])) { |
|
2076 | + update_user_meta($donor->user_id, 'first_name', $donor_name[0]); |
|
2077 | 2077 | } |
2078 | - if ( isset( $donor_name[1] ) ) { |
|
2079 | - update_user_meta( $donor->user_id, 'last_name', $donor_name[1] ); |
|
2078 | + if (isset($donor_name[1])) { |
|
2079 | + update_user_meta($donor->user_id, 'last_name', $donor_name[1]); |
|
2080 | 2080 | } |
2081 | 2081 | } |
2082 | 2082 | } |
2083 | 2083 | |
2084 | 2084 | } else { |
2085 | 2085 | // The Update Ran. |
2086 | - give_set_upgrade_complete( 'v20_upgrades_donor_name' ); |
|
2086 | + give_set_upgrade_complete('v20_upgrades_donor_name'); |
|
2087 | 2087 | } |
2088 | 2088 | |
2089 | 2089 | } |
@@ -2112,15 +2112,15 @@ discard block |
||
2112 | 2112 | |
2113 | 2113 | $users = $user_query->get_results(); |
2114 | 2114 | |
2115 | - if ( $users ) { |
|
2116 | - $give_updates->set_percentage( $user_query->get_total(), $give_updates->step * 100 ); |
|
2115 | + if ($users) { |
|
2116 | + $give_updates->set_percentage($user_query->get_total(), $give_updates->step * 100); |
|
2117 | 2117 | |
2118 | 2118 | // Loop through Donors |
2119 | - foreach ( $users as $user ) { |
|
2119 | + foreach ($users as $user) { |
|
2120 | 2120 | /* @var Give_Donor $donor */ |
2121 | - $donor = new Give_Donor( $user->ID, true ); |
|
2121 | + $donor = new Give_Donor($user->ID, true); |
|
2122 | 2122 | |
2123 | - if ( ! $donor->id ) { |
|
2123 | + if ( ! $donor->id) { |
|
2124 | 2124 | continue; |
2125 | 2125 | } |
2126 | 2126 | |
@@ -2136,10 +2136,10 @@ discard block |
||
2136 | 2136 | ) |
2137 | 2137 | ); |
2138 | 2138 | |
2139 | - if ( ! empty( $address ) ) { |
|
2140 | - $address = maybe_unserialize( $address ); |
|
2141 | - $donor->add_address( 'personal', $address ); |
|
2142 | - $donor->add_address( 'billing[]', $address ); |
|
2139 | + if ( ! empty($address)) { |
|
2140 | + $address = maybe_unserialize($address); |
|
2141 | + $donor->add_address('personal', $address); |
|
2142 | + $donor->add_address('billing[]', $address); |
|
2143 | 2143 | |
2144 | 2144 | |
2145 | 2145 | // @todo: delete _give_user_address from user meta after releases 2.0. |
@@ -2149,7 +2149,7 @@ discard block |
||
2149 | 2149 | |
2150 | 2150 | } else { |
2151 | 2151 | // The Update Ran. |
2152 | - give_set_upgrade_complete( 'v20_upgrades_user_address' ); |
|
2152 | + give_set_upgrade_complete('v20_upgrades_user_address'); |
|
2153 | 2153 | } |
2154 | 2154 | |
2155 | 2155 | } |
@@ -2173,15 +2173,15 @@ discard block |
||
2173 | 2173 | ); |
2174 | 2174 | |
2175 | 2175 | // Alter customer table |
2176 | - foreach ( $tables as $old_table => $new_table ) { |
|
2176 | + foreach ($tables as $old_table => $new_table) { |
|
2177 | 2177 | if ( |
2178 | - $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $old_table ) ) && |
|
2179 | - ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $new_table ) ) |
|
2178 | + $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $old_table)) && |
|
2179 | + ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $new_table)) |
|
2180 | 2180 | ) { |
2181 | - $wpdb->query( "ALTER TABLE {$old_table} RENAME TO {$new_table}" ); |
|
2181 | + $wpdb->query("ALTER TABLE {$old_table} RENAME TO {$new_table}"); |
|
2182 | 2182 | |
2183 | - if ( "{$wpdb->prefix}give_donormeta" === $new_table ) { |
|
2184 | - $wpdb->query( "ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)" ); |
|
2183 | + if ("{$wpdb->prefix}give_donormeta" === $new_table) { |
|
2184 | + $wpdb->query("ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)"); |
|
2185 | 2185 | } |
2186 | 2186 | } |
2187 | 2187 | } |
@@ -2189,7 +2189,7 @@ discard block |
||
2189 | 2189 | $give_updates->percentage = 100; |
2190 | 2190 | |
2191 | 2191 | // No more forms found, finish up. |
2192 | - give_set_upgrade_complete( 'v20_rename_donor_tables' ); |
|
2192 | + give_set_upgrade_complete('v20_rename_donor_tables'); |
|
2193 | 2193 | |
2194 | 2194 | // Re initiate donor classes. |
2195 | 2195 | Give()->donors = new Give_DB_Donors(); |
@@ -2207,19 +2207,19 @@ discard block |
||
2207 | 2207 | function give_v201_create_tables() { |
2208 | 2208 | global $wpdb; |
2209 | 2209 | |
2210 | - if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta" ) ) ) { |
|
2210 | + if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta"))) { |
|
2211 | 2211 | Give()->payment_meta->create_table(); |
2212 | 2212 | } |
2213 | 2213 | |
2214 | - if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta" ) ) ) { |
|
2214 | + if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta"))) { |
|
2215 | 2215 | Give()->form_meta->create_table(); |
2216 | 2216 | } |
2217 | 2217 | |
2218 | - if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs" ) ) ) { |
|
2218 | + if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs"))) { |
|
2219 | 2219 | Give()->logs->log_db->create_table(); |
2220 | 2220 | } |
2221 | 2221 | |
2222 | - if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta" ) ) ) { |
|
2222 | + if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta"))) { |
|
2223 | 2223 | Give()->logs->logmeta_db->create_table(); |
2224 | 2224 | } |
2225 | 2225 | } |
@@ -2244,31 +2244,31 @@ discard block |
||
2244 | 2244 | $wpdb->posts.post_date >= '2018-01-08 00:00:00' |
2245 | 2245 | ) |
2246 | 2246 | AND $wpdb->posts.post_type = 'give_payment' |
2247 | - AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "') |
|
2247 | + AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."') |
|
2248 | 2248 | ORDER BY $wpdb->posts.post_date ASC |
2249 | 2249 | LIMIT 100 |
2250 | - OFFSET " . $give_updates->get_offset( 100 ) |
|
2250 | + OFFSET ".$give_updates->get_offset(100) |
|
2251 | 2251 | ); |
2252 | 2252 | |
2253 | - if ( ! empty( $payments ) ) { |
|
2254 | - $give_updates->set_percentage( give_get_total_post_type_count( 'give_payment' ), ( $give_updates->step * 100 ) ); |
|
2253 | + if ( ! empty($payments)) { |
|
2254 | + $give_updates->set_percentage(give_get_total_post_type_count('give_payment'), ($give_updates->step * 100)); |
|
2255 | 2255 | |
2256 | - foreach ( $payments as $payment_id ) { |
|
2257 | - $post = get_post( $payment_id ); |
|
2258 | - setup_postdata( $post ); |
|
2256 | + foreach ($payments as $payment_id) { |
|
2257 | + $post = get_post($payment_id); |
|
2258 | + setup_postdata($post); |
|
2259 | 2259 | |
2260 | 2260 | // Do not add new meta keys if already refactored. |
2261 | - if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id' ) ) ) { |
|
2261 | + if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id'))) { |
|
2262 | 2262 | continue; |
2263 | 2263 | } |
2264 | 2264 | |
2265 | 2265 | |
2266 | 2266 | // Split _give_payment_meta meta. |
2267 | 2267 | // @todo Remove _give_payment_meta after releases 2.0 |
2268 | - $payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true ); |
|
2268 | + $payment_meta = give_get_meta($post->ID, '_give_payment_meta', true); |
|
2269 | 2269 | |
2270 | - if ( ! empty( $payment_meta ) ) { |
|
2271 | - _give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta ); |
|
2270 | + if ( ! empty($payment_meta)) { |
|
2271 | + _give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta); |
|
2272 | 2272 | } |
2273 | 2273 | |
2274 | 2274 | $deprecated_meta_keys = array( |
@@ -2277,9 +2277,9 @@ discard block |
||
2277 | 2277 | '_give_payment_user_ip' => '_give_payment_donor_ip', |
2278 | 2278 | ); |
2279 | 2279 | |
2280 | - foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) { |
|
2280 | + foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) { |
|
2281 | 2281 | // Do not add new meta key if already exist. |
2282 | - if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) { |
|
2282 | + if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) { |
|
2283 | 2283 | continue; |
2284 | 2284 | } |
2285 | 2285 | |
@@ -2288,25 +2288,25 @@ discard block |
||
2288 | 2288 | array( |
2289 | 2289 | 'post_id' => $post->ID, |
2290 | 2290 | 'meta_key' => $new_meta_key, |
2291 | - 'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ), |
|
2291 | + 'meta_value' => give_get_meta($post->ID, $old_meta_key, true), |
|
2292 | 2292 | ) |
2293 | 2293 | ); |
2294 | 2294 | } |
2295 | 2295 | |
2296 | 2296 | // Bailout |
2297 | - if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) { |
|
2297 | + if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) { |
|
2298 | 2298 | /* @var Give_Donor $donor */ |
2299 | - $donor = new Give_Donor( $donor_id ); |
|
2299 | + $donor = new Give_Donor($donor_id); |
|
2300 | 2300 | |
2301 | - $address['line1'] = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' ); |
|
2302 | - $address['line2'] = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' ); |
|
2303 | - $address['city'] = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' ); |
|
2304 | - $address['state'] = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' ); |
|
2305 | - $address['zip'] = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' ); |
|
2306 | - $address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' ); |
|
2301 | + $address['line1'] = give_get_meta($post->ID, '_give_donor_billing_address1', true, ''); |
|
2302 | + $address['line2'] = give_get_meta($post->ID, '_give_donor_billing_address2', true, ''); |
|
2303 | + $address['city'] = give_get_meta($post->ID, '_give_donor_billing_city', true, ''); |
|
2304 | + $address['state'] = give_get_meta($post->ID, '_give_donor_billing_state', true, ''); |
|
2305 | + $address['zip'] = give_get_meta($post->ID, '_give_donor_billing_zip', true, ''); |
|
2306 | + $address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, ''); |
|
2307 | 2307 | |
2308 | 2308 | // Save address. |
2309 | - $donor->add_address( 'billing[]', $address ); |
|
2309 | + $donor->add_address('billing[]', $address); |
|
2310 | 2310 | } |
2311 | 2311 | |
2312 | 2312 | }// End while(). |
@@ -2317,7 +2317,7 @@ discard block |
||
2317 | 2317 | // $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) ); |
2318 | 2318 | |
2319 | 2319 | // No more forms found, finish up. |
2320 | - give_set_upgrade_complete( 'v201_upgrades_payment_metadata' ); |
|
2320 | + give_set_upgrade_complete('v201_upgrades_payment_metadata'); |
|
2321 | 2321 | } |
2322 | 2322 | } |
2323 | 2323 | |
@@ -2337,21 +2337,21 @@ discard block |
||
2337 | 2337 | SELECT ID FROM $wpdb->posts |
2338 | 2338 | WHERE 1=1 |
2339 | 2339 | AND ( $wpdb->posts.post_type = 'give_payment' OR $wpdb->posts.post_type = 'give_forms' ) |
2340 | - AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "') |
|
2340 | + AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."') |
|
2341 | 2341 | ORDER BY $wpdb->posts.post_date ASC |
2342 | 2342 | LIMIT 100 |
2343 | - OFFSET " . $give_updates->get_offset( 100 ) |
|
2343 | + OFFSET ".$give_updates->get_offset(100) |
|
2344 | 2344 | ); |
2345 | 2345 | |
2346 | - if ( ! empty( $payments ) ) { |
|
2347 | - $give_updates->set_percentage( give_get_total_post_type_count( array( |
|
2346 | + if ( ! empty($payments)) { |
|
2347 | + $give_updates->set_percentage(give_get_total_post_type_count(array( |
|
2348 | 2348 | 'give_forms', |
2349 | 2349 | 'give_payment', |
2350 | - ) ), $give_updates->step * 100 ); |
|
2350 | + )), $give_updates->step * 100); |
|
2351 | 2351 | |
2352 | - foreach ( $payments as $payment_id ) { |
|
2353 | - $post = get_post( $payment_id ); |
|
2354 | - setup_postdata( $post ); |
|
2352 | + foreach ($payments as $payment_id) { |
|
2353 | + $post = get_post($payment_id); |
|
2354 | + setup_postdata($post); |
|
2355 | 2355 | |
2356 | 2356 | $meta_data = $wpdb->get_results( |
2357 | 2357 | $wpdb->prepare( |
@@ -2361,19 +2361,19 @@ discard block |
||
2361 | 2361 | ARRAY_A |
2362 | 2362 | ); |
2363 | 2363 | |
2364 | - if ( ! empty( $meta_data ) ) { |
|
2365 | - foreach ( $meta_data as $index => $data ) { |
|
2364 | + if ( ! empty($meta_data)) { |
|
2365 | + foreach ($meta_data as $index => $data) { |
|
2366 | 2366 | // Check for duplicate meta values. |
2367 | - if ( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) { |
|
2367 | + if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) { |
|
2368 | 2368 | continue; |
2369 | 2369 | } |
2370 | 2370 | |
2371 | - switch ( $post->post_type ) { |
|
2371 | + switch ($post->post_type) { |
|
2372 | 2372 | case 'give_forms': |
2373 | 2373 | $data['form_id'] = $data['post_id']; |
2374 | - unset( $data['post_id'] ); |
|
2374 | + unset($data['post_id']); |
|
2375 | 2375 | |
2376 | - Give()->form_meta->insert( $data ); |
|
2376 | + Give()->form_meta->insert($data); |
|
2377 | 2377 | // @todo: delete form meta from post meta table after releases 2.0. |
2378 | 2378 | /*delete_post_meta( get_the_ID(), $data['meta_key'] );*/ |
2379 | 2379 | |
@@ -2381,9 +2381,9 @@ discard block |
||
2381 | 2381 | |
2382 | 2382 | case 'give_payment': |
2383 | 2383 | $data['payment_id'] = $data['post_id']; |
2384 | - unset( $data['post_id'] ); |
|
2384 | + unset($data['post_id']); |
|
2385 | 2385 | |
2386 | - Give()->payment_meta->insert( $data ); |
|
2386 | + Give()->payment_meta->insert($data); |
|
2387 | 2387 | |
2388 | 2388 | // @todo: delete donation meta from post meta table after releases 2.0. |
2389 | 2389 | /*delete_post_meta( get_the_ID(), $data['meta_key'] );*/ |
@@ -2398,7 +2398,7 @@ discard block |
||
2398 | 2398 | wp_reset_postdata(); |
2399 | 2399 | } else { |
2400 | 2400 | // No more forms found, finish up. |
2401 | - give_set_upgrade_complete( 'v201_move_metadata_into_new_table' ); |
|
2401 | + give_set_upgrade_complete('v201_move_metadata_into_new_table'); |
|
2402 | 2402 | } |
2403 | 2403 | |
2404 | 2404 | } |
@@ -2419,26 +2419,26 @@ discard block |
||
2419 | 2419 | SELECT ID FROM $wpdb->posts |
2420 | 2420 | WHERE 1=1 |
2421 | 2421 | AND $wpdb->posts.post_type = 'give_log' |
2422 | - AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "') |
|
2422 | + AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."') |
|
2423 | 2423 | ORDER BY $wpdb->posts.post_date ASC |
2424 | 2424 | LIMIT 100 |
2425 | - OFFSET " . $give_updates->get_offset( 100 ) |
|
2425 | + OFFSET ".$give_updates->get_offset(100) |
|
2426 | 2426 | ); |
2427 | 2427 | |
2428 | - if ( ! empty( $logs ) ) { |
|
2429 | - $give_updates->set_percentage( give_get_total_post_type_count( 'give_log' ), $give_updates->step * 100 ); |
|
2428 | + if ( ! empty($logs)) { |
|
2429 | + $give_updates->set_percentage(give_get_total_post_type_count('give_log'), $give_updates->step * 100); |
|
2430 | 2430 | |
2431 | - foreach ( $logs as $log_id ) { |
|
2432 | - $post = get_post( $log_id ); |
|
2433 | - setup_postdata( $post ); |
|
2431 | + foreach ($logs as $log_id) { |
|
2432 | + $post = get_post($log_id); |
|
2433 | + setup_postdata($post); |
|
2434 | 2434 | |
2435 | - if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) { |
|
2435 | + if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) { |
|
2436 | 2436 | continue; |
2437 | 2437 | } |
2438 | 2438 | |
2439 | - $term = get_the_terms( $post->ID, 'give_log_type' ); |
|
2440 | - $term = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array(); |
|
2441 | - $term_name = ! empty( $term ) ? $term->slug : ''; |
|
2439 | + $term = get_the_terms($post->ID, 'give_log_type'); |
|
2440 | + $term = ! is_wp_error($term) && ! empty($term) ? $term[0] : array(); |
|
2441 | + $term_name = ! empty($term) ? $term->slug : ''; |
|
2442 | 2442 | |
2443 | 2443 | $log_data = array( |
2444 | 2444 | 'ID' => $post->ID, |
@@ -2451,29 +2451,29 @@ discard block |
||
2451 | 2451 | ); |
2452 | 2452 | $log_meta = array(); |
2453 | 2453 | |
2454 | - if ( $old_log_meta = get_post_meta( $post->ID ) ) { |
|
2455 | - foreach ( $old_log_meta as $meta_key => $meta_value ) { |
|
2456 | - switch ( $meta_key ) { |
|
2454 | + if ($old_log_meta = get_post_meta($post->ID)) { |
|
2455 | + foreach ($old_log_meta as $meta_key => $meta_value) { |
|
2456 | + switch ($meta_key) { |
|
2457 | 2457 | case '_give_log_payment_id': |
2458 | - $log_data['log_parent'] = current( $meta_value ); |
|
2458 | + $log_data['log_parent'] = current($meta_value); |
|
2459 | 2459 | $log_meta['_give_log_form_id'] = $post->post_parent; |
2460 | 2460 | break; |
2461 | 2461 | |
2462 | 2462 | default: |
2463 | - $log_meta[ $meta_key ] = current( $meta_value ); |
|
2463 | + $log_meta[$meta_key] = current($meta_value); |
|
2464 | 2464 | } |
2465 | 2465 | } |
2466 | 2466 | } |
2467 | 2467 | |
2468 | - if ( 'api_request' === $term_name ) { |
|
2468 | + if ('api_request' === $term_name) { |
|
2469 | 2469 | $log_meta['_give_log_api_query'] = $post->post_excerpt; |
2470 | 2470 | } |
2471 | 2471 | |
2472 | - $wpdb->insert( "{$wpdb->prefix}give_logs", $log_data ); |
|
2472 | + $wpdb->insert("{$wpdb->prefix}give_logs", $log_data); |
|
2473 | 2473 | |
2474 | - if ( ! empty( $log_meta ) ) { |
|
2475 | - foreach ( $log_meta as $meta_key => $meta_value ) { |
|
2476 | - Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value ); |
|
2474 | + if ( ! empty($log_meta)) { |
|
2475 | + foreach ($log_meta as $meta_key => $meta_value) { |
|
2476 | + Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value); |
|
2477 | 2477 | } |
2478 | 2478 | } |
2479 | 2479 | |
@@ -2486,7 +2486,7 @@ discard block |
||
2486 | 2486 | Give()->logs->delete_cache(); |
2487 | 2487 | |
2488 | 2488 | // No more forms found, finish up. |
2489 | - give_set_upgrade_complete( 'v201_logs_upgrades' ); |
|
2489 | + give_set_upgrade_complete('v201_logs_upgrades'); |
|
2490 | 2490 | } |
2491 | 2491 | } |
2492 | 2492 | |
@@ -2501,51 +2501,51 @@ discard block |
||
2501 | 2501 | global $wpdb; |
2502 | 2502 | give_v201_create_tables(); |
2503 | 2503 | |
2504 | - if ( $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers" ) ) ) { |
|
2505 | - $customers = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_customers" ), 'id' ); |
|
2506 | - $donors = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_donors" ), 'id' ); |
|
2504 | + if ($wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers"))) { |
|
2505 | + $customers = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_customers"), 'id'); |
|
2506 | + $donors = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_donors"), 'id'); |
|
2507 | 2507 | $donor_data = array(); |
2508 | 2508 | |
2509 | - if ( $missing_donors = array_diff( $customers, $donors ) ) { |
|
2510 | - foreach ( $missing_donors as $donor_id ) { |
|
2509 | + if ($missing_donors = array_diff($customers, $donors)) { |
|
2510 | + foreach ($missing_donors as $donor_id) { |
|
2511 | 2511 | $donor_data[] = array( |
2512 | - 'info' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id ) ), |
|
2513 | - 'meta' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id ) ), |
|
2512 | + 'info' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id)), |
|
2513 | + 'meta' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id)), |
|
2514 | 2514 | |
2515 | 2515 | ); |
2516 | 2516 | } |
2517 | 2517 | } |
2518 | 2518 | |
2519 | - if ( ! empty( $donor_data ) ) { |
|
2519 | + if ( ! empty($donor_data)) { |
|
2520 | 2520 | $donor_table_name = Give()->donors->table_name; |
2521 | 2521 | $donor_meta_table_name = Give()->donor_meta->table_name; |
2522 | 2522 | |
2523 | 2523 | Give()->donors->table_name = "{$wpdb->prefix}give_donors"; |
2524 | 2524 | Give()->donor_meta->table_name = "{$wpdb->prefix}give_donormeta"; |
2525 | 2525 | |
2526 | - foreach ( $donor_data as $donor ) { |
|
2526 | + foreach ($donor_data as $donor) { |
|
2527 | 2527 | $donor['info'][0] = (array) $donor['info'][0]; |
2528 | 2528 | |
2529 | 2529 | // Prevent duplicate meta id issue. |
2530 | - if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id'] ) ) ) { |
|
2530 | + if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id']))) { |
|
2531 | 2531 | continue; |
2532 | 2532 | } |
2533 | 2533 | |
2534 | - $donor_id = Give()->donors->add( $donor['info'][0] ); |
|
2534 | + $donor_id = Give()->donors->add($donor['info'][0]); |
|
2535 | 2535 | |
2536 | - if ( ! empty( $donor['meta'] ) ) { |
|
2537 | - foreach ( $donor['meta'] as $donor_meta ) { |
|
2536 | + if ( ! empty($donor['meta'])) { |
|
2537 | + foreach ($donor['meta'] as $donor_meta) { |
|
2538 | 2538 | $donor_meta = (array) $donor_meta; |
2539 | 2539 | |
2540 | 2540 | // Prevent duplicate meta id issue. |
2541 | - if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id'] ) ) ) { |
|
2542 | - unset( $donor_meta['meta_id'] ); |
|
2541 | + if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id']))) { |
|
2542 | + unset($donor_meta['meta_id']); |
|
2543 | 2543 | } |
2544 | 2544 | |
2545 | 2545 | $donor_meta['donor_id'] = $donor_meta['customer_id']; |
2546 | - unset( $donor_meta['customer_id'] ); |
|
2546 | + unset($donor_meta['customer_id']); |
|
2547 | 2547 | |
2548 | - Give()->donor_meta->insert( $donor_meta ); |
|
2548 | + Give()->donor_meta->insert($donor_meta); |
|
2549 | 2549 | } |
2550 | 2550 | } |
2551 | 2551 | |
@@ -2564,35 +2564,35 @@ discard block |
||
2564 | 2564 | ) |
2565 | 2565 | ); |
2566 | 2566 | |
2567 | - $donor = new Give_Donor( $donor_id ); |
|
2567 | + $donor = new Give_Donor($donor_id); |
|
2568 | 2568 | |
2569 | - if ( ! empty( $address ) ) { |
|
2570 | - $address = maybe_unserialize( $address ); |
|
2571 | - $donor->add_address( 'personal', $address ); |
|
2572 | - $donor->add_address( 'billing[]', $address ); |
|
2569 | + if ( ! empty($address)) { |
|
2570 | + $address = maybe_unserialize($address); |
|
2571 | + $donor->add_address('personal', $address); |
|
2572 | + $donor->add_address('billing[]', $address); |
|
2573 | 2573 | } |
2574 | 2574 | |
2575 | - $donor_name = explode( ' ', $donor->name, 2 ); |
|
2576 | - $donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' ); |
|
2577 | - $donor_last_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' ); |
|
2575 | + $donor_name = explode(' ', $donor->name, 2); |
|
2576 | + $donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name'); |
|
2577 | + $donor_last_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name'); |
|
2578 | 2578 | |
2579 | 2579 | // If first name meta of donor is not created, then create it. |
2580 | - if ( ! $donor_first_name && isset( $donor_name[0] ) ) { |
|
2581 | - Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] ); |
|
2580 | + if ( ! $donor_first_name && isset($donor_name[0])) { |
|
2581 | + Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]); |
|
2582 | 2582 | } |
2583 | 2583 | |
2584 | 2584 | // If last name meta of donor is not created, then create it. |
2585 | - if ( ! $donor_last_name && isset( $donor_name[1] ) ) { |
|
2586 | - Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] ); |
|
2585 | + if ( ! $donor_last_name && isset($donor_name[1])) { |
|
2586 | + Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]); |
|
2587 | 2587 | } |
2588 | 2588 | |
2589 | 2589 | // If Donor is connected with WP User then update user meta. |
2590 | - if ( $donor->user_id ) { |
|
2591 | - if ( isset( $donor_name[0] ) ) { |
|
2592 | - update_user_meta( $donor->user_id, 'first_name', $donor_name[0] ); |
|
2590 | + if ($donor->user_id) { |
|
2591 | + if (isset($donor_name[0])) { |
|
2592 | + update_user_meta($donor->user_id, 'first_name', $donor_name[0]); |
|
2593 | 2593 | } |
2594 | - if ( isset( $donor_name[1] ) ) { |
|
2595 | - update_user_meta( $donor->user_id, 'last_name', $donor_name[1] ); |
|
2594 | + if (isset($donor_name[1])) { |
|
2595 | + update_user_meta($donor->user_id, 'last_name', $donor_name[1]); |
|
2596 | 2596 | } |
2597 | 2597 | } |
2598 | 2598 | } |
@@ -2603,7 +2603,7 @@ discard block |
||
2603 | 2603 | } |
2604 | 2604 | |
2605 | 2605 | Give_Updates::get_instance()->percentage = 100; |
2606 | - give_set_upgrade_complete( 'v201_add_missing_donors' ); |
|
2606 | + give_set_upgrade_complete('v201_add_missing_donors'); |
|
2607 | 2607 | } |
2608 | 2608 | |
2609 | 2609 | |
@@ -2616,14 +2616,14 @@ discard block |
||
2616 | 2616 | global $wpdb; |
2617 | 2617 | |
2618 | 2618 | // Do not auto load option. |
2619 | - $wpdb->update( $wpdb->options, array( 'autoload' => 'no' ), array( 'option_name' => 'give_completed_upgrades' ) ); |
|
2619 | + $wpdb->update($wpdb->options, array('autoload' => 'no'), array('option_name' => 'give_completed_upgrades')); |
|
2620 | 2620 | |
2621 | 2621 | // Remove from cache. |
2622 | 2622 | $all_options = wp_load_alloptions(); |
2623 | 2623 | |
2624 | - if ( isset( $all_options['give_completed_upgrades'] ) ) { |
|
2625 | - unset( $all_options['give_completed_upgrades'] ); |
|
2626 | - wp_cache_set( 'alloptions', $all_options, 'options' ); |
|
2624 | + if (isset($all_options['give_completed_upgrades'])) { |
|
2625 | + unset($all_options['give_completed_upgrades']); |
|
2626 | + wp_cache_set('alloptions', $all_options, 'options'); |
|
2627 | 2627 | } |
2628 | 2628 | |
2629 | 2629 | } |
@@ -2638,7 +2638,7 @@ discard block |
||
2638 | 2638 | $give_updates = Give_Updates::get_instance(); |
2639 | 2639 | |
2640 | 2640 | // form query. |
2641 | - $donation_forms = new WP_Query( array( |
|
2641 | + $donation_forms = new WP_Query(array( |
|
2642 | 2642 | 'paged' => $give_updates->step, |
2643 | 2643 | 'status' => 'any', |
2644 | 2644 | 'order' => 'ASC', |
@@ -2647,16 +2647,16 @@ discard block |
||
2647 | 2647 | ) |
2648 | 2648 | ); |
2649 | 2649 | |
2650 | - if ( $donation_forms->have_posts() ) { |
|
2651 | - $give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) ); |
|
2650 | + if ($donation_forms->have_posts()) { |
|
2651 | + $give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20)); |
|
2652 | 2652 | |
2653 | - while ( $donation_forms->have_posts() ) { |
|
2653 | + while ($donation_forms->have_posts()) { |
|
2654 | 2654 | $donation_forms->the_post(); |
2655 | 2655 | $form_id = get_the_ID(); |
2656 | 2656 | |
2657 | - $form_closed_status = give_get_meta( $form_id, '_give_form_status', true ); |
|
2658 | - if ( empty( $form_closed_status ) ) { |
|
2659 | - give_set_form_closed_status( $form_id ); |
|
2657 | + $form_closed_status = give_get_meta($form_id, '_give_form_status', true); |
|
2658 | + if (empty($form_closed_status)) { |
|
2659 | + give_set_form_closed_status($form_id); |
|
2660 | 2660 | } |
2661 | 2661 | } |
2662 | 2662 | |
@@ -2666,7 +2666,7 @@ discard block |
||
2666 | 2666 | } else { |
2667 | 2667 | |
2668 | 2668 | // The Update Ran. |
2669 | - give_set_upgrade_complete( 'v210_verify_form_status_upgrades' ); |
|
2669 | + give_set_upgrade_complete('v210_verify_form_status_upgrades'); |
|
2670 | 2670 | } |
2671 | 2671 | |
2672 | 2672 | } |
@@ -2686,22 +2686,22 @@ discard block |
||
2686 | 2686 | SELECT DISTINCT payment_id |
2687 | 2687 | FROM {$donation_meta_table} |
2688 | 2688 | LIMIT 20 |
2689 | - OFFSET {$give_updates->get_offset( 20 )} |
|
2689 | + OFFSET {$give_updates->get_offset(20)} |
|
2690 | 2690 | " |
2691 | 2691 | ); |
2692 | 2692 | |
2693 | - if ( ! empty( $donations ) ) { |
|
2694 | - foreach ( $donations as $donation ) { |
|
2695 | - $donation_obj = get_post( $donation ); |
|
2693 | + if ( ! empty($donations)) { |
|
2694 | + foreach ($donations as $donation) { |
|
2695 | + $donation_obj = get_post($donation); |
|
2696 | 2696 | |
2697 | - if ( ! $donation_obj instanceof WP_Post ) { |
|
2698 | - Give()->payment_meta->delete_all_meta( $donation ); |
|
2697 | + if ( ! $donation_obj instanceof WP_Post) { |
|
2698 | + Give()->payment_meta->delete_all_meta($donation); |
|
2699 | 2699 | } |
2700 | 2700 | } |
2701 | 2701 | } else { |
2702 | 2702 | |
2703 | 2703 | // The Update Ran. |
2704 | - give_set_upgrade_complete( 'v213_delete_donation_meta' ); |
|
2704 | + give_set_upgrade_complete('v213_delete_donation_meta'); |
|
2705 | 2705 | } |
2706 | 2706 | |
2707 | 2707 | } |
2708 | 2708 | \ No newline at end of file |
@@ -46,24 +46,24 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function __construct() { |
48 | 48 | $this->metabox_id = 'give-metabox-form-data'; |
49 | - $this->metabox_label = __( 'Donation Form Options', 'give' ); |
|
49 | + $this->metabox_label = __('Donation Form Options', 'give'); |
|
50 | 50 | |
51 | 51 | // Setup. |
52 | - add_action( 'admin_init', array( $this, 'setup' ) ); |
|
52 | + add_action('admin_init', array($this, 'setup')); |
|
53 | 53 | |
54 | 54 | // Add metabox. |
55 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 10 ); |
|
55 | + add_action('add_meta_boxes', array($this, 'add_meta_box'), 10); |
|
56 | 56 | |
57 | 57 | // Save form meta. |
58 | - add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 ); |
|
58 | + add_action('save_post_give_forms', array($this, 'save'), 10, 2); |
|
59 | 59 | |
60 | 60 | // cmb2 old setting loaders. |
61 | 61 | // add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) ); |
62 | 62 | // Add offline donations options. |
63 | - add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 ); |
|
63 | + add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1); |
|
64 | 64 | |
65 | 65 | // Maintain active tab query parameter after save. |
66 | - add_filter( 'redirect_post_location', array( $this, 'maintain_active_tab' ), 10, 2 ); |
|
66 | + add_filter('redirect_post_location', array($this, 'maintain_active_tab'), 10, 2); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | function get_settings() { |
89 | 89 | $post_id = give_get_admin_post_id(); |
90 | - $price_placeholder = give_format_decimal( '1.00', false, false ); |
|
90 | + $price_placeholder = give_format_decimal('1.00', false, false); |
|
91 | 91 | |
92 | 92 | // Start with an underscore to hide fields from custom fields list |
93 | 93 | $prefix = '_give_'; |
@@ -96,27 +96,27 @@ discard block |
||
96 | 96 | /** |
97 | 97 | * Repeatable Field Groups |
98 | 98 | */ |
99 | - 'form_field_options' => apply_filters( 'give_forms_field_options', array( |
|
99 | + 'form_field_options' => apply_filters('give_forms_field_options', array( |
|
100 | 100 | 'id' => 'form_field_options', |
101 | - 'title' => __( 'Donation Options', 'give' ), |
|
101 | + 'title' => __('Donation Options', 'give'), |
|
102 | 102 | 'icon-html' => '<span class="give-icon give-icon-heart"></span>', |
103 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
103 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
104 | 104 | // Donation Option. |
105 | 105 | array( |
106 | - 'name' => __( 'Donation Option', 'give' ), |
|
107 | - 'description' => __( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
108 | - 'id' => $prefix . 'price_option', |
|
106 | + 'name' => __('Donation Option', 'give'), |
|
107 | + 'description' => __('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
108 | + 'id' => $prefix.'price_option', |
|
109 | 109 | 'type' => 'radio_inline', |
110 | 110 | 'default' => 'multi', |
111 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
112 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
113 | - 'set' => __( 'Set Donation', 'give' ), |
|
114 | - ) ), |
|
111 | + 'options' => apply_filters('give_forms_price_options', array( |
|
112 | + 'multi' => __('Multi-level Donation', 'give'), |
|
113 | + 'set' => __('Set Donation', 'give'), |
|
114 | + )), |
|
115 | 115 | ), |
116 | 116 | array( |
117 | - 'name' => __( 'Set Donation', 'give' ), |
|
118 | - 'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
119 | - 'id' => $prefix . 'set_price', |
|
117 | + 'name' => __('Set Donation', 'give'), |
|
118 | + 'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
119 | + 'id' => $prefix.'set_price', |
|
120 | 120 | 'type' => 'text_small', |
121 | 121 | 'data_type' => 'price', |
122 | 122 | 'attributes' => array( |
@@ -126,34 +126,34 @@ discard block |
||
126 | 126 | ), |
127 | 127 | // Display Style. |
128 | 128 | array( |
129 | - 'name' => __( 'Display Style', 'give' ), |
|
130 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
131 | - 'id' => $prefix . 'display_style', |
|
129 | + 'name' => __('Display Style', 'give'), |
|
130 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
131 | + 'id' => $prefix.'display_style', |
|
132 | 132 | 'type' => 'radio_inline', |
133 | 133 | 'default' => 'buttons', |
134 | 134 | 'options' => array( |
135 | - 'buttons' => __( 'Buttons', 'give' ), |
|
136 | - 'radios' => __( 'Radios', 'give' ), |
|
137 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
135 | + 'buttons' => __('Buttons', 'give'), |
|
136 | + 'radios' => __('Radios', 'give'), |
|
137 | + 'dropdown' => __('Dropdown', 'give'), |
|
138 | 138 | ), |
139 | 139 | 'wrapper_class' => 'give-hidden', |
140 | 140 | ), |
141 | 141 | // Custom Amount. |
142 | 142 | array( |
143 | - 'name' => __( 'Custom Amount', 'give' ), |
|
144 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
145 | - 'id' => $prefix . 'custom_amount', |
|
143 | + 'name' => __('Custom Amount', 'give'), |
|
144 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
145 | + 'id' => $prefix.'custom_amount', |
|
146 | 146 | 'type' => 'radio_inline', |
147 | 147 | 'default' => 'disabled', |
148 | 148 | 'options' => array( |
149 | - 'enabled' => __( 'Enabled', 'give' ), |
|
150 | - 'disabled' => __( 'Disabled', 'give' ), |
|
149 | + 'enabled' => __('Enabled', 'give'), |
|
150 | + 'disabled' => __('Disabled', 'give'), |
|
151 | 151 | ), |
152 | 152 | ), |
153 | 153 | array( |
154 | - 'name' => __( 'Donation Limit', 'give' ), |
|
155 | - 'description' => __( 'Set the minimum and maximum amount for all gateways.', 'give' ), |
|
156 | - 'id' => $prefix . 'custom_amount_range', |
|
154 | + 'name' => __('Donation Limit', 'give'), |
|
155 | + 'description' => __('Set the minimum and maximum amount for all gateways.', 'give'), |
|
156 | + 'id' => $prefix.'custom_amount_range', |
|
157 | 157 | 'type' => 'donation_limit', |
158 | 158 | 'wrapper_class' => 'give-hidden', |
159 | 159 | 'data_type' => 'price', |
@@ -162,43 +162,43 @@ discard block |
||
162 | 162 | 'class' => 'give-money-field', |
163 | 163 | ), |
164 | 164 | 'options' => array( |
165 | - 'display_label' => __( 'Donation Limits: ', 'give' ), |
|
165 | + 'display_label' => __('Donation Limits: ', 'give'), |
|
166 | 166 | 'minimum' => 1.00, |
167 | 167 | 'maximum' => 999999.99, |
168 | 168 | ), |
169 | 169 | ), |
170 | 170 | array( |
171 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
172 | - 'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
173 | - 'id' => $prefix . 'custom_amount_text', |
|
171 | + 'name' => __('Custom Amount Text', 'give'), |
|
172 | + 'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
173 | + 'id' => $prefix.'custom_amount_text', |
|
174 | 174 | 'type' => 'text_medium', |
175 | 175 | 'attributes' => array( |
176 | 176 | 'rows' => 3, |
177 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
177 | + 'placeholder' => __('Give a Custom Amount', 'give'), |
|
178 | 178 | ), |
179 | 179 | 'wrapper_class' => 'give-hidden', |
180 | 180 | ), |
181 | 181 | // Donation Levels. |
182 | 182 | array( |
183 | - 'id' => $prefix . 'donation_levels', |
|
183 | + 'id' => $prefix.'donation_levels', |
|
184 | 184 | 'type' => 'group', |
185 | 185 | 'options' => array( |
186 | - 'add_button' => __( 'Add Level', 'give' ), |
|
187 | - 'header_title' => __( 'Donation Level', 'give' ), |
|
186 | + 'add_button' => __('Add Level', 'give'), |
|
187 | + 'header_title' => __('Donation Level', 'give'), |
|
188 | 188 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
189 | 189 | ), |
190 | 190 | 'wrapper_class' => 'give-hidden', |
191 | 191 | // Fields array works the same, except id's only need to be unique for this group. |
192 | 192 | // Prefix is not needed. |
193 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
193 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
194 | 194 | array( |
195 | - 'name' => __( 'ID', 'give' ), |
|
196 | - 'id' => $prefix . 'id', |
|
195 | + 'name' => __('ID', 'give'), |
|
196 | + 'id' => $prefix.'id', |
|
197 | 197 | 'type' => 'levels_id', |
198 | 198 | ), |
199 | 199 | array( |
200 | - 'name' => __( 'Amount', 'give' ), |
|
201 | - 'id' => $prefix . 'amount', |
|
200 | + 'name' => __('Amount', 'give'), |
|
201 | + 'id' => $prefix.'amount', |
|
202 | 202 | 'type' => 'text_small', |
203 | 203 | 'data_type' => 'price', |
204 | 204 | 'attributes' => array( |
@@ -207,126 +207,126 @@ discard block |
||
207 | 207 | ), |
208 | 208 | ), |
209 | 209 | array( |
210 | - 'name' => __( 'Text', 'give' ), |
|
211 | - 'id' => $prefix . 'text', |
|
210 | + 'name' => __('Text', 'give'), |
|
211 | + 'id' => $prefix.'text', |
|
212 | 212 | 'type' => 'text', |
213 | 213 | 'attributes' => array( |
214 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
214 | + 'placeholder' => __('Donation Level', 'give'), |
|
215 | 215 | 'class' => 'give-multilevel-text-field', |
216 | 216 | ), |
217 | 217 | ), |
218 | 218 | array( |
219 | - 'name' => __( 'Default', 'give' ), |
|
220 | - 'id' => $prefix . 'default', |
|
219 | + 'name' => __('Default', 'give'), |
|
220 | + 'id' => $prefix.'default', |
|
221 | 221 | 'type' => 'give_default_radio_inline', |
222 | 222 | ), |
223 | - ) ), |
|
223 | + )), |
|
224 | 224 | ), |
225 | 225 | array( |
226 | 226 | 'name' => 'donation_options_docs', |
227 | 227 | 'type' => 'docs_link', |
228 | 228 | 'url' => 'http://docs.givewp.com/form-donation-options', |
229 | - 'title' => __( 'Donation Options', 'give' ), |
|
229 | + 'title' => __('Donation Options', 'give'), |
|
230 | 230 | ), |
231 | 231 | ), |
232 | 232 | $post_id |
233 | 233 | ), |
234 | - ) ), |
|
234 | + )), |
|
235 | 235 | |
236 | 236 | /** |
237 | 237 | * Display Options |
238 | 238 | */ |
239 | - 'form_display_options' => apply_filters( 'give_form_display_options', array( |
|
239 | + 'form_display_options' => apply_filters('give_form_display_options', array( |
|
240 | 240 | 'id' => 'form_display_options', |
241 | - 'title' => __( 'Form Display', 'give' ), |
|
241 | + 'title' => __('Form Display', 'give'), |
|
242 | 242 | 'icon-html' => '<span class="give-icon give-icon-display"></span>', |
243 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
243 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
244 | 244 | array( |
245 | - 'name' => __( 'Display Options', 'give' ), |
|
246 | - 'desc' => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ), |
|
247 | - 'id' => $prefix . 'payment_display', |
|
245 | + 'name' => __('Display Options', 'give'), |
|
246 | + 'desc' => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'), |
|
247 | + 'id' => $prefix.'payment_display', |
|
248 | 248 | 'type' => 'radio_inline', |
249 | 249 | 'options' => array( |
250 | - 'onpage' => __( 'All Fields', 'give' ), |
|
251 | - 'modal' => __( 'Modal', 'give' ), |
|
252 | - 'reveal' => __( 'Reveal', 'give' ), |
|
253 | - 'button' => __( 'Button', 'give' ), |
|
250 | + 'onpage' => __('All Fields', 'give'), |
|
251 | + 'modal' => __('Modal', 'give'), |
|
252 | + 'reveal' => __('Reveal', 'give'), |
|
253 | + 'button' => __('Button', 'give'), |
|
254 | 254 | ), |
255 | 255 | 'default' => 'onpage', |
256 | 256 | ), |
257 | 257 | array( |
258 | - 'id' => $prefix . 'reveal_label', |
|
259 | - 'name' => __( 'Continue Button', 'give' ), |
|
260 | - 'desc' => __( 'The button label for displaying the additional payment fields.', 'give' ), |
|
258 | + 'id' => $prefix.'reveal_label', |
|
259 | + 'name' => __('Continue Button', 'give'), |
|
260 | + 'desc' => __('The button label for displaying the additional payment fields.', 'give'), |
|
261 | 261 | 'type' => 'text_small', |
262 | 262 | 'attributes' => array( |
263 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
263 | + 'placeholder' => __('Donate Now', 'give'), |
|
264 | 264 | ), |
265 | 265 | 'wrapper_class' => 'give-hidden', |
266 | 266 | ), |
267 | 267 | array( |
268 | - 'id' => $prefix . 'checkout_label', |
|
269 | - 'name' => __( 'Submit Button', 'give' ), |
|
270 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
268 | + 'id' => $prefix.'checkout_label', |
|
269 | + 'name' => __('Submit Button', 'give'), |
|
270 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
271 | 271 | 'type' => 'text_small', |
272 | 272 | 'attributes' => array( |
273 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
273 | + 'placeholder' => __('Donate Now', 'give'), |
|
274 | 274 | ), |
275 | 275 | ), |
276 | 276 | array( |
277 | - 'name' => __( 'Default Gateway', 'give' ), |
|
278 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
279 | - 'id' => $prefix . 'default_gateway', |
|
277 | + 'name' => __('Default Gateway', 'give'), |
|
278 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
279 | + 'id' => $prefix.'default_gateway', |
|
280 | 280 | 'type' => 'default_gateway', |
281 | 281 | ), |
282 | 282 | array( |
283 | - 'name' => __( 'Company Donations', 'give' ), |
|
284 | - 'desc' => __( 'Do you want a Company field to appear after First Name and Last Name?', 'give' ), |
|
285 | - 'id' => $prefix . 'company_field', |
|
283 | + 'name' => __('Company Donations', 'give'), |
|
284 | + 'desc' => __('Do you want a Company field to appear after First Name and Last Name?', 'give'), |
|
285 | + 'id' => $prefix.'company_field', |
|
286 | 286 | 'type' => 'radio_inline', |
287 | 287 | 'default' => 'global', |
288 | 288 | 'options' => array( |
289 | - 'global' => __( 'Global Option', 'give' ), |
|
290 | - 'required' => __( 'Required', 'give' ), |
|
291 | - 'optional' => __( 'Optional', 'give' ), |
|
292 | - 'disabled' => __( 'Disabled', 'give' ), |
|
289 | + 'global' => __('Global Option', 'give'), |
|
290 | + 'required' => __('Required', 'give'), |
|
291 | + 'optional' => __('Optional', 'give'), |
|
292 | + 'disabled' => __('Disabled', 'give'), |
|
293 | 293 | |
294 | 294 | ), |
295 | 295 | ), |
296 | 296 | array( |
297 | - 'name' => __( 'Guest Donations', 'give' ), |
|
298 | - 'desc' => __( 'Do you want to allow non-logged-in users to make donations?', 'give' ), |
|
299 | - 'id' => $prefix . 'logged_in_only', |
|
297 | + 'name' => __('Guest Donations', 'give'), |
|
298 | + 'desc' => __('Do you want to allow non-logged-in users to make donations?', 'give'), |
|
299 | + 'id' => $prefix.'logged_in_only', |
|
300 | 300 | 'type' => 'radio_inline', |
301 | 301 | 'default' => 'enabled', |
302 | 302 | 'options' => array( |
303 | - 'enabled' => __( 'Enabled', 'give' ), |
|
304 | - 'disabled' => __( 'Disabled', 'give' ), |
|
303 | + 'enabled' => __('Enabled', 'give'), |
|
304 | + 'disabled' => __('Disabled', 'give'), |
|
305 | 305 | ), |
306 | 306 | ), |
307 | 307 | array( |
308 | - 'name' => __( 'Registration', 'give' ), |
|
309 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
310 | - 'id' => $prefix . 'show_register_form', |
|
308 | + 'name' => __('Registration', 'give'), |
|
309 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
310 | + 'id' => $prefix.'show_register_form', |
|
311 | 311 | 'type' => 'radio', |
312 | 312 | 'options' => array( |
313 | - 'none' => __( 'None', 'give' ), |
|
314 | - 'registration' => __( 'Registration', 'give' ), |
|
315 | - 'login' => __( 'Login', 'give' ), |
|
316 | - 'both' => __( 'Registration + Login', 'give' ), |
|
313 | + 'none' => __('None', 'give'), |
|
314 | + 'registration' => __('Registration', 'give'), |
|
315 | + 'login' => __('Login', 'give'), |
|
316 | + 'both' => __('Registration + Login', 'give'), |
|
317 | 317 | ), |
318 | 318 | 'default' => 'none', |
319 | 319 | ), |
320 | 320 | array( |
321 | - 'name' => __( 'Floating Labels', 'give' ), |
|
321 | + 'name' => __('Floating Labels', 'give'), |
|
322 | 322 | /* translators: %s: forms http://docs.givewp.com/form-floating-labels */ |
323 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
324 | - 'id' => $prefix . 'form_floating_labels', |
|
323 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
324 | + 'id' => $prefix.'form_floating_labels', |
|
325 | 325 | 'type' => 'radio_inline', |
326 | 326 | 'options' => array( |
327 | - 'global' => __( 'Global Option', 'give' ), |
|
328 | - 'enabled' => __( 'Enabled', 'give' ), |
|
329 | - 'disabled' => __( 'Disabled', 'give' ), |
|
327 | + 'global' => __('Global Option', 'give'), |
|
328 | + 'enabled' => __('Enabled', 'give'), |
|
329 | + 'disabled' => __('Disabled', 'give'), |
|
330 | 330 | ), |
331 | 331 | 'default' => 'global', |
332 | 332 | ), |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | 'name' => 'form_display_docs', |
335 | 335 | 'type' => 'docs_link', |
336 | 336 | 'url' => 'http://docs.givewp.com/form-display-options', |
337 | - 'title' => __( 'Form Display', 'give' ), |
|
337 | + 'title' => __('Form Display', 'give'), |
|
338 | 338 | ), |
339 | 339 | ), |
340 | 340 | $post_id |
@@ -345,42 +345,42 @@ discard block |
||
345 | 345 | /** |
346 | 346 | * Donation Goals |
347 | 347 | */ |
348 | - 'donation_goal_options' => apply_filters( 'give_donation_goal_options', array( |
|
348 | + 'donation_goal_options' => apply_filters('give_donation_goal_options', array( |
|
349 | 349 | 'id' => 'donation_goal_options', |
350 | - 'title' => __( 'Donation Goal', 'give' ), |
|
350 | + 'title' => __('Donation Goal', 'give'), |
|
351 | 351 | 'icon-html' => '<span class="give-icon give-icon-target"></span>', |
352 | - 'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array( |
|
352 | + 'fields' => apply_filters('give_forms_donation_goal_metabox_fields', array( |
|
353 | 353 | // Goals |
354 | 354 | array( |
355 | - 'name' => __( 'Donation Goal', 'give' ), |
|
356 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
357 | - 'id' => $prefix . 'goal_option', |
|
355 | + 'name' => __('Donation Goal', 'give'), |
|
356 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
357 | + 'id' => $prefix.'goal_option', |
|
358 | 358 | 'type' => 'radio_inline', |
359 | 359 | 'default' => 'disabled', |
360 | 360 | 'options' => array( |
361 | - 'enabled' => __( 'Enabled', 'give' ), |
|
362 | - 'disabled' => __( 'Disabled', 'give' ), |
|
361 | + 'enabled' => __('Enabled', 'give'), |
|
362 | + 'disabled' => __('Disabled', 'give'), |
|
363 | 363 | ), |
364 | 364 | ), |
365 | 365 | |
366 | 366 | array( |
367 | - 'name' => __( 'Goal Format', 'give' ), |
|
368 | - 'description' => __( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded" or "1 of 5 donations". You can also display a donor-based goal, such as "100 of 1,000 donors have given".', 'give' ), |
|
369 | - 'id' => $prefix . 'goal_format', |
|
367 | + 'name' => __('Goal Format', 'give'), |
|
368 | + 'description' => __('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded" or "1 of 5 donations". You can also display a donor-based goal, such as "100 of 1,000 donors have given".', 'give'), |
|
369 | + 'id' => $prefix.'goal_format', |
|
370 | 370 | 'type' => 'donation_form_goal', |
371 | 371 | 'default' => 'amount', |
372 | 372 | 'options' => array( |
373 | - 'amount' => __( 'Amount Raised', 'give' ), |
|
374 | - 'percentage' => __( 'Percentage Raised', 'give' ), |
|
375 | - 'donation' => __( 'Number of Donations', 'give' ), |
|
376 | - 'donors' => __( 'Number of Donors', 'give' ), |
|
373 | + 'amount' => __('Amount Raised', 'give'), |
|
374 | + 'percentage' => __('Percentage Raised', 'give'), |
|
375 | + 'donation' => __('Number of Donations', 'give'), |
|
376 | + 'donors' => __('Number of Donors', 'give'), |
|
377 | 377 | ), |
378 | 378 | ), |
379 | 379 | |
380 | 380 | array( |
381 | - 'name' => __( 'Goal Amount', 'give' ), |
|
382 | - 'description' => __( 'This is the monetary goal amount you want to reach for this form.', 'give' ), |
|
383 | - 'id' => $prefix . 'set_goal', |
|
381 | + 'name' => __('Goal Amount', 'give'), |
|
382 | + 'description' => __('This is the monetary goal amount you want to reach for this form.', 'give'), |
|
383 | + 'id' => $prefix.'set_goal', |
|
384 | 384 | 'type' => 'text_small', |
385 | 385 | 'data_type' => 'price', |
386 | 386 | 'attributes' => array( |
@@ -390,9 +390,9 @@ discard block |
||
390 | 390 | 'wrapper_class' => 'give-hidden', |
391 | 391 | ), |
392 | 392 | array( |
393 | - 'id' => $prefix . 'number_of_donation_goal', |
|
394 | - 'name' => __( 'Donation Goal', 'give' ), |
|
395 | - 'desc' => __( 'Set the total number of donations as a goal.', 'give' ), |
|
393 | + 'id' => $prefix.'number_of_donation_goal', |
|
394 | + 'name' => __('Donation Goal', 'give'), |
|
395 | + 'desc' => __('Set the total number of donations as a goal.', 'give'), |
|
396 | 396 | 'type' => 'number', |
397 | 397 | 'default' => 1, |
398 | 398 | 'attributes' => array( |
@@ -400,9 +400,9 @@ discard block |
||
400 | 400 | ), |
401 | 401 | ), |
402 | 402 | array( |
403 | - 'id' => $prefix . 'number_of_donor_goal', |
|
404 | - 'name' => __( 'Donor Goal', 'give' ), |
|
405 | - 'desc' => __( 'Set the total number of donors as a goal.', 'give' ), |
|
403 | + 'id' => $prefix.'number_of_donor_goal', |
|
404 | + 'name' => __('Donor Goal', 'give'), |
|
405 | + 'desc' => __('Set the total number of donors as a goal.', 'give'), |
|
406 | 406 | 'type' => 'number', |
407 | 407 | 'default' => 1, |
408 | 408 | 'attributes' => array( |
@@ -410,85 +410,85 @@ discard block |
||
410 | 410 | ), |
411 | 411 | ), |
412 | 412 | array( |
413 | - 'name' => __( 'Progress Bar Color', 'give' ), |
|
414 | - 'desc' => __( 'Customize the color of the goal progress bar.', 'give' ), |
|
415 | - 'id' => $prefix . 'goal_color', |
|
413 | + 'name' => __('Progress Bar Color', 'give'), |
|
414 | + 'desc' => __('Customize the color of the goal progress bar.', 'give'), |
|
415 | + 'id' => $prefix.'goal_color', |
|
416 | 416 | 'type' => 'colorpicker', |
417 | 417 | 'default' => '#2bc253', |
418 | 418 | 'wrapper_class' => 'give-hidden', |
419 | 419 | ), |
420 | 420 | |
421 | 421 | array( |
422 | - 'name' => __( 'Close Form', 'give' ), |
|
423 | - 'desc' => __( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
424 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
422 | + 'name' => __('Close Form', 'give'), |
|
423 | + 'desc' => __('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
424 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
425 | 425 | 'type' => 'radio_inline', |
426 | 426 | 'default' => 'disabled', |
427 | 427 | 'options' => array( |
428 | - 'enabled' => __( 'Enabled', 'give' ), |
|
429 | - 'disabled' => __( 'Disabled', 'give' ), |
|
428 | + 'enabled' => __('Enabled', 'give'), |
|
429 | + 'disabled' => __('Disabled', 'give'), |
|
430 | 430 | ), |
431 | 431 | 'wrapper_class' => 'give-hidden', |
432 | 432 | ), |
433 | 433 | array( |
434 | - 'name' => __( 'Goal Achieved Message', 'give' ), |
|
435 | - 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
|
436 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
434 | + 'name' => __('Goal Achieved Message', 'give'), |
|
435 | + 'desc' => __('Do you want to display a custom message when the goal is closed?', 'give'), |
|
436 | + 'id' => $prefix.'form_goal_achieved_message', |
|
437 | 437 | 'type' => 'wysiwyg', |
438 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
438 | + 'default' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
439 | 439 | 'wrapper_class' => 'give-hidden', |
440 | 440 | ), |
441 | 441 | array( |
442 | 442 | 'name' => 'donation_goal_docs', |
443 | 443 | 'type' => 'docs_link', |
444 | 444 | 'url' => 'http://docs.givewp.com/form-donation-goal', |
445 | - 'title' => __( 'Donation Goal', 'give' ), |
|
445 | + 'title' => __('Donation Goal', 'give'), |
|
446 | 446 | ), |
447 | 447 | ), |
448 | 448 | $post_id |
449 | 449 | ), |
450 | - ) ), |
|
450 | + )), |
|
451 | 451 | |
452 | 452 | /** |
453 | 453 | * Content Field |
454 | 454 | */ |
455 | - 'form_content_options' => apply_filters( 'give_forms_content_options', array( |
|
455 | + 'form_content_options' => apply_filters('give_forms_content_options', array( |
|
456 | 456 | 'id' => 'form_content_options', |
457 | - 'title' => __( 'Form Content', 'give' ), |
|
457 | + 'title' => __('Form Content', 'give'), |
|
458 | 458 | 'icon-html' => '<span class="give-icon give-icon-edit"></span>', |
459 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
459 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
460 | 460 | |
461 | 461 | // Donation content. |
462 | 462 | array( |
463 | - 'name' => __( 'Display Content', 'give' ), |
|
464 | - 'description' => __( 'Do you want to add custom content to this form?', 'give' ), |
|
465 | - 'id' => $prefix . 'display_content', |
|
463 | + 'name' => __('Display Content', 'give'), |
|
464 | + 'description' => __('Do you want to add custom content to this form?', 'give'), |
|
465 | + 'id' => $prefix.'display_content', |
|
466 | 466 | 'type' => 'radio_inline', |
467 | 467 | 'options' => array( |
468 | - 'enabled' => __( 'Enabled', 'give' ), |
|
469 | - 'disabled' => __( 'Disabled', 'give' ), |
|
468 | + 'enabled' => __('Enabled', 'give'), |
|
469 | + 'disabled' => __('Disabled', 'give'), |
|
470 | 470 | ), |
471 | 471 | 'default' => 'disabled', |
472 | 472 | ), |
473 | 473 | |
474 | 474 | // Content placement. |
475 | 475 | array( |
476 | - 'name' => __( 'Content Placement', 'give' ), |
|
477 | - 'description' => __( 'This option controls where the content appears within the donation form.', 'give' ), |
|
478 | - 'id' => $prefix . 'content_placement', |
|
476 | + 'name' => __('Content Placement', 'give'), |
|
477 | + 'description' => __('This option controls where the content appears within the donation form.', 'give'), |
|
478 | + 'id' => $prefix.'content_placement', |
|
479 | 479 | 'type' => 'radio_inline', |
480 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
481 | - 'give_pre_form' => __( 'Above fields', 'give' ), |
|
482 | - 'give_post_form' => __( 'Below fields', 'give' ), |
|
480 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
481 | + 'give_pre_form' => __('Above fields', 'give'), |
|
482 | + 'give_post_form' => __('Below fields', 'give'), |
|
483 | 483 | ) |
484 | 484 | ), |
485 | 485 | 'default' => 'give_pre_form', |
486 | 486 | 'wrapper_class' => 'give-hidden', |
487 | 487 | ), |
488 | 488 | array( |
489 | - 'name' => __( 'Content', 'give' ), |
|
490 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
491 | - 'id' => $prefix . 'form_content', |
|
489 | + 'name' => __('Content', 'give'), |
|
490 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
491 | + 'id' => $prefix.'form_content', |
|
492 | 492 | 'type' => 'wysiwyg', |
493 | 493 | 'wrapper_class' => 'give-hidden', |
494 | 494 | ), |
@@ -496,51 +496,51 @@ discard block |
||
496 | 496 | 'name' => 'form_content_docs', |
497 | 497 | 'type' => 'docs_link', |
498 | 498 | 'url' => 'http://docs.givewp.com/form-content', |
499 | - 'title' => __( 'Form Content', 'give' ), |
|
499 | + 'title' => __('Form Content', 'give'), |
|
500 | 500 | ), |
501 | 501 | ), |
502 | 502 | $post_id |
503 | 503 | ), |
504 | - ) ), |
|
504 | + )), |
|
505 | 505 | |
506 | 506 | /** |
507 | 507 | * Terms & Conditions |
508 | 508 | */ |
509 | - 'form_terms_options' => apply_filters( 'give_forms_terms_options', array( |
|
509 | + 'form_terms_options' => apply_filters('give_forms_terms_options', array( |
|
510 | 510 | 'id' => 'form_terms_options', |
511 | - 'title' => __( 'Terms & Conditions', 'give' ), |
|
511 | + 'title' => __('Terms & Conditions', 'give'), |
|
512 | 512 | 'icon-html' => '<span class="give-icon give-icon-checklist"></span>', |
513 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
513 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
514 | 514 | // Donation Option |
515 | 515 | array( |
516 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
517 | - 'description' => __( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ), |
|
518 | - 'id' => $prefix . 'terms_option', |
|
516 | + 'name' => __('Terms and Conditions', 'give'), |
|
517 | + 'description' => __('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'), |
|
518 | + 'id' => $prefix.'terms_option', |
|
519 | 519 | 'type' => 'radio_inline', |
520 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
521 | - 'global' => __( 'Global Option', 'give' ), |
|
522 | - 'enabled' => __( 'Customize', 'give' ), |
|
523 | - 'disabled' => __( 'Disable', 'give' ), |
|
520 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
521 | + 'global' => __('Global Option', 'give'), |
|
522 | + 'enabled' => __('Customize', 'give'), |
|
523 | + 'disabled' => __('Disable', 'give'), |
|
524 | 524 | ) |
525 | 525 | ), |
526 | 526 | 'default' => 'global', |
527 | 527 | ), |
528 | 528 | array( |
529 | - 'id' => $prefix . 'agree_label', |
|
530 | - 'name' => __( 'Agreement Label', 'give' ), |
|
531 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
529 | + 'id' => $prefix.'agree_label', |
|
530 | + 'name' => __('Agreement Label', 'give'), |
|
531 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
532 | 532 | 'type' => 'text', |
533 | 533 | 'size' => 'regular', |
534 | 534 | 'attributes' => array( |
535 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
535 | + 'placeholder' => __('Agree to Terms?', 'give'), |
|
536 | 536 | ), |
537 | 537 | 'wrapper_class' => 'give-hidden', |
538 | 538 | ), |
539 | 539 | array( |
540 | - 'id' => $prefix . 'agree_text', |
|
541 | - 'name' => __( 'Agreement Text', 'give' ), |
|
542 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
543 | - 'default' => give_get_option( 'agreement_text' ), |
|
540 | + 'id' => $prefix.'agree_text', |
|
541 | + 'name' => __('Agreement Text', 'give'), |
|
542 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
543 | + 'default' => give_get_option('agreement_text'), |
|
544 | 544 | 'type' => 'wysiwyg', |
545 | 545 | 'wrapper_class' => 'give-hidden', |
546 | 546 | ), |
@@ -548,18 +548,18 @@ discard block |
||
548 | 548 | 'name' => 'terms_docs', |
549 | 549 | 'type' => 'docs_link', |
550 | 550 | 'url' => 'http://docs.givewp.com/form-terms', |
551 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
551 | + 'title' => __('Terms and Conditions', 'give'), |
|
552 | 552 | ), |
553 | 553 | ), |
554 | 554 | $post_id |
555 | 555 | ), |
556 | - ) ), |
|
556 | + )), |
|
557 | 557 | ); |
558 | 558 | |
559 | 559 | /** |
560 | 560 | * Filter the metabox tabbed panel settings. |
561 | 561 | */ |
562 | - $settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id ); |
|
562 | + $settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id); |
|
563 | 563 | |
564 | 564 | // Output. |
565 | 565 | return $settings; |
@@ -576,19 +576,19 @@ discard block |
||
576 | 576 | add_meta_box( |
577 | 577 | $this->get_metabox_ID(), |
578 | 578 | $this->get_metabox_label(), |
579 | - array( $this, 'output' ), |
|
580 | - array( 'give_forms' ), |
|
579 | + array($this, 'output'), |
|
580 | + array('give_forms'), |
|
581 | 581 | 'normal', |
582 | 582 | 'high' |
583 | 583 | ); |
584 | 584 | |
585 | 585 | // Show Goal Metabox only if goal is enabled. |
586 | - if ( give_is_setting_enabled( give_get_meta( give_get_admin_post_id(), '_give_goal_option', true ) ) ) { |
|
586 | + if (give_is_setting_enabled(give_get_meta(give_get_admin_post_id(), '_give_goal_option', true))) { |
|
587 | 587 | add_meta_box( |
588 | 588 | 'give-form-goal-stats', |
589 | - __( 'Goal Statistics', 'give' ), |
|
590 | - array( $this, 'output_goal' ), |
|
591 | - array( 'give_forms' ), |
|
589 | + __('Goal Statistics', 'give'), |
|
590 | + array($this, 'output_goal'), |
|
591 | + array('give_forms'), |
|
592 | 592 | 'side', |
593 | 593 | 'low' |
594 | 594 | ); |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | function enqueue_script() { |
608 | 608 | global $post; |
609 | 609 | |
610 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
610 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
611 | 611 | |
612 | 612 | } |
613 | 613 | } |
@@ -645,32 +645,32 @@ discard block |
||
645 | 645 | public function get_tabs() { |
646 | 646 | $tabs = array(); |
647 | 647 | |
648 | - if ( ! empty( $this->settings ) ) { |
|
649 | - foreach ( $this->settings as $setting ) { |
|
650 | - if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) { |
|
648 | + if ( ! empty($this->settings)) { |
|
649 | + foreach ($this->settings as $setting) { |
|
650 | + if ( ! isset($setting['id']) || ! isset($setting['title'])) { |
|
651 | 651 | continue; |
652 | 652 | } |
653 | 653 | $tab = array( |
654 | 654 | 'id' => $setting['id'], |
655 | 655 | 'label' => $setting['title'], |
656 | - 'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ), |
|
656 | + 'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''), |
|
657 | 657 | ); |
658 | 658 | |
659 | - if ( $this->has_sub_tab( $setting ) ) { |
|
660 | - if ( empty( $setting['sub-fields'] ) ) { |
|
659 | + if ($this->has_sub_tab($setting)) { |
|
660 | + if (empty($setting['sub-fields'])) { |
|
661 | 661 | $tab = array(); |
662 | 662 | } else { |
663 | - foreach ( $setting['sub-fields'] as $sub_fields ) { |
|
663 | + foreach ($setting['sub-fields'] as $sub_fields) { |
|
664 | 664 | $tab['sub-fields'][] = array( |
665 | 665 | 'id' => $sub_fields['id'], |
666 | 666 | 'label' => $sub_fields['title'], |
667 | - 'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ), |
|
667 | + 'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''), |
|
668 | 668 | ); |
669 | 669 | } |
670 | 670 | } |
671 | 671 | } |
672 | 672 | |
673 | - if ( ! empty( $tab ) ) { |
|
673 | + if ( ! empty($tab)) { |
|
674 | 674 | $tabs[] = $tab; |
675 | 675 | } |
676 | 676 | } |
@@ -688,33 +688,33 @@ discard block |
||
688 | 688 | */ |
689 | 689 | public function output() { |
690 | 690 | // Bailout. |
691 | - if ( $form_data_tabs = $this->get_tabs() ) : |
|
692 | - $active_tab = ! empty( $_GET['give_tab'] ) ? give_clean( $_GET['give_tab'] ) : 'form_field_options'; |
|
693 | - wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' ); |
|
691 | + if ($form_data_tabs = $this->get_tabs()) : |
|
692 | + $active_tab = ! empty($_GET['give_tab']) ? give_clean($_GET['give_tab']) : 'form_field_options'; |
|
693 | + wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce'); |
|
694 | 694 | ?> |
695 | 695 | <input id="give_form_active_tab" type="hidden" name="give_form_active_tab"> |
696 | 696 | <div class="give-metabox-panel-wrap"> |
697 | 697 | <ul class="give-form-data-tabs give-metabox-tabs"> |
698 | - <?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?> |
|
698 | + <?php foreach ($form_data_tabs as $index => $form_data_tab) : ?> |
|
699 | 699 | <?php |
700 | 700 | // Determine if current tab is active. |
701 | 701 | $is_active = $active_tab === $form_data_tab['id'] ? true : false; |
702 | 702 | ?> |
703 | - <li class="<?php echo "{$form_data_tab['id']}_tab" . ( $is_active ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>"> |
|
703 | + <li class="<?php echo "{$form_data_tab['id']}_tab".($is_active ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>"> |
|
704 | 704 | <a href="#<?php echo $form_data_tab['id']; ?>" data-tab-id="<?php echo $form_data_tab['id']; ?>"> |
705 | - <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
|
705 | + <?php if ( ! empty($form_data_tab['icon-html'])) : ?> |
|
706 | 706 | <?php echo $form_data_tab['icon-html']; ?> |
707 | 707 | <?php else : ?> |
708 | 708 | <span class="give-icon give-icon-default"></span> |
709 | 709 | <?php endif; ?> |
710 | 710 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
711 | 711 | </a> |
712 | - <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
|
712 | + <?php if ($this->has_sub_tab($form_data_tab)) : ?> |
|
713 | 713 | <ul class="give-metabox-sub-tabs give-hidden"> |
714 | - <?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?> |
|
714 | + <?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?> |
|
715 | 715 | <li class="<?php echo "{$sub_tab['id']}_tab"; ?>"> |
716 | 716 | <a href="#<?php echo $sub_tab['id']; ?>" data-tab-id="<?php echo $sub_tab['id']; ?>"> |
717 | - <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
|
717 | + <?php if ( ! empty($sub_tab['icon-html'])) : ?> |
|
718 | 718 | <?php echo $sub_tab['icon-html']; ?> |
719 | 719 | <?php else : ?> |
720 | 720 | <span class="give-icon give-icon-default"></span> |
@@ -729,29 +729,29 @@ discard block |
||
729 | 729 | <?php endforeach; ?> |
730 | 730 | </ul> |
731 | 731 | |
732 | - <?php foreach ( $this->settings as $setting ) : ?> |
|
733 | - <?php do_action( "give_before_{$setting['id']}_settings" ); ?> |
|
732 | + <?php foreach ($this->settings as $setting) : ?> |
|
733 | + <?php do_action("give_before_{$setting['id']}_settings"); ?> |
|
734 | 734 | <?php |
735 | 735 | // Determine if current panel is active. |
736 | 736 | $is_active = $active_tab === $setting['id'] ? true : false; |
737 | 737 | ?> |
738 | - <div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo( $is_active ? ' active' : '' ); ?>"> |
|
739 | - <?php if ( ! empty( $setting['fields'] ) ) : ?> |
|
740 | - <?php foreach ( $setting['fields'] as $field ) : ?> |
|
741 | - <?php give_render_field( $field ); ?> |
|
738 | + <div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo($is_active ? ' active' : ''); ?>"> |
|
739 | + <?php if ( ! empty($setting['fields'])) : ?> |
|
740 | + <?php foreach ($setting['fields'] as $field) : ?> |
|
741 | + <?php give_render_field($field); ?> |
|
742 | 742 | <?php endforeach; ?> |
743 | 743 | <?php endif; ?> |
744 | 744 | </div> |
745 | - <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
|
745 | + <?php do_action("give_after_{$setting['id']}_settings"); ?> |
|
746 | 746 | |
747 | 747 | |
748 | - <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
|
749 | - <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
|
750 | - <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
|
748 | + <?php if ($this->has_sub_tab($setting)) : ?> |
|
749 | + <?php if ( ! empty($setting['sub-fields'])) : ?> |
|
750 | + <?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?> |
|
751 | 751 | <div id="<?php echo $sub_fields['id']; ?>" class="panel give_options_panel give-hidden"> |
752 | - <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
|
753 | - <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
|
754 | - <?php give_render_field( $sub_field ); ?> |
|
752 | + <?php if ( ! empty($sub_fields['fields'])) : ?> |
|
753 | + <?php foreach ($sub_fields['fields'] as $sub_field) : ?> |
|
754 | + <?php give_render_field($sub_field); ?> |
|
755 | 755 | <?php endforeach; ?> |
756 | 756 | <?php endif; ?> |
757 | 757 | </div> |
@@ -774,9 +774,9 @@ discard block |
||
774 | 774 | * |
775 | 775 | * @return void |
776 | 776 | */ |
777 | - public function output_goal( $post ) { |
|
777 | + public function output_goal($post) { |
|
778 | 778 | |
779 | - echo give_admin_form_goal_stats( $post->ID ); |
|
779 | + echo give_admin_form_goal_stats($post->ID); |
|
780 | 780 | |
781 | 781 | } |
782 | 782 | |
@@ -789,9 +789,9 @@ discard block |
||
789 | 789 | * |
790 | 790 | * @return bool |
791 | 791 | */ |
792 | - private function has_sub_tab( $field_setting ) { |
|
792 | + private function has_sub_tab($field_setting) { |
|
793 | 793 | $has_sub_tab = false; |
794 | - if ( array_key_exists( 'sub-fields', $field_setting ) ) { |
|
794 | + if (array_key_exists('sub-fields', $field_setting)) { |
|
795 | 795 | $has_sub_tab = true; |
796 | 796 | } |
797 | 797 | |
@@ -806,13 +806,13 @@ discard block |
||
806 | 806 | * @return array |
807 | 807 | */ |
808 | 808 | function cmb2_metabox_settings() { |
809 | - $all_cmb2_settings = apply_filters( 'cmb2_meta_boxes', array() ); |
|
809 | + $all_cmb2_settings = apply_filters('cmb2_meta_boxes', array()); |
|
810 | 810 | $give_forms_settings = $all_cmb2_settings; |
811 | 811 | |
812 | 812 | // Filter settings: Use only give forms related settings. |
813 | - foreach ( $all_cmb2_settings as $index => $setting ) { |
|
814 | - if ( ! in_array( 'give_forms', $setting['object_types'] ) ) { |
|
815 | - unset( $give_forms_settings[ $index ] ); |
|
813 | + foreach ($all_cmb2_settings as $index => $setting) { |
|
814 | + if ( ! in_array('give_forms', $setting['object_types'])) { |
|
815 | + unset($give_forms_settings[$index]); |
|
816 | 816 | } |
817 | 817 | } |
818 | 818 | |
@@ -830,100 +830,100 @@ discard block |
||
830 | 830 | * |
831 | 831 | * @return void |
832 | 832 | */ |
833 | - public function save( $post_id, $post ) { |
|
833 | + public function save($post_id, $post) { |
|
834 | 834 | |
835 | 835 | // $post_id and $post are required. |
836 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
836 | + if (empty($post_id) || empty($post)) { |
|
837 | 837 | return; |
838 | 838 | } |
839 | 839 | |
840 | 840 | // Don't save meta boxes for revisions or autosaves. |
841 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
841 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
842 | 842 | return; |
843 | 843 | } |
844 | 844 | |
845 | 845 | // Check the nonce. |
846 | - if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) { |
|
846 | + if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) { |
|
847 | 847 | return; |
848 | 848 | } |
849 | 849 | |
850 | 850 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
851 | - if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) { |
|
851 | + if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { |
|
852 | 852 | return; |
853 | 853 | } |
854 | 854 | |
855 | 855 | // Check user has permission to edit. |
856 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
856 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
857 | 857 | return; |
858 | 858 | } |
859 | 859 | |
860 | 860 | // Fire action before saving form meta. |
861 | - do_action( 'give_pre_process_give_forms_meta', $post_id, $post ); |
|
861 | + do_action('give_pre_process_give_forms_meta', $post_id, $post); |
|
862 | 862 | |
863 | 863 | /** |
864 | 864 | * Filter the meta key to save. |
865 | 865 | * Third party addon developer can remove there meta keys from this array to handle saving data on there own. |
866 | 866 | */ |
867 | - $form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() ); |
|
867 | + $form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings()); |
|
868 | 868 | |
869 | 869 | // Save form meta data. |
870 | - if ( ! empty( $form_meta_keys ) ) { |
|
871 | - foreach ( $form_meta_keys as $form_meta_key ) { |
|
870 | + if ( ! empty($form_meta_keys)) { |
|
871 | + foreach ($form_meta_keys as $form_meta_key) { |
|
872 | 872 | |
873 | 873 | // Set default value for checkbox fields. |
874 | 874 | if ( |
875 | - ! isset( $_POST[ $form_meta_key ] ) |
|
876 | - && ( 'checkbox' === $this->get_field_type( $form_meta_key ) ) |
|
875 | + ! isset($_POST[$form_meta_key]) |
|
876 | + && ('checkbox' === $this->get_field_type($form_meta_key)) |
|
877 | 877 | ) { |
878 | - $_POST[ $form_meta_key ] = ''; |
|
878 | + $_POST[$form_meta_key] = ''; |
|
879 | 879 | } |
880 | 880 | |
881 | - if ( isset( $_POST[ $form_meta_key ] ) ) { |
|
882 | - $setting_field = $this->get_setting_field( $form_meta_key ); |
|
883 | - if ( ! empty( $setting_field['type'] ) ) { |
|
884 | - switch ( $setting_field['type'] ) { |
|
881 | + if (isset($_POST[$form_meta_key])) { |
|
882 | + $setting_field = $this->get_setting_field($form_meta_key); |
|
883 | + if ( ! empty($setting_field['type'])) { |
|
884 | + switch ($setting_field['type']) { |
|
885 | 885 | case 'textarea': |
886 | 886 | case 'wysiwyg': |
887 | - $form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] ); |
|
887 | + $form_meta_value = wp_kses_post($_POST[$form_meta_key]); |
|
888 | 888 | break; |
889 | 889 | |
890 | 890 | case 'donation_limit' : |
891 | - $form_meta_value = $_POST[ $form_meta_key ]; |
|
891 | + $form_meta_value = $_POST[$form_meta_key]; |
|
892 | 892 | break; |
893 | 893 | |
894 | 894 | case 'group': |
895 | 895 | $form_meta_value = array(); |
896 | 896 | |
897 | - foreach ( $_POST[ $form_meta_key ] as $index => $group ) { |
|
897 | + foreach ($_POST[$form_meta_key] as $index => $group) { |
|
898 | 898 | |
899 | 899 | // Do not save template input field values. |
900 | - if ( '{{row-count-placeholder}}' === $index ) { |
|
900 | + if ('{{row-count-placeholder}}' === $index) { |
|
901 | 901 | continue; |
902 | 902 | } |
903 | 903 | |
904 | 904 | $group_meta_value = array(); |
905 | - foreach ( $group as $field_id => $field_value ) { |
|
906 | - switch ( $this->get_field_type( $field_id, $form_meta_key ) ) { |
|
905 | + foreach ($group as $field_id => $field_value) { |
|
906 | + switch ($this->get_field_type($field_id, $form_meta_key)) { |
|
907 | 907 | case 'wysiwyg': |
908 | - $group_meta_value[ $field_id ] = wp_kses_post( $field_value ); |
|
908 | + $group_meta_value[$field_id] = wp_kses_post($field_value); |
|
909 | 909 | break; |
910 | 910 | |
911 | 911 | default: |
912 | - $group_meta_value[ $field_id ] = give_clean( $field_value ); |
|
912 | + $group_meta_value[$field_id] = give_clean($field_value); |
|
913 | 913 | } |
914 | 914 | } |
915 | 915 | |
916 | - if ( ! empty( $group_meta_value ) ) { |
|
917 | - $form_meta_value[ $index ] = $group_meta_value; |
|
916 | + if ( ! empty($group_meta_value)) { |
|
917 | + $form_meta_value[$index] = $group_meta_value; |
|
918 | 918 | } |
919 | 919 | } |
920 | 920 | |
921 | 921 | // Arrange repeater field keys in order. |
922 | - $form_meta_value = array_values( $form_meta_value ); |
|
922 | + $form_meta_value = array_values($form_meta_value); |
|
923 | 923 | break; |
924 | 924 | |
925 | 925 | default: |
926 | - $form_meta_value = give_clean( $_POST[ $form_meta_key ] ); |
|
926 | + $form_meta_value = give_clean($_POST[$form_meta_key]); |
|
927 | 927 | }// End switch(). |
928 | 928 | |
929 | 929 | /** |
@@ -933,38 +933,38 @@ discard block |
||
933 | 933 | */ |
934 | 934 | $form_meta_value = apply_filters( |
935 | 935 | 'give_pre_save_form_meta_value', |
936 | - $this->sanitize_form_meta( $form_meta_value, $setting_field ), |
|
936 | + $this->sanitize_form_meta($form_meta_value, $setting_field), |
|
937 | 937 | $form_meta_key, |
938 | 938 | $this, |
939 | 939 | $post_id |
940 | 940 | ); |
941 | 941 | |
942 | 942 | // Range slider. |
943 | - if ( 'donation_limit' === $setting_field['type'] ) { |
|
943 | + if ('donation_limit' === $setting_field['type']) { |
|
944 | 944 | |
945 | 945 | // Sanitize amount for db. |
946 | - $form_meta_value = array_map( 'give_sanitize_amount_for_db', $form_meta_value ); |
|
946 | + $form_meta_value = array_map('give_sanitize_amount_for_db', $form_meta_value); |
|
947 | 947 | |
948 | 948 | // Store it to form meta. |
949 | - give_update_meta( $post_id, $form_meta_key . '_minimum', $form_meta_value['minimum'] ); |
|
950 | - give_update_meta( $post_id, $form_meta_key . '_maximum', $form_meta_value['maximum'] ); |
|
949 | + give_update_meta($post_id, $form_meta_key.'_minimum', $form_meta_value['minimum']); |
|
950 | + give_update_meta($post_id, $form_meta_key.'_maximum', $form_meta_value['maximum']); |
|
951 | 951 | } else { |
952 | 952 | // Save data. |
953 | - give_update_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
953 | + give_update_meta($post_id, $form_meta_key, $form_meta_value); |
|
954 | 954 | } |
955 | 955 | |
956 | 956 | // Verify and delete form meta based on the form status. |
957 | - give_set_form_closed_status( $post_id ); |
|
957 | + give_set_form_closed_status($post_id); |
|
958 | 958 | |
959 | 959 | // Fire after saving form meta key. |
960 | - do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post ); |
|
960 | + do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post); |
|
961 | 961 | }// End if(). |
962 | 962 | }// End if(). |
963 | 963 | }// End foreach(). |
964 | 964 | }// End if(). |
965 | 965 | |
966 | 966 | // Fire action after saving form meta. |
967 | - do_action( 'give_post_process_give_forms_meta', $post_id, $post ); |
|
967 | + do_action('give_post_process_give_forms_meta', $post_id, $post); |
|
968 | 968 | } |
969 | 969 | |
970 | 970 | |
@@ -977,10 +977,10 @@ discard block |
||
977 | 977 | * |
978 | 978 | * @return string |
979 | 979 | */ |
980 | - private function get_field_id( $field ) { |
|
980 | + private function get_field_id($field) { |
|
981 | 981 | $field_id = ''; |
982 | 982 | |
983 | - if ( array_key_exists( 'id', $field ) ) { |
|
983 | + if (array_key_exists('id', $field)) { |
|
984 | 984 | $field_id = $field['id']; |
985 | 985 | |
986 | 986 | } |
@@ -997,16 +997,16 @@ discard block |
||
997 | 997 | * |
998 | 998 | * @return array |
999 | 999 | */ |
1000 | - private function get_fields_id( $setting ) { |
|
1000 | + private function get_fields_id($setting) { |
|
1001 | 1001 | $meta_keys = array(); |
1002 | 1002 | |
1003 | 1003 | if ( |
1004 | - ! empty( $setting ) |
|
1005 | - && array_key_exists( 'fields', $setting ) |
|
1006 | - && ! empty( $setting['fields'] ) |
|
1004 | + ! empty($setting) |
|
1005 | + && array_key_exists('fields', $setting) |
|
1006 | + && ! empty($setting['fields']) |
|
1007 | 1007 | ) { |
1008 | - foreach ( $setting['fields'] as $field ) { |
|
1009 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
1008 | + foreach ($setting['fields'] as $field) { |
|
1009 | + if ($field_id = $this->get_field_id($field)) { |
|
1010 | 1010 | $meta_keys[] = $field_id; |
1011 | 1011 | } |
1012 | 1012 | } |
@@ -1024,14 +1024,14 @@ discard block |
||
1024 | 1024 | * |
1025 | 1025 | * @return array |
1026 | 1026 | */ |
1027 | - private function get_sub_fields_id( $setting ) { |
|
1027 | + private function get_sub_fields_id($setting) { |
|
1028 | 1028 | $meta_keys = array(); |
1029 | 1029 | |
1030 | - if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) { |
|
1031 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
1032 | - if ( ! empty( $fields['fields'] ) ) { |
|
1033 | - foreach ( $fields['fields'] as $field ) { |
|
1034 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
1030 | + if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) { |
|
1031 | + foreach ($setting['sub-fields'] as $fields) { |
|
1032 | + if ( ! empty($fields['fields'])) { |
|
1033 | + foreach ($fields['fields'] as $field) { |
|
1034 | + if ($field_id = $this->get_field_id($field)) { |
|
1035 | 1035 | $meta_keys[] = $field_id; |
1036 | 1036 | } |
1037 | 1037 | } |
@@ -1053,14 +1053,14 @@ discard block |
||
1053 | 1053 | private function get_meta_keys_from_settings() { |
1054 | 1054 | $meta_keys = array(); |
1055 | 1055 | |
1056 | - foreach ( $this->settings as $setting ) { |
|
1057 | - $meta_key = $this->get_fields_id( $setting ); |
|
1056 | + foreach ($this->settings as $setting) { |
|
1057 | + $meta_key = $this->get_fields_id($setting); |
|
1058 | 1058 | |
1059 | - if ( $this->has_sub_tab( $setting ) ) { |
|
1060 | - $meta_key = array_merge( $meta_key, $this->get_sub_fields_id( $setting ) ); |
|
1059 | + if ($this->has_sub_tab($setting)) { |
|
1060 | + $meta_key = array_merge($meta_key, $this->get_sub_fields_id($setting)); |
|
1061 | 1061 | } |
1062 | 1062 | |
1063 | - $meta_keys = array_merge( $meta_keys, $meta_key ); |
|
1063 | + $meta_keys = array_merge($meta_keys, $meta_key); |
|
1064 | 1064 | } |
1065 | 1065 | |
1066 | 1066 | return $meta_keys; |
@@ -1077,10 +1077,10 @@ discard block |
||
1077 | 1077 | * |
1078 | 1078 | * @return string |
1079 | 1079 | */ |
1080 | - function get_field_type( $field_id, $group_id = '' ) { |
|
1081 | - $field = $this->get_setting_field( $field_id, $group_id ); |
|
1080 | + function get_field_type($field_id, $group_id = '') { |
|
1081 | + $field = $this->get_setting_field($field_id, $group_id); |
|
1082 | 1082 | |
1083 | - $type = array_key_exists( 'type', $field ) |
|
1083 | + $type = array_key_exists('type', $field) |
|
1084 | 1084 | ? $field['type'] |
1085 | 1085 | : ''; |
1086 | 1086 | |
@@ -1098,12 +1098,12 @@ discard block |
||
1098 | 1098 | * |
1099 | 1099 | * @return array |
1100 | 1100 | */ |
1101 | - private function get_field( $setting, $field_id ) { |
|
1101 | + private function get_field($setting, $field_id) { |
|
1102 | 1102 | $setting_field = array(); |
1103 | 1103 | |
1104 | - if ( ! empty( $setting['fields'] ) ) { |
|
1105 | - foreach ( $setting['fields'] as $field ) { |
|
1106 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) { |
|
1104 | + if ( ! empty($setting['fields'])) { |
|
1105 | + foreach ($setting['fields'] as $field) { |
|
1106 | + if (array_key_exists('id', $field) && $field['id'] === $field_id) { |
|
1107 | 1107 | $setting_field = $field; |
1108 | 1108 | break; |
1109 | 1109 | } |
@@ -1123,12 +1123,12 @@ discard block |
||
1123 | 1123 | * |
1124 | 1124 | * @return array |
1125 | 1125 | */ |
1126 | - private function get_sub_field( $setting, $field_id ) { |
|
1126 | + private function get_sub_field($setting, $field_id) { |
|
1127 | 1127 | $setting_field = array(); |
1128 | 1128 | |
1129 | - if ( ! empty( $setting['sub-fields'] ) ) { |
|
1130 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
1131 | - if ( $field = $this->get_field( $fields, $field_id ) ) { |
|
1129 | + if ( ! empty($setting['sub-fields'])) { |
|
1130 | + foreach ($setting['sub-fields'] as $fields) { |
|
1131 | + if ($field = $this->get_field($fields, $field_id)) { |
|
1132 | 1132 | $setting_field = $field; |
1133 | 1133 | break; |
1134 | 1134 | } |
@@ -1148,17 +1148,17 @@ discard block |
||
1148 | 1148 | * |
1149 | 1149 | * @return array |
1150 | 1150 | */ |
1151 | - function get_setting_field( $field_id, $group_id = '' ) { |
|
1151 | + function get_setting_field($field_id, $group_id = '') { |
|
1152 | 1152 | $setting_field = array(); |
1153 | 1153 | |
1154 | 1154 | $_field_id = $field_id; |
1155 | - $field_id = empty( $group_id ) ? $field_id : $group_id; |
|
1155 | + $field_id = empty($group_id) ? $field_id : $group_id; |
|
1156 | 1156 | |
1157 | - if ( ! empty( $this->settings ) ) { |
|
1158 | - foreach ( $this->settings as $setting ) { |
|
1157 | + if ( ! empty($this->settings)) { |
|
1158 | + foreach ($this->settings as $setting) { |
|
1159 | 1159 | if ( |
1160 | - ( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) ) |
|
1161 | - || ( $setting_field = $this->get_field( $setting, $field_id ) ) |
|
1160 | + ($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id))) |
|
1161 | + || ($setting_field = $this->get_field($setting, $field_id)) |
|
1162 | 1162 | ) { |
1163 | 1163 | break; |
1164 | 1164 | } |
@@ -1166,9 +1166,9 @@ discard block |
||
1166 | 1166 | } |
1167 | 1167 | |
1168 | 1168 | // Get field from group. |
1169 | - if ( ! empty( $group_id ) ) { |
|
1170 | - foreach ( $setting_field['fields'] as $field ) { |
|
1171 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) { |
|
1169 | + if ( ! empty($group_id)) { |
|
1170 | + foreach ($setting_field['fields'] as $field) { |
|
1171 | + if (array_key_exists('id', $field) && $field['id'] === $_field_id) { |
|
1172 | 1172 | $setting_field = $field; |
1173 | 1173 | } |
1174 | 1174 | } |
@@ -1187,14 +1187,14 @@ discard block |
||
1187 | 1187 | * |
1188 | 1188 | * @return mixed |
1189 | 1189 | */ |
1190 | - function add_offline_donations_setting_tab( $settings ) { |
|
1191 | - if ( give_is_gateway_active( 'offline' ) ) { |
|
1192 | - $settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array( |
|
1190 | + function add_offline_donations_setting_tab($settings) { |
|
1191 | + if (give_is_gateway_active('offline')) { |
|
1192 | + $settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array( |
|
1193 | 1193 | 'id' => 'offline_donations_options', |
1194 | - 'title' => __( 'Offline Donations', 'give' ), |
|
1194 | + 'title' => __('Offline Donations', 'give'), |
|
1195 | 1195 | 'icon-html' => '<span class="give-icon give-icon-purse"></span>', |
1196 | - 'fields' => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ), |
|
1197 | - ) ); |
|
1196 | + 'fields' => apply_filters('give_forms_offline_donations_metabox_fields', array()), |
|
1197 | + )); |
|
1198 | 1198 | } |
1199 | 1199 | |
1200 | 1200 | return $settings; |
@@ -1212,37 +1212,33 @@ discard block |
||
1212 | 1212 | * |
1213 | 1213 | * @return mixed |
1214 | 1214 | */ |
1215 | - function sanitize_form_meta( $meta_value, $setting_field ) { |
|
1216 | - switch ( $setting_field['type'] ) { |
|
1215 | + function sanitize_form_meta($meta_value, $setting_field) { |
|
1216 | + switch ($setting_field['type']) { |
|
1217 | 1217 | case 'group': |
1218 | - if ( ! empty( $setting_field['fields'] ) ) { |
|
1219 | - foreach ( $setting_field['fields'] as $field ) { |
|
1220 | - if ( empty( $field['data_type'] ) || 'price' !== $field['data_type'] ) { |
|
1218 | + if ( ! empty($setting_field['fields'])) { |
|
1219 | + foreach ($setting_field['fields'] as $field) { |
|
1220 | + if (empty($field['data_type']) || 'price' !== $field['data_type']) { |
|
1221 | 1221 | continue; |
1222 | 1222 | } |
1223 | 1223 | |
1224 | - foreach ( $meta_value as $index => $meta_data ) { |
|
1225 | - if ( ! isset( $meta_value[ $index ][ $field['id'] ] ) ) { |
|
1224 | + foreach ($meta_value as $index => $meta_data) { |
|
1225 | + if ( ! isset($meta_value[$index][$field['id']])) { |
|
1226 | 1226 | continue; |
1227 | 1227 | } |
1228 | 1228 | |
1229 | - $meta_value[ $index ][ $field['id'] ] = ! empty( $meta_value[ $index ][ $field['id'] ] ) ? |
|
1230 | - give_sanitize_amount_for_db( $meta_value[ $index ][ $field['id'] ] ) : |
|
1231 | - ( ( '_give_amount' === $field['id'] && empty( $field_value ) ) ? |
|
1232 | - give_sanitize_amount_for_db( '1.00' ) : |
|
1233 | - 0 ); |
|
1229 | + $meta_value[$index][$field['id']] = ! empty($meta_value[$index][$field['id']]) ? |
|
1230 | + give_sanitize_amount_for_db($meta_value[$index][$field['id']]) : (('_give_amount' === $field['id'] && empty($field_value)) ? |
|
1231 | + give_sanitize_amount_for_db('1.00') : 0); |
|
1234 | 1232 | } |
1235 | 1233 | } |
1236 | 1234 | } |
1237 | 1235 | break; |
1238 | 1236 | |
1239 | 1237 | default: |
1240 | - if ( ! empty( $setting_field['data_type'] ) && 'price' === $setting_field['data_type'] ) { |
|
1238 | + if ( ! empty($setting_field['data_type']) && 'price' === $setting_field['data_type']) { |
|
1241 | 1239 | $meta_value = $meta_value ? |
1242 | - give_sanitize_amount_for_db( $meta_value ) : |
|
1243 | - ( in_array( $setting_field['id'], array( '_give_set_price', '_give_custom_amount_minimum', '_give_set_goal' ) ) ? |
|
1244 | - give_sanitize_amount_for_db( '1.00' ) : |
|
1245 | - 0 ); |
|
1240 | + give_sanitize_amount_for_db($meta_value) : (in_array($setting_field['id'], array('_give_set_price', '_give_custom_amount_minimum', '_give_set_goal')) ? |
|
1241 | + give_sanitize_amount_for_db('1.00') : 0); |
|
1246 | 1242 | } |
1247 | 1243 | } |
1248 | 1244 | |
@@ -1260,12 +1256,12 @@ discard block |
||
1260 | 1256 | * |
1261 | 1257 | * @return string The URL after redirect. |
1262 | 1258 | */ |
1263 | - public function maintain_active_tab( $location, $post_id ) { |
|
1259 | + public function maintain_active_tab($location, $post_id) { |
|
1264 | 1260 | if ( |
1265 | - 'give_forms' === get_post_type( $post_id ) && |
|
1266 | - ! empty( $_POST['give_form_active_tab'] ) |
|
1261 | + 'give_forms' === get_post_type($post_id) && |
|
1262 | + ! empty($_POST['give_form_active_tab']) |
|
1267 | 1263 | ) { |
1268 | - $location = add_query_arg( 'give_tab', give_clean( $_POST['give_form_active_tab'] ), $location ); |
|
1264 | + $location = add_query_arg('give_tab', give_clean($_POST['give_form_active_tab']), $location); |
|
1269 | 1265 | } |
1270 | 1266 | |
1271 | 1267 | return $location; |
@@ -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 | -if ( ! current_user_can( 'view_give_payments' ) ) { |
|
17 | +if ( ! current_user_can('view_give_payments')) { |
|
18 | 18 | wp_die( |
19 | - __( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array( |
|
19 | + __('Sorry, you are not allowed to access this page.', 'give'), __('Error', 'give'), array( |
|
20 | 20 | 'response' => 403, |
21 | 21 | ) |
22 | 22 | ); |
@@ -28,35 +28,35 @@ discard block |
||
28 | 28 | * @since 1.0 |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
32 | - wp_die( __( 'Donation ID not supplied. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
31 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
32 | + wp_die(__('Donation ID not supplied. Please try again.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | // Setup the variables |
36 | -$payment_id = absint( $_GET['id'] ); |
|
37 | -$payment = new Give_Payment( $payment_id ); |
|
36 | +$payment_id = absint($_GET['id']); |
|
37 | +$payment = new Give_Payment($payment_id); |
|
38 | 38 | |
39 | 39 | // Sanity check... fail if donation ID is invalid |
40 | 40 | $payment_exists = $payment->ID; |
41 | -if ( empty( $payment_exists ) ) { |
|
42 | - wp_die( __( 'The specified ID does not belong to a donation. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
41 | +if (empty($payment_exists)) { |
|
42 | + wp_die(__('The specified ID does not belong to a donation. Please try again.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $number = $payment->number; |
46 | 46 | $payment_meta = $payment->get_meta(); |
47 | 47 | |
48 | -$company_name = ! empty( $payment_meta['_give_donation_company'] ) ? esc_attr( $payment_meta['_give_donation_company'] ) : ''; |
|
49 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
48 | +$company_name = ! empty($payment_meta['_give_donation_company']) ? esc_attr($payment_meta['_give_donation_company']) : ''; |
|
49 | +$transaction_id = esc_attr($payment->transaction_id); |
|
50 | 50 | $user_id = $payment->user_id; |
51 | 51 | $donor_id = $payment->customer_id; |
52 | -$payment_date = strtotime( $payment->date ); |
|
53 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
52 | +$payment_date = strtotime($payment->date); |
|
53 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
54 | 54 | $address = $payment->address; |
55 | 55 | $currency_code = $payment->currency; |
56 | 56 | $gateway = $payment->gateway; |
57 | 57 | $currency_code = $payment->currency; |
58 | 58 | $payment_mode = $payment->mode; |
59 | -$base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
59 | +$base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
60 | 60 | |
61 | 61 | ?> |
62 | 62 | <div class="wrap give-wrap"> |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | <?php |
66 | 66 | printf( |
67 | 67 | /* translators: %s: donation number */ |
68 | - esc_html__( 'Donation %s', 'give' ), |
|
68 | + esc_html__('Donation %s', 'give'), |
|
69 | 69 | $number |
70 | 70 | ); |
71 | - if ( $payment_mode == 'test' ) { |
|
71 | + if ($payment_mode == 'test') { |
|
72 | 72 | echo Give()->tooltips->render_span(array( |
73 | - 'label' => __( 'This donation was made in test mode.', 'give' ), |
|
74 | - 'tag_content' => __( 'Test Donation', 'give' ), |
|
73 | + 'label' => __('This donation was made in test mode.', 'give'), |
|
74 | + 'tag_content' => __('Test Donation', 'give'), |
|
75 | 75 | 'position'=> 'right', |
76 | 76 | 'attributes' => array( |
77 | 77 | 'id' => 'test-payment-label', |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @param int $payment_id Payment id. |
92 | 92 | */ |
93 | - do_action( 'give_view_donation_details_before', $payment_id ); |
|
93 | + do_action('give_view_donation_details_before', $payment_id); |
|
94 | 94 | ?> |
95 | 95 | |
96 | 96 | <hr class="wp-header-end"> |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @param int $payment_id Payment id. |
106 | 106 | */ |
107 | - do_action( 'give_view_donation_details_form_top', $payment_id ); |
|
107 | + do_action('give_view_donation_details_form_top', $payment_id); |
|
108 | 108 | ?> |
109 | 109 | <div id="poststuff"> |
110 | 110 | <div id="give-dashboard-widgets-wrap"> |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @param int $payment_id Payment id. |
122 | 122 | */ |
123 | - do_action( 'give_view_donation_details_sidebar_before', $payment_id ); |
|
123 | + do_action('give_view_donation_details_sidebar_before', $payment_id); |
|
124 | 124 | ?> |
125 | 125 | |
126 | 126 | <div id="give-order-update" class="postbox give-order-data"> |
127 | 127 | |
128 | 128 | <div class="give-order-top"> |
129 | - <h3 class="hndle"><?php _e( 'Update Donation', 'give' ); ?></h3> |
|
129 | + <h3 class="hndle"><?php _e('Update Donation', 'give'); ?></h3> |
|
130 | 130 | |
131 | 131 | <?php |
132 | - if ( current_user_can( 'view_give_payments' ) ) { |
|
132 | + if (current_user_can('view_give_payments')) { |
|
133 | 133 | echo sprintf( |
134 | 134 | '<span class="delete-donation" id="delete-donation-%d"><a class="delete-single-donation delete-donation-button dashicons dashicons-trash" href="%s" aria-label="%s"></a></span>', |
135 | 135 | $payment_id, |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | ), $base_url |
142 | 142 | ), 'give_donation_nonce' |
143 | 143 | ), |
144 | - sprintf( __( 'Delete Donation %s', 'give' ), $payment_id ) |
|
144 | + sprintf(__('Delete Donation %s', 'give'), $payment_id) |
|
145 | 145 | ); |
146 | 146 | } |
147 | 147 | ?> |
@@ -158,33 +158,33 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @param int $payment_id Payment id. |
160 | 160 | */ |
161 | - do_action( 'give_view_donation_details_totals_before', $payment_id ); |
|
161 | + do_action('give_view_donation_details_totals_before', $payment_id); |
|
162 | 162 | ?> |
163 | 163 | |
164 | 164 | <div class="give-admin-box-inside"> |
165 | 165 | <p> |
166 | - <label for="give-payment-status" class="strong"><?php _e( 'Status:', 'give' ); ?></label> |
|
166 | + <label for="give-payment-status" class="strong"><?php _e('Status:', 'give'); ?></label> |
|
167 | 167 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
168 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
169 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
168 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
169 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
170 | 170 | <?php endforeach; ?> |
171 | 171 | </select> |
172 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
172 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
173 | 173 | </p> |
174 | 174 | </div> |
175 | 175 | |
176 | 176 | <div class="give-admin-box-inside"> |
177 | 177 | <p> |
178 | - <label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label> |
|
179 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
178 | + <label for="give-payment-date" class="strong"><?php _e('Date:', 'give'); ?></label> |
|
179 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
180 | 180 | </p> |
181 | 181 | </div> |
182 | 182 | |
183 | 183 | <div class="give-admin-box-inside"> |
184 | 184 | <p> |
185 | - <label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label> |
|
186 | - <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
187 | - <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
185 | + <label for="give-payment-time-hour" class="strong"><?php _e('Time:', 'give'); ?></label> |
|
186 | + <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
187 | + <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
188 | 188 | </p> |
189 | 189 | </div> |
190 | 190 | |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | * |
199 | 199 | * @param int $payment_id Payment id. |
200 | 200 | */ |
201 | - do_action( 'give_view_donation_details_update_inner', $payment_id ); |
|
201 | + do_action('give_view_donation_details_update_inner', $payment_id); |
|
202 | 202 | ?> |
203 | 203 | |
204 | 204 | <div class="give-order-payment give-admin-box-inside"> |
205 | 205 | <p> |
206 | - <label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label> |
|
207 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
208 | - <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_donation_amount( $payment_id ), false, false ) ); ?>"/> |
|
206 | + <label for="give-payment-total" class="strong"><?php _e('Total Donation:', 'give'); ?></label> |
|
207 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
208 | + <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_donation_amount($payment_id), false, false)); ?>"/> |
|
209 | 209 | </p> |
210 | 210 | </div> |
211 | 211 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @param int $payment_id Payment id. |
219 | 219 | */ |
220 | - do_action( 'give_view_donation_details_totals_after', $payment_id ); |
|
220 | + do_action('give_view_donation_details_totals_after', $payment_id); |
|
221 | 221 | ?> |
222 | 222 | |
223 | 223 | </div> |
@@ -235,17 +235,17 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @param int $payment_id Payment id. |
237 | 237 | */ |
238 | - do_action( 'give_view_donation_details_update_before', $payment_id ); |
|
238 | + do_action('give_view_donation_details_update_before', $payment_id); |
|
239 | 239 | ?> |
240 | 240 | |
241 | 241 | <div id="major-publishing-actions"> |
242 | 242 | <div id="publishing-action"> |
243 | 243 | |
244 | 244 | <input type="submit" class="button button-primary right" |
245 | - value="<?php _e( 'Save Donation', 'give' ); ?>"/> |
|
245 | + value="<?php _e('Save Donation', 'give'); ?>"/> |
|
246 | 246 | |
247 | 247 | <?php |
248 | - if ( give_is_payment_complete( $payment_id ) ) { |
|
248 | + if (give_is_payment_complete($payment_id)) { |
|
249 | 249 | echo sprintf( |
250 | 250 | '<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>', |
251 | 251 | esc_url( |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | ) |
257 | 257 | ) |
258 | 258 | ), |
259 | - __( 'Resend Receipt', 'give' ) |
|
259 | + __('Resend Receipt', 'give') |
|
260 | 260 | ); |
261 | 261 | } |
262 | 262 | ?> |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @param int $payment_id Payment id. |
273 | 273 | */ |
274 | - do_action( 'give_view_donation_details_update_after', $payment_id ); |
|
274 | + do_action('give_view_donation_details_update_after', $payment_id); |
|
275 | 275 | ?> |
276 | 276 | |
277 | 277 | </div> |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | |
283 | 283 | <div id="give-order-details" class="postbox give-order-data"> |
284 | 284 | |
285 | - <h3 class="hndle"><?php _e( 'Donation Meta', 'give' ); ?></h3> |
|
285 | + <h3 class="hndle"><?php _e('Donation Meta', 'give'); ?></h3> |
|
286 | 286 | |
287 | 287 | <div class="inside"> |
288 | 288 | <div class="give-admin-box"> |
@@ -295,30 +295,30 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @param int $payment_id Payment id. |
297 | 297 | */ |
298 | - do_action( 'give_view_donation_details_payment_meta_before', $payment_id ); |
|
298 | + do_action('give_view_donation_details_payment_meta_before', $payment_id); |
|
299 | 299 | |
300 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
301 | - if ( $gateway ) : |
|
300 | + $gateway = give_get_payment_gateway($payment_id); |
|
301 | + if ($gateway) : |
|
302 | 302 | ?> |
303 | 303 | <div class="give-order-gateway give-admin-box-inside"> |
304 | 304 | <p> |
305 | - <strong><?php _e( 'Gateway:', 'give' ); ?></strong> |
|
306 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
305 | + <strong><?php _e('Gateway:', 'give'); ?></strong> |
|
306 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
307 | 307 | </p> |
308 | 308 | </div> |
309 | 309 | <?php endif; ?> |
310 | 310 | |
311 | 311 | <div class="give-order-payment-key give-admin-box-inside"> |
312 | 312 | <p> |
313 | - <strong><?php _e( 'Key:', 'give' ); ?></strong> |
|
314 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
313 | + <strong><?php _e('Key:', 'give'); ?></strong> |
|
314 | + <?php echo give_get_payment_key($payment_id); ?> |
|
315 | 315 | </p> |
316 | 316 | </div> |
317 | 317 | |
318 | 318 | <div class="give-order-ip give-admin-box-inside"> |
319 | 319 | <p> |
320 | - <strong><?php _e( 'IP:', 'give' ); ?></strong> |
|
321 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
320 | + <strong><?php _e('IP:', 'give'); ?></strong> |
|
321 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
322 | 322 | </p> |
323 | 323 | </div> |
324 | 324 | |
@@ -326,18 +326,18 @@ discard block |
||
326 | 326 | // Display the transaction ID present. |
327 | 327 | // The transaction ID is the charge ID from the gateway. |
328 | 328 | // For instance, stripe "ch_BzvwYCchqOy5Nt". |
329 | - if ( $transaction_id != $payment_id ) : ?> |
|
329 | + if ($transaction_id != $payment_id) : ?> |
|
330 | 330 | <div class="give-order-tx-id give-admin-box-inside"> |
331 | 331 | <p> |
332 | - <strong><?php _e( 'Transaction ID:', 'give' ); ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo sprintf( esc_attr__( 'The transaction ID within %s.', 'give' ), $gateway); ?>"></span></strong> |
|
333 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
332 | + <strong><?php _e('Transaction ID:', 'give'); ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo sprintf(esc_attr__('The transaction ID within %s.', 'give'), $gateway); ?>"></span></strong> |
|
333 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
334 | 334 | </p> |
335 | 335 | </div> |
336 | 336 | <?php endif; ?> |
337 | 337 | |
338 | 338 | <div class="give-admin-box-inside"> |
339 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?> |
|
340 | - <a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor »', 'give' ); ?></a> |
|
339 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?> |
|
340 | + <a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor »', 'give'); ?></a> |
|
341 | 341 | </p> |
342 | 342 | </div> |
343 | 343 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | * |
350 | 350 | * @param int $payment_id Payment id. |
351 | 351 | */ |
352 | - do_action( 'give_view_donation_details_payment_meta_after', $payment_id ); |
|
352 | + do_action('give_view_donation_details_payment_meta_after', $payment_id); |
|
353 | 353 | ?> |
354 | 354 | |
355 | 355 | </div> |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * |
370 | 370 | * @param int $payment_id Payment id. |
371 | 371 | */ |
372 | - do_action( 'give_view_donation_details_sidebar_after', $payment_id ); |
|
372 | + do_action('give_view_donation_details_sidebar_after', $payment_id); |
|
373 | 373 | ?> |
374 | 374 | |
375 | 375 | </div> |
@@ -389,31 +389,31 @@ discard block |
||
389 | 389 | * |
390 | 390 | * @param int $payment_id Payment id. |
391 | 391 | */ |
392 | - do_action( 'give_view_donation_details_main_before', $payment_id ); |
|
392 | + do_action('give_view_donation_details_main_before', $payment_id); |
|
393 | 393 | ?> |
394 | 394 | |
395 | 395 | <?php $column_count = 'columns-3'; ?> |
396 | 396 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
397 | - <h3 class="hndle"><?php _e( 'Donation Information', 'give' ); ?></h3> |
|
397 | + <h3 class="hndle"><?php _e('Donation Information', 'give'); ?></h3> |
|
398 | 398 | |
399 | 399 | <div class="inside"> |
400 | 400 | |
401 | 401 | <div class="column-container"> |
402 | 402 | <div class="column"> |
403 | 403 | <p> |
404 | - <strong><?php _e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
404 | + <strong><?php _e('Donation Form ID:', 'give'); ?></strong><br> |
|
405 | 405 | <?php |
406 | - if ( $payment_meta['form_id'] ) : |
|
406 | + if ($payment_meta['form_id']) : |
|
407 | 407 | printf( |
408 | 408 | '<a href="%1$s">%2$s</a>', |
409 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
409 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
410 | 410 | $payment_meta['form_id'] |
411 | 411 | ); |
412 | 412 | endif; |
413 | 413 | ?> |
414 | 414 | </p> |
415 | 415 | <p> |
416 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
416 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
417 | 417 | <?php |
418 | 418 | echo Give()->html->forms_dropdown( |
419 | 419 | array( |
@@ -429,21 +429,21 @@ discard block |
||
429 | 429 | </div> |
430 | 430 | <div class="column"> |
431 | 431 | <p> |
432 | - <strong><?php _e( 'Donation Date:', 'give' ); ?></strong><br> |
|
433 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
432 | + <strong><?php _e('Donation Date:', 'give'); ?></strong><br> |
|
433 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
434 | 434 | </p> |
435 | 435 | <p> |
436 | - <strong><?php _e( 'Donation Level:', 'give' ); ?></strong><br> |
|
436 | + <strong><?php _e('Donation Level:', 'give'); ?></strong><br> |
|
437 | 437 | <span class="give-donation-level"> |
438 | 438 | <?php |
439 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
440 | - if ( empty( $var_prices ) ) { |
|
441 | - _e( 'n/a', 'give' ); |
|
439 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
440 | + if (empty($var_prices)) { |
|
441 | + _e('n/a', 'give'); |
|
442 | 442 | } else { |
443 | 443 | $prices_atts = array(); |
444 | - if ( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
445 | - foreach ( $variable_prices as $variable_price ) { |
|
446 | - $prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ); |
|
444 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
445 | + foreach ($variable_prices as $variable_price) { |
|
446 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false)); |
|
447 | 447 | } |
448 | 448 | } |
449 | 449 | // Variable price dropdown options. |
@@ -452,12 +452,12 @@ discard block |
||
452 | 452 | 'name' => 'give-variable-price', |
453 | 453 | 'chosen' => true, |
454 | 454 | 'show_option_all' => '', |
455 | - 'show_option_none' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' ) : '' ), |
|
456 | - 'select_atts' => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ), |
|
455 | + 'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''), |
|
456 | + 'select_atts' => 'data-prices='.esc_attr(wp_json_encode($prices_atts)), |
|
457 | 457 | 'selected' => $payment_meta['price_id'], |
458 | 458 | ); |
459 | 459 | // Render variable prices select tag html. |
460 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
460 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
461 | 461 | } |
462 | 462 | ?> |
463 | 463 | </span> |
@@ -465,8 +465,8 @@ discard block |
||
465 | 465 | </div> |
466 | 466 | <div class="column"> |
467 | 467 | <p> |
468 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
469 | - <?php echo give_donation_amount( $payment, true ); ?> |
|
468 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
469 | + <?php echo give_donation_amount($payment, true); ?> |
|
470 | 470 | </p> |
471 | 471 | |
472 | 472 | <p> |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * |
481 | 481 | * @param int $payment_id Payment id. |
482 | 482 | */ |
483 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
483 | + do_action('give_donation_details_thead_before', $payment_id); |
|
484 | 484 | |
485 | 485 | |
486 | 486 | /** |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | * |
493 | 493 | * @param int $payment_id Payment id. |
494 | 494 | */ |
495 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
495 | + do_action('give_donation_details_thead_after', $payment_id); |
|
496 | 496 | |
497 | 497 | /** |
498 | 498 | * Fires in donation details page, in the donation-information metabox, before the body elements. |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | * |
504 | 504 | * @param int $payment_id Payment id. |
505 | 505 | */ |
506 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
506 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
507 | 507 | |
508 | 508 | /** |
509 | 509 | * Fires in donation details page, in the donation-information metabox, after the body elements. |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | * |
515 | 515 | * @param int $payment_id Payment id. |
516 | 516 | */ |
517 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
517 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
518 | 518 | ?> |
519 | 519 | </p> |
520 | 520 | </div> |
@@ -534,59 +534,59 @@ discard block |
||
534 | 534 | * |
535 | 535 | * @param int $payment_id Payment id. |
536 | 536 | */ |
537 | - do_action( 'give_view_donation_details_donor_detail_before', $payment_id ); |
|
537 | + do_action('give_view_donation_details_donor_detail_before', $payment_id); |
|
538 | 538 | ?> |
539 | 539 | |
540 | 540 | <div id="give-donor-details" class="postbox"> |
541 | - <h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3> |
|
541 | + <h3 class="hndle"><?php _e('Donor Details', 'give'); ?></h3> |
|
542 | 542 | |
543 | 543 | <div class="inside"> |
544 | 544 | |
545 | - <?php $donor = new Give_Donor( $donor_id ); ?> |
|
545 | + <?php $donor = new Give_Donor($donor_id); ?> |
|
546 | 546 | |
547 | 547 | <div class="column-container donor-info"> |
548 | 548 | <div class="column"> |
549 | 549 | <p> |
550 | - <strong><?php _e( 'Donor ID:', 'give' ); ?></strong><br> |
|
550 | + <strong><?php _e('Donor ID:', 'give'); ?></strong><br> |
|
551 | 551 | <?php |
552 | - if ( ! empty( $donor->id ) ) { |
|
552 | + if ( ! empty($donor->id)) { |
|
553 | 553 | printf( |
554 | 554 | '<a href="%1$s">%2$s</a>', |
555 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ), |
|
555 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id), |
|
556 | 556 | $donor->id |
557 | 557 | ); |
558 | 558 | } |
559 | 559 | ?> |
560 | - <span>(<a href="#new" class="give-payment-new-donor"><?php _e( 'Create New Donor', 'give' ); ?></a>)</span> |
|
560 | + <span>(<a href="#new" class="give-payment-new-donor"><?php _e('Create New Donor', 'give'); ?></a>)</span> |
|
561 | 561 | </p> |
562 | 562 | <p> |
563 | - <strong><?php _e( 'Donor Since:', 'give' ); ?></strong><br> |
|
564 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
563 | + <strong><?php _e('Donor Since:', 'give'); ?></strong><br> |
|
564 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
565 | 565 | </p> |
566 | 566 | </div> |
567 | 567 | <div class="column"> |
568 | 568 | <p> |
569 | - <strong><?php _e( 'Donor Name:', 'give' ); ?></strong><br> |
|
569 | + <strong><?php _e('Donor Name:', 'give'); ?></strong><br> |
|
570 | 570 | <?php |
571 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
572 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
571 | + $donor_billing_name = give_get_donor_name_by($payment_id, 'donation'); |
|
572 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
573 | 573 | |
574 | 574 | // Check whether the donor name and WP_User name is same or not. |
575 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
576 | - echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
575 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
576 | + echo $donor_billing_name.' (<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>)'; |
|
577 | 577 | } else { |
578 | 578 | echo $donor_name; |
579 | 579 | } |
580 | 580 | ?> |
581 | 581 | </p> |
582 | 582 | <p> |
583 | - <strong><?php _e( 'Donor Email:', 'give' ); ?></strong><br> |
|
583 | + <strong><?php _e('Donor Email:', 'give'); ?></strong><br> |
|
584 | 584 | <?php echo $donor->email; ?> |
585 | 585 | </p> |
586 | 586 | </div> |
587 | 587 | <div class="column"> |
588 | 588 | <p> |
589 | - <strong><?php _e( 'Change Donor:', 'give' ); ?></strong><br> |
|
589 | + <strong><?php _e('Change Donor:', 'give'); ?></strong><br> |
|
590 | 590 | <?php |
591 | 591 | echo Give()->html->donor_dropdown( |
592 | 592 | array( |
@@ -597,9 +597,9 @@ discard block |
||
597 | 597 | ?> |
598 | 598 | </p> |
599 | 599 | <p> |
600 | - <?php if ( ! empty( $company_name ) ) { |
|
600 | + <?php if ( ! empty($company_name)) { |
|
601 | 601 | ?> |
602 | - <strong><?php esc_html_e( 'Company Name:', 'give' ); ?></strong><br> |
|
602 | + <strong><?php esc_html_e('Company Name:', 'give'); ?></strong><br> |
|
603 | 603 | <?php |
604 | 604 | echo $company_name; |
605 | 605 | } ?> |
@@ -610,19 +610,19 @@ discard block |
||
610 | 610 | <div class="column-container new-donor" style="display: none"> |
611 | 611 | <div class="column"> |
612 | 612 | <p> |
613 | - <label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label> |
|
613 | + <label for="give-new-donor-first-name"><?php _e('New Donor First Name:', 'give'); ?></label> |
|
614 | 614 | <input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/> |
615 | 615 | </p> |
616 | 616 | </div> |
617 | 617 | <div class="column"> |
618 | 618 | <p> |
619 | - <label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label> |
|
619 | + <label for="give-new-donor-last-name"><?php _e('New Donor Last Name:', 'give'); ?></label> |
|
620 | 620 | <input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/> |
621 | 621 | </p> |
622 | 622 | </div> |
623 | 623 | <div class="column"> |
624 | 624 | <p> |
625 | - <label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label> |
|
625 | + <label for="give-new-donor-email"><?php _e('New Donor Email:', 'give'); ?></label> |
|
626 | 626 | <input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/> |
627 | 627 | </p> |
628 | 628 | </div> |
@@ -630,9 +630,9 @@ discard block |
||
630 | 630 | <p> |
631 | 631 | <input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/> |
632 | 632 | <input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/> |
633 | - <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
633 | + <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e('Cancel', 'give'); ?></a> |
|
634 | 634 | <br> |
635 | - <em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
635 | + <em><?php _e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
636 | 636 | </p> |
637 | 637 | </div> |
638 | 638 | </div> |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | * @param array $payment_meta Payment meta. |
648 | 648 | * @param array $user_info User information. |
649 | 649 | */ |
650 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
650 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
651 | 651 | |
652 | 652 | /** |
653 | 653 | * Fires on the donation details page, in the donor-details metabox. |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | * |
657 | 657 | * @param int $payment_id Payment id. |
658 | 658 | */ |
659 | - do_action( 'give_payment_view_details', $payment_id ); |
|
659 | + do_action('give_payment_view_details', $payment_id); |
|
660 | 660 | ?> |
661 | 661 | |
662 | 662 | </div> |
@@ -672,11 +672,11 @@ discard block |
||
672 | 672 | * |
673 | 673 | * @param int $payment_id Payment id. |
674 | 674 | */ |
675 | - do_action( 'give_view_donation_details_billing_before', $payment_id ); |
|
675 | + do_action('give_view_donation_details_billing_before', $payment_id); |
|
676 | 676 | ?> |
677 | 677 | |
678 | 678 | <div id="give-billing-details" class="postbox"> |
679 | - <h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3> |
|
679 | + <h3 class="hndle"><?php _e('Billing Address', 'give'); ?></h3> |
|
680 | 680 | |
681 | 681 | <div class="inside"> |
682 | 682 | |
@@ -686,9 +686,9 @@ discard block |
||
686 | 686 | <div class="data column-container"> |
687 | 687 | |
688 | 688 | <?php |
689 | - $address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() ); |
|
689 | + $address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country()); |
|
690 | 690 | |
691 | - $address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' ); |
|
691 | + $address['state'] = ( ! empty($address['state']) ? $address['state'] : ''); |
|
692 | 692 | |
693 | 693 | // Get the country list that does not have any states init. |
694 | 694 | $no_states_country = give_no_states_country_list(); |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | |
697 | 697 | <div class="row"> |
698 | 698 | <div id="give-order-address-country-wrap"> |
699 | - <label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label> |
|
699 | + <label class="order-data-address-line"><?php _e('Country:', 'give'); ?></label> |
|
700 | 700 | <?php |
701 | 701 | echo Give()->html->select( |
702 | 702 | array( |
@@ -706,8 +706,8 @@ discard block |
||
706 | 706 | 'show_option_all' => false, |
707 | 707 | 'show_option_none' => false, |
708 | 708 | 'chosen' => true, |
709 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
710 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
709 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
710 | + 'data' => array('search-type' => 'no_ajax'), |
|
711 | 711 | ) |
712 | 712 | ); |
713 | 713 | ?> |
@@ -716,35 +716,35 @@ discard block |
||
716 | 716 | |
717 | 717 | <div class="row"> |
718 | 718 | <div class="give-wrap-address-line1"> |
719 | - <label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label> |
|
720 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
719 | + <label for="give-payment-address-line1" class="order-data-address"><?php _e('Address 1:', 'give'); ?></label> |
|
720 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
721 | 721 | </div> |
722 | 722 | </div> |
723 | 723 | |
724 | 724 | <div class="row"> |
725 | 725 | <div class="give-wrap-address-line2"> |
726 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label> |
|
727 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
726 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php _e('Address 2:', 'give'); ?></label> |
|
727 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
728 | 728 | </div> |
729 | 729 | </div> |
730 | 730 | |
731 | 731 | <div class="row"> |
732 | 732 | <div class="give-wrap-address-city"> |
733 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
734 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
733 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
734 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
735 | 735 | </div> |
736 | 736 | </div> |
737 | 737 | |
738 | 738 | <?php |
739 | - $state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false ); |
|
739 | + $state_exists = ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? true : false); |
|
740 | 740 | ?> |
741 | 741 | <div class="row"> |
742 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state"> |
|
743 | - <div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>"> |
|
744 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
742 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-state"> |
|
743 | + <div id="give-order-address-state-wrap" class="<?php echo( ! empty($state_exists) ? 'give-hidden' : ''); ?>"> |
|
744 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
745 | 745 | <?php |
746 | - $states = give_get_states( $address['country'] ); |
|
747 | - if ( ! empty( $states ) ) { |
|
746 | + $states = give_get_states($address['country']); |
|
747 | + if ( ! empty($states)) { |
|
748 | 748 | echo Give()->html->select( |
749 | 749 | array( |
750 | 750 | 'options' => $states, |
@@ -753,23 +753,23 @@ discard block |
||
753 | 753 | 'show_option_all' => false, |
754 | 754 | 'show_option_none' => false, |
755 | 755 | 'chosen' => true, |
756 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
757 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
756 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
757 | + 'data' => array('search-type' => 'no_ajax'), |
|
758 | 758 | ) |
759 | 759 | ); |
760 | 760 | } else { |
761 | 761 | ?> |
762 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
762 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
763 | 763 | <?php |
764 | 764 | } |
765 | 765 | ?> |
766 | 766 | </div> |
767 | 767 | </div> |
768 | 768 | |
769 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip"> |
|
769 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-zip"> |
|
770 | 770 | <div class="give-wrap-address-zip"> |
771 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
772 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
771 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php _e('Zip / Postal Code:', 'give'); ?></label> |
|
772 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
773 | 773 | </div> |
774 | 774 | </div> |
775 | 775 | </div> |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | * |
789 | 789 | * @param int $payment_id Payment id. |
790 | 790 | */ |
791 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
791 | + do_action('give_payment_billing_details', $payment_id); |
|
792 | 792 | ?> |
793 | 793 | |
794 | 794 | </div> |
@@ -804,34 +804,34 @@ discard block |
||
804 | 804 | * |
805 | 805 | * @param int $payment_id Payment id. |
806 | 806 | */ |
807 | - do_action( 'give_view_donation_details_billing_after', $payment_id ); |
|
807 | + do_action('give_view_donation_details_billing_after', $payment_id); |
|
808 | 808 | ?> |
809 | 809 | |
810 | 810 | <div id="give-payment-notes" class="postbox"> |
811 | - <h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3> |
|
811 | + <h3 class="hndle"><?php _e('Donation Notes', 'give'); ?></h3> |
|
812 | 812 | |
813 | 813 | <div class="inside"> |
814 | 814 | <div id="give-payment-notes-inner"> |
815 | 815 | <?php |
816 | - $notes = give_get_payment_notes( $payment_id ); |
|
817 | - if ( ! empty( $notes ) ) { |
|
816 | + $notes = give_get_payment_notes($payment_id); |
|
817 | + if ( ! empty($notes)) { |
|
818 | 818 | $no_notes_display = ' style="display:none;"'; |
819 | - foreach ( $notes as $note ) : |
|
819 | + foreach ($notes as $note) : |
|
820 | 820 | |
821 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
821 | + echo give_get_payment_note_html($note, $payment_id); |
|
822 | 822 | |
823 | 823 | endforeach; |
824 | 824 | } else { |
825 | 825 | $no_notes_display = ''; |
826 | 826 | } |
827 | 827 | |
828 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; |
|
828 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; |
|
829 | 829 | ?> |
830 | 830 | </div> |
831 | 831 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
832 | 832 | |
833 | 833 | <div class="give-clearfix"> |
834 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button> |
|
834 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button> |
|
835 | 835 | </div> |
836 | 836 | |
837 | 837 | </div> |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | * |
848 | 848 | * @param int $payment_id Payment id. |
849 | 849 | */ |
850 | - do_action( 'give_view_donation_details_main_after', $payment_id ); |
|
850 | + do_action('give_view_donation_details_main_after', $payment_id); |
|
851 | 851 | ?> |
852 | 852 | |
853 | 853 | </div> |
@@ -869,11 +869,11 @@ discard block |
||
869 | 869 | * |
870 | 870 | * @param int $payment_id Payment id. |
871 | 871 | */ |
872 | - do_action( 'give_view_donation_details_form_bottom', $payment_id ); |
|
872 | + do_action('give_view_donation_details_form_bottom', $payment_id); |
|
873 | 873 | |
874 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
874 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
875 | 875 | ?> |
876 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
876 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
877 | 877 | <input type="hidden" name="give_action" value="update_payment_details"/> |
878 | 878 | </form> |
879 | 879 | <?php |
@@ -884,6 +884,6 @@ discard block |
||
884 | 884 | * |
885 | 885 | * @param int $payment_id Payment id. |
886 | 886 | */ |
887 | - do_action( 'give_view_donation_details_after', $payment_id ); |
|
887 | + do_action('give_view_donation_details_after', $payment_id); |
|
888 | 888 | ?> |
889 | 889 | </div><!-- /.wrap --> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @since 1.0 |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
39 | - add_action( 'admin_head', array( $this, 'admin_head' ) ); |
|
40 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
38 | + add_action('admin_menu', array($this, 'admin_menus')); |
|
39 | + add_action('admin_head', array($this, 'admin_head')); |
|
40 | + add_action('admin_init', array($this, 'welcome')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -49,45 +49,45 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public function admin_menus() { |
52 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
52 | + list($display_version) = explode('-', GIVE_VERSION); |
|
53 | 53 | |
54 | 54 | // About Page |
55 | 55 | add_dashboard_page( |
56 | 56 | /* translators: %s: Give version */ |
57 | - sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ), |
|
58 | - esc_html__( 'Welcome to Give', 'give' ), |
|
57 | + sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version), |
|
58 | + esc_html__('Welcome to Give', 'give'), |
|
59 | 59 | $this->minimum_capability, |
60 | 60 | 'give-about', |
61 | - array( $this, 'about_screen' ) |
|
61 | + array($this, 'about_screen') |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | // Changelog Page |
65 | 65 | add_dashboard_page( |
66 | - esc_html__( 'Give Changelog', 'give' ), |
|
67 | - esc_html__( 'Give Changelog', 'give' ), |
|
66 | + esc_html__('Give Changelog', 'give'), |
|
67 | + esc_html__('Give Changelog', 'give'), |
|
68 | 68 | $this->minimum_capability, |
69 | 69 | 'give-changelog', |
70 | - array( $this, 'changelog_screen' ) |
|
70 | + array($this, 'changelog_screen') |
|
71 | 71 | ); |
72 | 72 | |
73 | 73 | // Getting Started Page |
74 | 74 | add_dashboard_page( |
75 | 75 | /* translators: %s: Give version */ |
76 | - sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ), |
|
77 | - esc_html__( 'Getting started with Give', 'give' ), |
|
76 | + sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version), |
|
77 | + esc_html__('Getting started with Give', 'give'), |
|
78 | 78 | $this->minimum_capability, |
79 | 79 | 'give-getting-started', |
80 | - array( $this, 'getting_started_screen' ) |
|
80 | + array($this, 'getting_started_screen') |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | // Credits Page |
84 | 84 | add_dashboard_page( |
85 | 85 | /* translators: %s: Give version */ |
86 | - sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ), |
|
87 | - esc_html__( 'The people that build Give', 'give' ), |
|
86 | + sprintf(esc_html__('Give %s - Credits', 'give'), $display_version), |
|
87 | + esc_html__('The people that build Give', 'give'), |
|
88 | 88 | $this->minimum_capability, |
89 | 89 | 'give-credits', |
90 | - array( $this, 'credits_screen' ) |
|
90 | + array($this, 'credits_screen') |
|
91 | 91 | ); |
92 | 92 | } |
93 | 93 | |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function admin_head() { |
102 | 102 | |
103 | - remove_submenu_page( 'index.php', 'give-about' ); |
|
104 | - remove_submenu_page( 'index.php', 'give-changelog' ); |
|
105 | - remove_submenu_page( 'index.php', 'give-getting-started' ); |
|
106 | - remove_submenu_page( 'index.php', 'give-credits' ); |
|
103 | + remove_submenu_page('index.php', 'give-about'); |
|
104 | + remove_submenu_page('index.php', 'give-changelog'); |
|
105 | + remove_submenu_page('index.php', 'give-getting-started'); |
|
106 | + remove_submenu_page('index.php', 'give-credits'); |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | |
@@ -115,24 +115,24 @@ discard block |
||
115 | 115 | * @return void |
116 | 116 | */ |
117 | 117 | public function tabs() { |
118 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about'; |
|
118 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'give-about'; |
|
119 | 119 | ?> |
120 | 120 | <h2 class="nav-tab-wrapper"> |
121 | 121 | <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" |
122 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>"> |
|
123 | - <?php esc_html_e( 'About Give', 'give' ); ?> |
|
122 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>"> |
|
123 | + <?php esc_html_e('About Give', 'give'); ?> |
|
124 | 124 | </a> |
125 | 125 | <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" |
126 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>"> |
|
127 | - <?php esc_html_e( 'Getting Started', 'give' ); ?> |
|
126 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>"> |
|
127 | + <?php esc_html_e('Getting Started', 'give'); ?> |
|
128 | 128 | </a> |
129 | 129 | <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" |
130 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>"> |
|
131 | - <?php esc_html_e( 'Credits', 'give' ); ?> |
|
130 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>"> |
|
131 | + <?php esc_html_e('Credits', 'give'); ?> |
|
132 | 132 | </a> |
133 | 133 | <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" |
134 | - href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>"> |
|
135 | - <?php esc_html_e( 'Add-ons', 'give' ); ?> |
|
134 | + href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>"> |
|
135 | + <?php esc_html_e('Add-ons', 'give'); ?> |
|
136 | 136 | </a> |
137 | 137 | </h2> |
138 | 138 | <?php |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @return void |
147 | 147 | */ |
148 | 148 | public function about_screen() { |
149 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
149 | + list($display_version) = explode('-', GIVE_VERSION); |
|
150 | 150 | ?> |
151 | 151 | <div class="wrap about-wrap"> |
152 | 152 | |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | <p class="about-text"><?php |
156 | 156 | printf( |
157 | 157 | /* translators: %s: http://docs.givewp.com/docs */ |
158 | - __( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ), |
|
159 | - esc_url( 'http://docs.givewp.com/docs' ) |
|
158 | + __('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'), |
|
159 | + esc_url('http://docs.givewp.com/docs') |
|
160 | 160 | ); |
161 | 161 | ?></p> |
162 | 162 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | <div class="give-badge"><?php |
166 | 166 | printf( |
167 | 167 | /* translators: %s: Give version */ |
168 | - esc_html__( 'Version %s', 'give' ), |
|
168 | + esc_html__('Version %s', 'give'), |
|
169 | 169 | $display_version |
170 | 170 | ); |
171 | 171 | ?></div> |
@@ -175,17 +175,17 @@ discard block |
||
175 | 175 | <div class="feature-section clearfix introduction"> |
176 | 176 | |
177 | 177 | <div class="video feature-section-item"> |
178 | - <img src="<?php echo GIVE_PLUGIN_URL . 'assets/dist/images/give-logo-photo-mashup.png' ?>" |
|
179 | - alt="<?php esc_attr_e( 'Give', 'give' ); ?>"> |
|
178 | + <img src="<?php echo GIVE_PLUGIN_URL.'assets/dist/images/give-logo-photo-mashup.png' ?>" |
|
179 | + alt="<?php esc_attr_e('Give', 'give'); ?>"> |
|
180 | 180 | </div> |
181 | 181 | |
182 | 182 | <div class="content feature-section-item last-feature"> |
183 | 183 | |
184 | - <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3> |
|
184 | + <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3> |
|
185 | 185 | |
186 | - <p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p> |
|
186 | + <p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p> |
|
187 | 187 | <a href="https://givewp.com" target="_blank" class="button-secondary"> |
188 | - <?php esc_html_e( 'Learn More', 'give' ); ?> |
|
188 | + <?php esc_html_e('Learn More', 'give'); ?> |
|
189 | 189 | <span class="dashicons dashicons-external"></span> |
190 | 190 | </a> |
191 | 191 | |
@@ -198,25 +198,25 @@ discard block |
||
198 | 198 | |
199 | 199 | <div class="content feature-section-item"> |
200 | 200 | |
201 | - <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3> |
|
201 | + <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3> |
|
202 | 202 | |
203 | - <p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p> |
|
203 | + <p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p> |
|
204 | 204 | |
205 | 205 | <h4>Find Out More:</h4> |
206 | 206 | <ul class="ul-disc"> |
207 | 207 | <li><a href="https://givewp.com/" |
208 | - target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li> |
|
208 | + target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li> |
|
209 | 209 | <li><a href="https://givewp.com/features/" |
210 | - target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li> |
|
210 | + target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li> |
|
211 | 211 | <li><a href="https://givewp.com/documentation/" |
212 | - target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li> |
|
212 | + target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li> |
|
213 | 213 | </ul> |
214 | 214 | |
215 | 215 | </div> |
216 | 216 | |
217 | 217 | <div class="content feature-section-item last-feature"> |
218 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/dist/images/admin/give-form-mockup.png' ?>" |
|
219 | - alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>"> |
|
218 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/dist/images/admin/give-form-mockup.png' ?>" |
|
219 | + alt="<?php esc_attr_e('A Give donation form', 'give'); ?>"> |
|
220 | 220 | </div> |
221 | 221 | |
222 | 222 | </div> |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @return void |
236 | 236 | */ |
237 | 237 | public function changelog_screen() { |
238 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
238 | + list($display_version) = explode('-', GIVE_VERSION); |
|
239 | 239 | ?> |
240 | 240 | <div class="wrap about-wrap"> |
241 | 241 | <h1><?php echo get_admin_page_title(); ?></h1> |
@@ -243,14 +243,14 @@ discard block |
||
243 | 243 | <p class="about-text"><?php |
244 | 244 | printf( |
245 | 245 | /* translators: %s: Give version */ |
246 | - esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ), |
|
246 | + esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'), |
|
247 | 247 | $display_version |
248 | 248 | ); |
249 | 249 | ?></p> |
250 | 250 | <div class="give-badge"><?php |
251 | 251 | printf( |
252 | 252 | /* translators: %s: Give version */ |
253 | - esc_html__( 'Version %s', 'give' ), |
|
253 | + esc_html__('Version %s', 'give'), |
|
254 | 254 | $display_version |
255 | 255 | ); |
256 | 256 | ?></div> |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | <?php $this->tabs(); ?> |
259 | 259 | |
260 | 260 | <div class="changelog"> |
261 | - <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3> |
|
261 | + <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3> |
|
262 | 262 | |
263 | 263 | <div class="feature-section"> |
264 | 264 | <?php echo $this->parse_readme(); ?> |
@@ -266,10 +266,10 @@ discard block |
||
266 | 266 | </div> |
267 | 267 | |
268 | 268 | <div class="return-to-dashboard"> |
269 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( |
|
269 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array( |
|
270 | 270 | 'post_type' => 'give_forms', |
271 | 271 | 'page' => 'give-settings' |
272 | - ), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a> |
|
272 | + ), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a> |
|
273 | 273 | </div> |
274 | 274 | </div> |
275 | 275 | <?php |
@@ -283,36 +283,36 @@ discard block |
||
283 | 283 | * @return void |
284 | 284 | */ |
285 | 285 | public function getting_started_screen() { |
286 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
286 | + list($display_version) = explode('-', GIVE_VERSION); |
|
287 | 287 | ?> |
288 | 288 | <div class="wrap about-wrap get-started"> |
289 | 289 | |
290 | 290 | <?php $this->get_welcome_header() ?> |
291 | 291 | |
292 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
292 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
293 | 293 | |
294 | 294 | <?php give_get_newsletter(); ?> |
295 | 295 | |
296 | 296 | <div class="give-badge"><?php |
297 | 297 | printf( |
298 | 298 | /* translators: %s: Give version */ |
299 | - esc_html__( 'Version %s', 'give' ), |
|
299 | + esc_html__('Version %s', 'give'), |
|
300 | 300 | $display_version |
301 | 301 | ); |
302 | 302 | ?></div> |
303 | 303 | |
304 | 304 | <?php $this->tabs(); ?> |
305 | 305 | |
306 | - <p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p> |
|
306 | + <p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p> |
|
307 | 307 | |
308 | 308 | <div class="feature-section clearfix"> |
309 | 309 | |
310 | 310 | <div class="content feature-section-item"> |
311 | - <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3> |
|
311 | + <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3> |
|
312 | 312 | |
313 | - <p><?php esc_html_e( 'Give is driven by its powerful donation form building features. However, it is much more than just a "donation form." From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p> |
|
313 | + <p><?php esc_html_e('Give is driven by its powerful donation form building features. However, it is much more than just a "donation form." From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p> |
|
314 | 314 | |
315 | - <p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form."', 'give' ); ?></p> |
|
315 | + <p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form."', 'give'); ?></p> |
|
316 | 316 | </div> |
317 | 317 | |
318 | 318 | <div class="content feature-section-item last-feature"> |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | </div> |
330 | 330 | |
331 | 331 | <div class="content feature-section-item last-feature"> |
332 | - <h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3> |
|
332 | + <h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3> |
|
333 | 333 | |
334 | - <p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p> |
|
334 | + <p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p> |
|
335 | 335 | </div> |
336 | 336 | |
337 | 337 | </div> |
@@ -340,11 +340,11 @@ discard block |
||
340 | 340 | <div class="feature-section clearfix"> |
341 | 341 | |
342 | 342 | <div class="content feature-section-item add-content"> |
343 | - <h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3> |
|
343 | + <h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3> |
|
344 | 344 | |
345 | - <p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p> |
|
345 | + <p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p> |
|
346 | 346 | |
347 | - <p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p> |
|
347 | + <p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p> |
|
348 | 348 | </div> |
349 | 349 | |
350 | 350 | <div class="content feature-section-item last-feature"> |
@@ -361,9 +361,9 @@ discard block |
||
361 | 361 | </div> |
362 | 362 | |
363 | 363 | <div class="content feature-section-item last-feature"> |
364 | - <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3> |
|
364 | + <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3> |
|
365 | 365 | |
366 | - <p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p> |
|
366 | + <p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p> |
|
367 | 367 | </div> |
368 | 368 | |
369 | 369 | |
@@ -383,20 +383,20 @@ discard block |
||
383 | 383 | * @return void |
384 | 384 | */ |
385 | 385 | public function credits_screen() { |
386 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
386 | + list($display_version) = explode('-', GIVE_VERSION); |
|
387 | 387 | ?> |
388 | 388 | <div class="wrap about-wrap"> |
389 | 389 | |
390 | 390 | <?php $this->get_welcome_header() ?> |
391 | 391 | |
392 | - <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p> |
|
392 | + <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p> |
|
393 | 393 | |
394 | 394 | <?php give_get_newsletter(); ?> |
395 | 395 | |
396 | 396 | <div class="give-badge"><?php |
397 | 397 | printf( |
398 | 398 | /* translators: %s: Give version */ |
399 | - esc_html__( 'Version %s', 'give' ), |
|
399 | + esc_html__('Version %s', 'give'), |
|
400 | 400 | $display_version |
401 | 401 | ); |
402 | 402 | ?></div> |
@@ -406,8 +406,8 @@ discard block |
||
406 | 406 | <p class="about-description"><?php |
407 | 407 | printf( |
408 | 408 | /* translators: %s: https://github.com/WordImpress/give */ |
409 | - __( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ), |
|
410 | - esc_url( 'https://github.com/WordImpress/give' ) |
|
409 | + __('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'), |
|
410 | + esc_url('https://github.com/WordImpress/give') |
|
411 | 411 | ); |
412 | 412 | ?></p> |
413 | 413 | |
@@ -424,21 +424,21 @@ discard block |
||
424 | 424 | * @return string $readme HTML formatted readme file |
425 | 425 | */ |
426 | 426 | public function parse_readme() { |
427 | - $file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
427 | + $file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
428 | 428 | |
429 | - if ( ! $file ) { |
|
430 | - $readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>'; |
|
429 | + if ( ! $file) { |
|
430 | + $readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>'; |
|
431 | 431 | } else { |
432 | - $readme = file_get_contents( $file ); |
|
433 | - $readme = nl2br( esc_html( $readme ) ); |
|
434 | - $readme = explode( '== Changelog ==', $readme ); |
|
435 | - $readme = end( $readme ); |
|
436 | - |
|
437 | - $readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme ); |
|
438 | - $readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme ); |
|
439 | - $readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme ); |
|
440 | - $readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme ); |
|
441 | - $readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme ); |
|
432 | + $readme = file_get_contents($file); |
|
433 | + $readme = nl2br(esc_html($readme)); |
|
434 | + $readme = explode('== Changelog ==', $readme); |
|
435 | + $readme = end($readme); |
|
436 | + |
|
437 | + $readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme); |
|
438 | + $readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme); |
|
439 | + $readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme); |
|
440 | + $readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme); |
|
441 | + $readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | return $readme; |
@@ -455,24 +455,24 @@ discard block |
||
455 | 455 | public function contributors() { |
456 | 456 | $contributors = $this->get_contributors(); |
457 | 457 | |
458 | - if ( empty( $contributors ) ) { |
|
458 | + if (empty($contributors)) { |
|
459 | 459 | return ''; |
460 | 460 | } |
461 | 461 | |
462 | 462 | $contributor_list = '<ul class="wp-people-group">'; |
463 | 463 | |
464 | - foreach ( $contributors as $contributor ) { |
|
464 | + foreach ($contributors as $contributor) { |
|
465 | 465 | $contributor_list .= '<li class="wp-person">'; |
466 | 466 | $contributor_list .= sprintf( |
467 | 467 | '<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>', |
468 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
469 | - esc_url( $contributor->avatar_url ), |
|
470 | - esc_attr( $contributor->login ) |
|
468 | + esc_url('https://github.com/'.$contributor->login), |
|
469 | + esc_url($contributor->avatar_url), |
|
470 | + esc_attr($contributor->login) |
|
471 | 471 | ); |
472 | 472 | $contributor_list .= sprintf( |
473 | 473 | '<a class="web" target="_blank" href="%1$s">%2$s</a>', |
474 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
475 | - esc_html( $contributor->login ) |
|
474 | + esc_url('https://github.com/'.$contributor->login), |
|
475 | + esc_html($contributor->login) |
|
476 | 476 | ); |
477 | 477 | $contributor_list .= '</li>'; |
478 | 478 | } |
@@ -490,25 +490,25 @@ discard block |
||
490 | 490 | * @return array $contributors List of contributors |
491 | 491 | */ |
492 | 492 | public function get_contributors() { |
493 | - $contributors = Give_Cache::get( 'give_contributors', true ); |
|
493 | + $contributors = Give_Cache::get('give_contributors', true); |
|
494 | 494 | |
495 | - if ( false !== $contributors ) { |
|
495 | + if (false !== $contributors) { |
|
496 | 496 | return $contributors; |
497 | 497 | } |
498 | 498 | |
499 | - $response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) ); |
|
499 | + $response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false)); |
|
500 | 500 | |
501 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
501 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
502 | 502 | return array(); |
503 | 503 | } |
504 | 504 | |
505 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
505 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
506 | 506 | |
507 | - if ( ! is_array( $contributors ) ) { |
|
507 | + if ( ! is_array($contributors)) { |
|
508 | 508 | return array(); |
509 | 509 | } |
510 | 510 | |
511 | - Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true ); |
|
511 | + Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true); |
|
512 | 512 | |
513 | 513 | return $contributors; |
514 | 514 | } |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | */ |
521 | 521 | public function get_welcome_header() { |
522 | 522 | // Badge for welcome page |
523 | - $badge_url = GIVE_PLUGIN_URL . 'assets/dist/images/give-badge.png'; |
|
523 | + $badge_url = GIVE_PLUGIN_URL.'assets/dist/images/give-badge.png'; |
|
524 | 524 | ?> |
525 | 525 | <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1> |
526 | 526 | <?php $this->social_media_elements(); ?> |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php |
614 | 614 | printf( |
615 | 615 | /* translators: %s: Give twitter user @givewp */ |
616 | - esc_html_e( 'Follow %s', 'give' ), |
|
616 | + esc_html_e('Follow %s', 'give'), |
|
617 | 617 | '@givewp' |
618 | 618 | ); |
619 | 619 | ?></a> |
@@ -647,27 +647,27 @@ discard block |
||
647 | 647 | public function welcome() { |
648 | 648 | |
649 | 649 | // Bail if no activation redirect |
650 | - if ( ! Give_Cache::get( '_give_activation_redirect', true ) || wp_doing_ajax() ) { |
|
650 | + if ( ! Give_Cache::get('_give_activation_redirect', true) || wp_doing_ajax()) { |
|
651 | 651 | return; |
652 | 652 | } |
653 | 653 | |
654 | 654 | // Delete the redirect transient |
655 | - Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) ); |
|
655 | + Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect')); |
|
656 | 656 | |
657 | 657 | // Bail if activating from network, or bulk |
658 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
658 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
659 | 659 | return; |
660 | 660 | } |
661 | 661 | |
662 | - $upgrade = get_option( 'give_version_upgraded_from' ); |
|
662 | + $upgrade = get_option('give_version_upgraded_from'); |
|
663 | 663 | |
664 | - if ( ! $upgrade ) { // First time install |
|
665 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
664 | + if ( ! $upgrade) { // First time install |
|
665 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
666 | 666 | exit; |
667 | - } elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings |
|
667 | + } elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings |
|
668 | 668 | |
669 | 669 | } else { // Welcome is NOT disabled in settings |
670 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
670 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
671 | 671 | exit; |
672 | 672 | } |
673 | 673 | } |
@@ -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 | |
@@ -20,19 +20,19 @@ discard block |
||
20 | 20 | * @since 1.8 |
21 | 21 | */ |
22 | 22 | function give_load_wp_editor() { |
23 | - if ( ! isset( $_POST['wp_editor'] ) ) { |
|
23 | + if ( ! isset($_POST['wp_editor'])) { |
|
24 | 24 | die(); |
25 | 25 | } |
26 | 26 | |
27 | - $wp_editor = json_decode( base64_decode( $_POST['wp_editor'] ), true ); |
|
27 | + $wp_editor = json_decode(base64_decode($_POST['wp_editor']), true); |
|
28 | 28 | $wp_editor[2]['textarea_name'] = $_POST['textarea_name']; |
29 | 29 | |
30 | - wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] ); |
|
30 | + wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]); |
|
31 | 31 | |
32 | 32 | die(); |
33 | 33 | } |
34 | 34 | |
35 | -add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' ); |
|
35 | +add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor'); |
|
36 | 36 | |
37 | 37 | |
38 | 38 | /** |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | ); |
53 | 53 | |
54 | 54 | // Get current page. |
55 | - $current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : ''; |
|
55 | + $current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : ''; |
|
56 | 56 | |
57 | 57 | // Bailout. |
58 | 58 | if ( |
59 | - empty( $current_page ) |
|
60 | - || empty( $_GET['_wp_http_referer'] ) |
|
61 | - || ! in_array( $current_page, $give_pages ) |
|
59 | + empty($current_page) |
|
60 | + || empty($_GET['_wp_http_referer']) |
|
61 | + || ! in_array($current_page, $give_pages) |
|
62 | 62 | ) { |
63 | 63 | return false; |
64 | 64 | } |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @since 1.8 |
70 | 70 | */ |
71 | - $redirect = apply_filters( "give_validate_{$current_page}", true ); |
|
71 | + $redirect = apply_filters("give_validate_{$current_page}", true); |
|
72 | 72 | |
73 | - if ( $redirect ) { |
|
73 | + if ($redirect) { |
|
74 | 74 | // Redirect. |
75 | 75 | wp_redirect( |
76 | 76 | remove_query_arg( |
77 | - array( '_wp_http_referer', '_wpnonce' ), |
|
78 | - wp_unslash( $_SERVER['REQUEST_URI'] ) |
|
77 | + array('_wp_http_referer', '_wpnonce'), |
|
78 | + wp_unslash($_SERVER['REQUEST_URI']) |
|
79 | 79 | ) |
80 | 80 | ); |
81 | 81 | exit; |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | -add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' ); |
|
85 | +add_action('admin_init', 'give_redirect_to_clean_url_admin_pages'); |
|
86 | 86 | |
87 | 87 | |
88 | 88 | /** |
@@ -96,25 +96,25 @@ discard block |
||
96 | 96 | */ |
97 | 97 | function give_hide_outdated_php_notice() { |
98 | 98 | |
99 | - if ( ! isset( $_POST['_give_hide_outdated_php_notices_shortly'] ) ) { |
|
99 | + if ( ! isset($_POST['_give_hide_outdated_php_notices_shortly'])) { |
|
100 | 100 | give_die(); |
101 | 101 | } |
102 | 102 | |
103 | 103 | // Transient key name. |
104 | 104 | $transient_key = '_give_hide_outdated_php_notices_shortly'; |
105 | 105 | |
106 | - if ( Give_Cache::get( $transient_key, true ) ) { |
|
106 | + if (Give_Cache::get($transient_key, true)) { |
|
107 | 107 | return; |
108 | 108 | } |
109 | 109 | |
110 | 110 | // Hide notice for 24 hours. |
111 | - Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true ); |
|
111 | + Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true); |
|
112 | 112 | |
113 | 113 | give_die(); |
114 | 114 | |
115 | 115 | } |
116 | 116 | |
117 | -add_action( 'wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice' ); |
|
117 | +add_action('wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice'); |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * Register admin notices. |
@@ -123,27 +123,27 @@ discard block |
||
123 | 123 | */ |
124 | 124 | function _give_register_admin_notices() { |
125 | 125 | // Bailout. |
126 | - if ( ! is_admin() ) { |
|
126 | + if ( ! is_admin()) { |
|
127 | 127 | return; |
128 | 128 | } |
129 | 129 | |
130 | 130 | // Bulk action notices. |
131 | 131 | if ( |
132 | - isset( $_GET['action'] ) && |
|
133 | - ! empty( $_GET['action'] ) |
|
132 | + isset($_GET['action']) && |
|
133 | + ! empty($_GET['action']) |
|
134 | 134 | ) { |
135 | 135 | |
136 | 136 | // Add payment bulk notice. |
137 | 137 | if ( |
138 | - current_user_can( 'edit_give_payments' ) && |
|
139 | - isset( $_GET['payment'] ) && |
|
140 | - ! empty( $_GET['payment'] ) |
|
138 | + current_user_can('edit_give_payments') && |
|
139 | + isset($_GET['payment']) && |
|
140 | + ! empty($_GET['payment']) |
|
141 | 141 | ) { |
142 | - $payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0; |
|
142 | + $payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0; |
|
143 | 143 | |
144 | - switch ( $_GET['action'] ) { |
|
144 | + switch ($_GET['action']) { |
|
145 | 145 | case 'delete': |
146 | - Give()->notices->register_notice( array( |
|
146 | + Give()->notices->register_notice(array( |
|
147 | 147 | 'id' => 'bulk_action_delete', |
148 | 148 | 'type' => 'updated', |
149 | 149 | 'description' => sprintf( |
@@ -155,12 +155,12 @@ discard block |
||
155 | 155 | ), |
156 | 156 | $payment_count ), |
157 | 157 | 'show' => true, |
158 | - ) ); |
|
158 | + )); |
|
159 | 159 | |
160 | 160 | break; |
161 | 161 | |
162 | 162 | case 'resend-receipt': |
163 | - Give()->notices->register_notice( array( |
|
163 | + Give()->notices->register_notice(array( |
|
164 | 164 | 'id' => 'bulk_action_resend_receipt', |
165 | 165 | 'type' => 'updated', |
166 | 166 | 'description' => sprintf( |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $payment_count |
174 | 174 | ), |
175 | 175 | 'show' => true, |
176 | - ) ); |
|
176 | + )); |
|
177 | 177 | break; |
178 | 178 | |
179 | 179 | case 'set-status-publish' : |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | case 'set-status-cancelled' : |
186 | 186 | case 'set-status-abandoned' : |
187 | 187 | case 'set-status-preapproval' : |
188 | - Give()->notices->register_notice( array( |
|
188 | + Give()->notices->register_notice(array( |
|
189 | 189 | 'id' => 'bulk_action_status_change', |
190 | 190 | 'type' => 'updated', |
191 | 191 | 'description' => _n( |
@@ -195,251 +195,251 @@ discard block |
||
195 | 195 | 'give' |
196 | 196 | ), |
197 | 197 | 'show' => true, |
198 | - ) ); |
|
198 | + )); |
|
199 | 199 | break; |
200 | 200 | }// End switch(). |
201 | 201 | }// End if(). |
202 | 202 | }// End if(). |
203 | 203 | |
204 | 204 | // Add give message notices. |
205 | - if ( ! empty( $_GET['give-message'] ) ) { |
|
205 | + if ( ! empty($_GET['give-message'])) { |
|
206 | 206 | // Donation reports errors. |
207 | - if ( current_user_can( 'view_give_reports' ) ) { |
|
208 | - switch ( $_GET['give-message'] ) { |
|
207 | + if (current_user_can('view_give_reports')) { |
|
208 | + switch ($_GET['give-message']) { |
|
209 | 209 | case 'donation_deleted' : |
210 | - Give()->notices->register_notice( array( |
|
210 | + Give()->notices->register_notice(array( |
|
211 | 211 | 'id' => 'give-donation-deleted', |
212 | 212 | 'type' => 'updated', |
213 | - 'description' => __( 'The donation has been deleted.', 'give' ), |
|
213 | + 'description' => __('The donation has been deleted.', 'give'), |
|
214 | 214 | 'show' => true, |
215 | - ) ); |
|
215 | + )); |
|
216 | 216 | break; |
217 | 217 | case 'email_sent' : |
218 | - Give()->notices->register_notice( array( |
|
218 | + Give()->notices->register_notice(array( |
|
219 | 219 | 'id' => 'give-payment-sent', |
220 | 220 | 'type' => 'updated', |
221 | - 'description' => __( 'The donation receipt has been resent.', 'give' ), |
|
221 | + 'description' => __('The donation receipt has been resent.', 'give'), |
|
222 | 222 | 'show' => true, |
223 | - ) ); |
|
223 | + )); |
|
224 | 224 | break; |
225 | 225 | case 'refreshed-reports' : |
226 | - Give()->notices->register_notice( array( |
|
226 | + Give()->notices->register_notice(array( |
|
227 | 227 | 'id' => 'give-refreshed-reports', |
228 | 228 | 'type' => 'updated', |
229 | - 'description' => __( 'The reports cache has been cleared.', 'give' ), |
|
229 | + 'description' => __('The reports cache has been cleared.', 'give'), |
|
230 | 230 | 'show' => true, |
231 | - ) ); |
|
231 | + )); |
|
232 | 232 | break; |
233 | 233 | case 'donation-note-deleted' : |
234 | - Give()->notices->register_notice( array( |
|
234 | + Give()->notices->register_notice(array( |
|
235 | 235 | 'id' => 'give-donation-note-deleted', |
236 | 236 | 'type' => 'updated', |
237 | - 'description' => __( 'The donation note has been deleted.', 'give' ), |
|
237 | + 'description' => __('The donation note has been deleted.', 'give'), |
|
238 | 238 | 'show' => true, |
239 | - ) ); |
|
239 | + )); |
|
240 | 240 | break; |
241 | 241 | } |
242 | 242 | }// End if(). |
243 | 243 | |
244 | 244 | // Give settings notices and errors. |
245 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
246 | - switch ( $_GET['give-message'] ) { |
|
245 | + if (current_user_can('manage_give_settings')) { |
|
246 | + switch ($_GET['give-message']) { |
|
247 | 247 | case 'settings-imported' : |
248 | - Give()->notices->register_notice( array( |
|
248 | + Give()->notices->register_notice(array( |
|
249 | 249 | 'id' => 'give-settings-imported', |
250 | 250 | 'type' => 'updated', |
251 | - 'description' => __( 'The settings have been imported.', 'give' ), |
|
251 | + 'description' => __('The settings have been imported.', 'give'), |
|
252 | 252 | 'show' => true, |
253 | - ) ); |
|
253 | + )); |
|
254 | 254 | break; |
255 | 255 | case 'api-key-generated' : |
256 | - Give()->notices->register_notice( array( |
|
256 | + Give()->notices->register_notice(array( |
|
257 | 257 | 'id' => 'give-api-key-generated', |
258 | 258 | 'type' => 'updated', |
259 | - 'description' => __( 'API keys have been generated.', 'give' ), |
|
259 | + 'description' => __('API keys have been generated.', 'give'), |
|
260 | 260 | 'show' => true, |
261 | - ) ); |
|
261 | + )); |
|
262 | 262 | break; |
263 | 263 | case 'api-key-exists' : |
264 | - Give()->notices->register_notice( array( |
|
264 | + Give()->notices->register_notice(array( |
|
265 | 265 | 'id' => 'give-api-key-exists', |
266 | 266 | 'type' => 'updated', |
267 | - 'description' => __( 'The specified user already has API keys.', 'give' ), |
|
267 | + 'description' => __('The specified user already has API keys.', 'give'), |
|
268 | 268 | 'show' => true, |
269 | - ) ); |
|
269 | + )); |
|
270 | 270 | break; |
271 | 271 | case 'api-key-regenerated' : |
272 | - Give()->notices->register_notice( array( |
|
272 | + Give()->notices->register_notice(array( |
|
273 | 273 | 'id' => 'give-api-key-regenerated', |
274 | 274 | 'type' => 'updated', |
275 | - 'description' => __( 'API keys have been regenerated.', 'give' ), |
|
275 | + 'description' => __('API keys have been regenerated.', 'give'), |
|
276 | 276 | 'show' => true, |
277 | - ) ); |
|
277 | + )); |
|
278 | 278 | break; |
279 | 279 | case 'api-key-revoked' : |
280 | - Give()->notices->register_notice( array( |
|
280 | + Give()->notices->register_notice(array( |
|
281 | 281 | 'id' => 'give-api-key-revoked', |
282 | 282 | 'type' => 'updated', |
283 | - 'description' => __( 'API keys have been revoked.', 'give' ), |
|
283 | + 'description' => __('API keys have been revoked.', 'give'), |
|
284 | 284 | 'show' => true, |
285 | - ) ); |
|
285 | + )); |
|
286 | 286 | break; |
287 | 287 | case 'sent-test-email' : |
288 | - Give()->notices->register_notice( array( |
|
288 | + Give()->notices->register_notice(array( |
|
289 | 289 | 'id' => 'give-sent-test-email', |
290 | 290 | 'type' => 'updated', |
291 | - 'description' => __( 'The test email has been sent.', 'give' ), |
|
291 | + 'description' => __('The test email has been sent.', 'give'), |
|
292 | 292 | 'show' => true, |
293 | - ) ); |
|
293 | + )); |
|
294 | 294 | break; |
295 | 295 | case 'matched-success-failure-page': |
296 | - Give()->notices->register_notice( array( |
|
296 | + Give()->notices->register_notice(array( |
|
297 | 297 | 'id' => 'give-matched-success-failure-page', |
298 | 298 | 'type' => 'updated', |
299 | - 'description' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
299 | + 'description' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
300 | 300 | 'show' => true, |
301 | - ) ); |
|
301 | + )); |
|
302 | 302 | break; |
303 | 303 | }// End switch(). |
304 | 304 | }// End if(). |
305 | 305 | // Payments errors. |
306 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
307 | - switch ( $_GET['give-message'] ) { |
|
306 | + if (current_user_can('edit_give_payments')) { |
|
307 | + switch ($_GET['give-message']) { |
|
308 | 308 | case 'note-added' : |
309 | - Give()->notices->register_notice( array( |
|
309 | + Give()->notices->register_notice(array( |
|
310 | 310 | 'id' => 'give-note-added', |
311 | 311 | 'type' => 'updated', |
312 | - 'description' => __( 'The donation note has been added.', 'give' ), |
|
312 | + 'description' => __('The donation note has been added.', 'give'), |
|
313 | 313 | 'show' => true, |
314 | - ) ); |
|
314 | + )); |
|
315 | 315 | break; |
316 | 316 | case 'payment-updated' : |
317 | - Give()->notices->register_notice( array( |
|
317 | + Give()->notices->register_notice(array( |
|
318 | 318 | 'id' => 'give-payment-updated', |
319 | 319 | 'type' => 'updated', |
320 | - 'description' => __( 'The donation has been updated.', 'give' ), |
|
320 | + 'description' => __('The donation has been updated.', 'give'), |
|
321 | 321 | 'show' => true, |
322 | - ) ); |
|
322 | + )); |
|
323 | 323 | break; |
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
327 | 327 | // Donor Notices. |
328 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
329 | - switch ( $_GET['give-message'] ) { |
|
328 | + if (current_user_can('edit_give_payments')) { |
|
329 | + switch ($_GET['give-message']) { |
|
330 | 330 | case 'donor-deleted' : |
331 | - Give()->notices->register_notice( array( |
|
331 | + Give()->notices->register_notice(array( |
|
332 | 332 | 'id' => 'give-donor-deleted', |
333 | 333 | 'type' => 'updated', |
334 | - 'description' => __( 'The selected donor(s) has been deleted.', 'give' ), |
|
334 | + 'description' => __('The selected donor(s) has been deleted.', 'give'), |
|
335 | 335 | 'show' => true, |
336 | - ) ); |
|
336 | + )); |
|
337 | 337 | break; |
338 | 338 | |
339 | 339 | case 'donor-donations-deleted' : |
340 | - Give()->notices->register_notice( array( |
|
340 | + Give()->notices->register_notice(array( |
|
341 | 341 | 'id' => 'give-donor-donations-deleted', |
342 | 342 | 'type' => 'updated', |
343 | - 'description' => __( 'The selected donor(s) and the associated donation(s) has been deleted.', 'give' ), |
|
343 | + 'description' => __('The selected donor(s) and the associated donation(s) has been deleted.', 'give'), |
|
344 | 344 | 'show' => true, |
345 | - ) ); |
|
345 | + )); |
|
346 | 346 | break; |
347 | 347 | |
348 | 348 | case 'confirm-delete-donor' : |
349 | - Give()->notices->register_notice( array( |
|
349 | + Give()->notices->register_notice(array( |
|
350 | 350 | 'id' => 'give-confirm-delete-donor', |
351 | 351 | 'type' => 'updated', |
352 | - 'description' => __( 'You must confirm to delete the selected donor(s).', 'give' ), |
|
352 | + 'description' => __('You must confirm to delete the selected donor(s).', 'give'), |
|
353 | 353 | 'show' => true, |
354 | - ) ); |
|
354 | + )); |
|
355 | 355 | break; |
356 | 356 | |
357 | 357 | case 'invalid-donor-id' : |
358 | - Give()->notices->register_notice( array( |
|
358 | + Give()->notices->register_notice(array( |
|
359 | 359 | 'id' => 'give-invalid-donor-id', |
360 | 360 | 'type' => 'updated', |
361 | - 'description' => __( 'Invalid Donor ID.', 'give' ), |
|
361 | + 'description' => __('Invalid Donor ID.', 'give'), |
|
362 | 362 | 'show' => true, |
363 | - ) ); |
|
363 | + )); |
|
364 | 364 | break; |
365 | 365 | |
366 | 366 | case 'donor-delete-failed' : |
367 | - Give()->notices->register_notice( array( |
|
367 | + Give()->notices->register_notice(array( |
|
368 | 368 | 'id' => 'give-donor-delete-failed', |
369 | 369 | 'type' => 'error', |
370 | - 'description' => __( 'Unable to delete selected donor(s).', 'give' ), |
|
370 | + 'description' => __('Unable to delete selected donor(s).', 'give'), |
|
371 | 371 | 'show' => true, |
372 | - ) ); |
|
372 | + )); |
|
373 | 373 | break; |
374 | 374 | |
375 | 375 | case 'email-added' : |
376 | - Give()->notices->register_notice( array( |
|
376 | + Give()->notices->register_notice(array( |
|
377 | 377 | 'id' => 'give-donor-email-added', |
378 | 378 | 'type' => 'updated', |
379 | - 'description' => __( 'Donor email added.', 'give' ), |
|
379 | + 'description' => __('Donor email added.', 'give'), |
|
380 | 380 | 'show' => true, |
381 | - ) ); |
|
381 | + )); |
|
382 | 382 | break; |
383 | 383 | |
384 | 384 | case 'email-removed' : |
385 | - Give()->notices->register_notice( array( |
|
385 | + Give()->notices->register_notice(array( |
|
386 | 386 | 'id' => 'give-donor-email-removed', |
387 | 387 | 'type' => 'updated', |
388 | - 'description' => __( 'Donor email removed.', 'give' ), |
|
388 | + 'description' => __('Donor email removed.', 'give'), |
|
389 | 389 | 'show' => true, |
390 | - ) ); |
|
390 | + )); |
|
391 | 391 | break; |
392 | 392 | |
393 | 393 | case 'email-remove-failed' : |
394 | - Give()->notices->register_notice( array( |
|
394 | + Give()->notices->register_notice(array( |
|
395 | 395 | 'id' => 'give-donor-email-remove-failed', |
396 | 396 | 'type' => 'updated', |
397 | - 'description' => __( 'Failed to remove donor email.', 'give' ), |
|
397 | + 'description' => __('Failed to remove donor email.', 'give'), |
|
398 | 398 | 'show' => true, |
399 | - ) ); |
|
399 | + )); |
|
400 | 400 | break; |
401 | 401 | |
402 | 402 | case 'primary-email-updated' : |
403 | - Give()->notices->register_notice( array( |
|
403 | + Give()->notices->register_notice(array( |
|
404 | 404 | 'id' => 'give-donor-primary-email-updated', |
405 | 405 | 'type' => 'updated', |
406 | - 'description' => __( 'Primary email updated for donor.', 'give' ), |
|
406 | + 'description' => __('Primary email updated for donor.', 'give'), |
|
407 | 407 | 'show' => true, |
408 | - ) ); |
|
408 | + )); |
|
409 | 409 | break; |
410 | 410 | |
411 | 411 | case 'primary-email-failed' : |
412 | - Give()->notices->register_notice( array( |
|
412 | + Give()->notices->register_notice(array( |
|
413 | 413 | 'id' => 'give-donor-primary-email-failed', |
414 | 414 | 'type' => 'updated', |
415 | - 'description' => __( 'Failed to set primary email.', 'give' ), |
|
415 | + 'description' => __('Failed to set primary email.', 'give'), |
|
416 | 416 | 'show' => true, |
417 | - ) ); |
|
417 | + )); |
|
418 | 418 | break; |
419 | 419 | |
420 | 420 | case 'reconnect-user' : |
421 | - Give()->notices->register_notice( array( |
|
421 | + Give()->notices->register_notice(array( |
|
422 | 422 | 'id' => 'give-donor-reconnect-user', |
423 | 423 | 'type' => 'updated', |
424 | - 'description' => __( 'User has been successfully connected with Donor.', 'give' ), |
|
424 | + 'description' => __('User has been successfully connected with Donor.', 'give'), |
|
425 | 425 | 'show' => true, |
426 | - ) ); |
|
426 | + )); |
|
427 | 427 | break; |
428 | 428 | |
429 | 429 | case 'profile-updated' : |
430 | - Give()->notices->register_notice( array( |
|
430 | + Give()->notices->register_notice(array( |
|
431 | 431 | 'id' => 'give-donor-profile-updated', |
432 | 432 | 'type' => 'updated', |
433 | - 'description' => __( 'Donor information updated successfully.', 'give' ), |
|
433 | + 'description' => __('Donor information updated successfully.', 'give'), |
|
434 | 434 | 'show' => true, |
435 | - ) ); |
|
435 | + )); |
|
436 | 436 | break; |
437 | 437 | }// End switch(). |
438 | 438 | }// End if(). |
439 | 439 | }// End if(). |
440 | 440 | } |
441 | 441 | |
442 | -add_action( 'admin_notices', '_give_register_admin_notices', - 1 ); |
|
442 | +add_action('admin_notices', '_give_register_admin_notices', - 1); |
|
443 | 443 | |
444 | 444 | |
445 | 445 | /** |
@@ -449,39 +449,38 @@ discard block |
||
449 | 449 | * |
450 | 450 | * @return bool |
451 | 451 | */ |
452 | -function _give_show_test_mode_notice_in_admin_bar( $wp_admin_bar ) { |
|
453 | - $is_test_mode = ! empty( $_POST['test_mode'] ) ? |
|
454 | - give_is_setting_enabled( $_POST['test_mode'] ) : |
|
455 | - give_is_test_mode(); |
|
452 | +function _give_show_test_mode_notice_in_admin_bar($wp_admin_bar) { |
|
453 | + $is_test_mode = ! empty($_POST['test_mode']) ? |
|
454 | + give_is_setting_enabled($_POST['test_mode']) : give_is_test_mode(); |
|
456 | 455 | |
457 | 456 | if ( |
458 | - ! current_user_can( 'view_give_reports' ) || |
|
457 | + ! current_user_can('view_give_reports') || |
|
459 | 458 | ! $is_test_mode |
460 | 459 | ) { |
461 | 460 | return false; |
462 | 461 | } |
463 | 462 | |
464 | 463 | // Add the main site admin menu item. |
465 | - $wp_admin_bar->add_menu( array( |
|
464 | + $wp_admin_bar->add_menu(array( |
|
466 | 465 | 'id' => 'give-test-notice', |
467 | - 'href' => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ), |
|
466 | + 'href' => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'), |
|
468 | 467 | 'parent' => 'top-secondary', |
469 | - 'title' => __( 'Give Test Mode Active', 'give' ), |
|
468 | + 'title' => __('Give Test Mode Active', 'give'), |
|
470 | 469 | 'meta' => array( |
471 | 470 | 'class' => 'give-test-mode-active', |
472 | 471 | ), |
473 | - ) ); |
|
472 | + )); |
|
474 | 473 | |
475 | 474 | return true; |
476 | 475 | } |
477 | 476 | |
478 | -add_action( 'admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1 ); |
|
477 | +add_action('admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1); |
|
479 | 478 | |
480 | 479 | /** |
481 | 480 | * Outputs the Give admin bar CSS. |
482 | 481 | */ |
483 | 482 | function _give_test_mode_notice_admin_bar_css() { |
484 | - if ( ! give_is_test_mode() ) { |
|
483 | + if ( ! give_is_test_mode()) { |
|
485 | 484 | return; |
486 | 485 | } |
487 | 486 | ?> |
@@ -499,7 +498,7 @@ discard block |
||
499 | 498 | <?php |
500 | 499 | } |
501 | 500 | |
502 | -add_action( 'admin_head', '_give_test_mode_notice_admin_bar_css' ); |
|
501 | +add_action('admin_head', '_give_test_mode_notice_admin_bar_css'); |
|
503 | 502 | |
504 | 503 | |
505 | 504 | /** |
@@ -509,12 +508,12 @@ discard block |
||
509 | 508 | */ |
510 | 509 | function give_import_page_link_callback() { |
511 | 510 | ?> |
512 | - <a href="<?php echo esc_url( give_import_page_url() ); ?>" |
|
513 | - class="page-import-action page-title-action"><?php _e( 'Import Donations', 'give' ); ?></a> |
|
511 | + <a href="<?php echo esc_url(give_import_page_url()); ?>" |
|
512 | + class="page-import-action page-title-action"><?php _e('Import Donations', 'give'); ?></a> |
|
514 | 513 | |
515 | 514 | <?php |
516 | 515 | // Check if view donation single page only. |
517 | - if ( ! empty( $_REQUEST['view'] ) && 'view-payment-details' === (string) give_clean( $_REQUEST['view'] ) && 'give-payment-history' === give_clean( $_REQUEST['page'] ) ) { |
|
516 | + if ( ! empty($_REQUEST['view']) && 'view-payment-details' === (string) give_clean($_REQUEST['view']) && 'give-payment-history' === give_clean($_REQUEST['page'])) { |
|
518 | 517 | ?> |
519 | 518 | <style type="text/css"> |
520 | 519 | .wrap #transaction-details-heading { |
@@ -525,7 +524,7 @@ discard block |
||
525 | 524 | } |
526 | 525 | } |
527 | 526 | |
528 | -add_action( 'give_payments_page_top', 'give_import_page_link_callback', 11 ); |
|
527 | +add_action('give_payments_page_top', 'give_import_page_link_callback', 11); |
|
529 | 528 | |
530 | 529 | /** |
531 | 530 | * Load donation import ajax callback |
@@ -541,9 +540,9 @@ discard block |
||
541 | 540 | Give_Cache::get_instance()->disable(); |
542 | 541 | |
543 | 542 | $import_setting = array(); |
544 | - $fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null; |
|
543 | + $fields = isset($_POST['fields']) ? $_POST['fields'] : null; |
|
545 | 544 | |
546 | - parse_str( $fields ); |
|
545 | + parse_str($fields); |
|
547 | 546 | |
548 | 547 | $import_setting['create_user'] = $create_user; |
549 | 548 | $import_setting['mode'] = $mode; |
@@ -553,67 +552,67 @@ discard block |
||
553 | 552 | $import_setting['dry_run'] = $dry_run; |
554 | 553 | |
555 | 554 | // Parent key id. |
556 | - $main_key = maybe_unserialize( $main_key ); |
|
557 | - |
|
558 | - $current = absint( $_REQUEST['current'] ); |
|
559 | - $total_ajax = absint( $_REQUEST['total_ajax'] ); |
|
560 | - $start = absint( $_REQUEST['start'] ); |
|
561 | - $end = absint( $_REQUEST['end'] ); |
|
562 | - $next = absint( $_REQUEST['next'] ); |
|
563 | - $total = absint( $_REQUEST['total'] ); |
|
564 | - $per_page = absint( $_REQUEST['per_page'] ); |
|
565 | - if ( empty( $delimiter ) ) { |
|
555 | + $main_key = maybe_unserialize($main_key); |
|
556 | + |
|
557 | + $current = absint($_REQUEST['current']); |
|
558 | + $total_ajax = absint($_REQUEST['total_ajax']); |
|
559 | + $start = absint($_REQUEST['start']); |
|
560 | + $end = absint($_REQUEST['end']); |
|
561 | + $next = absint($_REQUEST['next']); |
|
562 | + $total = absint($_REQUEST['total']); |
|
563 | + $per_page = absint($_REQUEST['per_page']); |
|
564 | + if (empty($delimiter)) { |
|
566 | 565 | $delimiter = ','; |
567 | 566 | } |
568 | 567 | |
569 | 568 | // Processing done here. |
570 | - $raw_data = give_get_donation_data_from_csv( $csv, $start, $end, $delimiter ); |
|
571 | - $raw_key = maybe_unserialize( $mapto ); |
|
569 | + $raw_data = give_get_donation_data_from_csv($csv, $start, $end, $delimiter); |
|
570 | + $raw_key = maybe_unserialize($mapto); |
|
572 | 571 | $import_setting['raw_key'] = $raw_key; |
573 | 572 | |
574 | - if ( ! empty( $dry_run ) ) { |
|
575 | - $import_setting['csv_raw_data'] = give_get_donation_data_from_csv( $csv, 1, $end, $delimiter ); |
|
573 | + if ( ! empty($dry_run)) { |
|
574 | + $import_setting['csv_raw_data'] = give_get_donation_data_from_csv($csv, 1, $end, $delimiter); |
|
576 | 575 | |
577 | - $import_setting['donors_list'] = Give()->donors->get_donors( array( |
|
578 | - 'number' => - 1, |
|
579 | - 'fields' => array( 'id', 'user_id', 'email' ), |
|
580 | - ) ); |
|
576 | + $import_setting['donors_list'] = Give()->donors->get_donors(array( |
|
577 | + 'number' => -1, |
|
578 | + 'fields' => array('id', 'user_id', 'email'), |
|
579 | + )); |
|
581 | 580 | } |
582 | 581 | |
583 | 582 | // Prevent normal emails. |
584 | - remove_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 ); |
|
585 | - remove_action( 'give_insert_user', 'give_new_user_notification', 10 ); |
|
586 | - remove_action( 'give_insert_payment', 'give_payment_save_page_data' ); |
|
583 | + remove_action('give_complete_donation', 'give_trigger_donation_receipt', 999); |
|
584 | + remove_action('give_insert_user', 'give_new_user_notification', 10); |
|
585 | + remove_action('give_insert_payment', 'give_payment_save_page_data'); |
|
587 | 586 | |
588 | 587 | $current_key = $start; |
589 | - foreach ( $raw_data as $row_data ) { |
|
588 | + foreach ($raw_data as $row_data) { |
|
590 | 589 | $import_setting['donation_key'] = $current_key; |
591 | - give_save_import_donation_to_db( $raw_key, $row_data, $main_key, $import_setting ); |
|
592 | - $current_key ++; |
|
590 | + give_save_import_donation_to_db($raw_key, $row_data, $main_key, $import_setting); |
|
591 | + $current_key++; |
|
593 | 592 | } |
594 | 593 | |
595 | 594 | // Check if function exists or not. |
596 | - if ( function_exists( 'give_payment_save_page_data' ) ) { |
|
597 | - add_action( 'give_insert_payment', 'give_payment_save_page_data' ); |
|
595 | + if (function_exists('give_payment_save_page_data')) { |
|
596 | + add_action('give_insert_payment', 'give_payment_save_page_data'); |
|
598 | 597 | } |
599 | - add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 ); |
|
600 | - add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 ); |
|
598 | + add_action('give_insert_user', 'give_new_user_notification', 10, 2); |
|
599 | + add_action('give_complete_donation', 'give_trigger_donation_receipt', 999); |
|
601 | 600 | |
602 | - if ( $next == false ) { |
|
601 | + if ($next == false) { |
|
603 | 602 | $json_data = array( |
604 | 603 | 'success' => true, |
605 | - 'message' => __( 'All donation uploaded successfully!', 'give' ), |
|
604 | + 'message' => __('All donation uploaded successfully!', 'give'), |
|
606 | 605 | ); |
607 | 606 | } else { |
608 | 607 | $index_start = $start; |
609 | 608 | $index_end = $end; |
610 | 609 | $last = false; |
611 | 610 | $next = true; |
612 | - if ( $next ) { |
|
611 | + if ($next) { |
|
613 | 612 | $index_start = $index_start + $per_page; |
614 | - $index_end = $per_page + ( $index_start - 1 ); |
|
613 | + $index_end = $per_page + ($index_start - 1); |
|
615 | 614 | } |
616 | - if ( $index_end >= $total ) { |
|
615 | + if ($index_end >= $total) { |
|
617 | 616 | $index_end = $total; |
618 | 617 | $last = true; |
619 | 618 | } |
@@ -627,31 +626,31 @@ discard block |
||
627 | 626 | ); |
628 | 627 | } |
629 | 628 | |
630 | - $url = give_import_page_url( array( |
|
629 | + $url = give_import_page_url(array( |
|
631 | 630 | 'step' => '4', |
632 | 631 | 'importer-type' => 'import_donations', |
633 | 632 | 'csv' => $csv, |
634 | 633 | 'total' => $total, |
635 | 634 | 'delete_csv' => $import_setting['delete_csv'], |
636 | - 'success' => ( isset( $json_data['success'] ) ? $json_data['success'] : '' ), |
|
635 | + 'success' => (isset($json_data['success']) ? $json_data['success'] : ''), |
|
637 | 636 | 'dry_run' => $dry_run, |
638 | - ) ); |
|
637 | + )); |
|
639 | 638 | $json_data['url'] = $url; |
640 | 639 | |
641 | - $current ++; |
|
640 | + $current++; |
|
642 | 641 | $json_data['current'] = $current; |
643 | 642 | |
644 | - $percentage = ( 100 / ( $total_ajax + 1 ) ) * $current; |
|
643 | + $percentage = (100 / ($total_ajax + 1)) * $current; |
|
645 | 644 | $json_data['percentage'] = $percentage; |
646 | 645 | |
647 | 646 | // Enable Give cache |
648 | 647 | Give_Cache::get_instance()->enable(); |
649 | 648 | |
650 | - $json_data = apply_filters( 'give_import_ajax_responces', $json_data, $fields ); |
|
651 | - wp_die( json_encode( $json_data ) ); |
|
649 | + $json_data = apply_filters('give_import_ajax_responces', $json_data, $fields); |
|
650 | + wp_die(json_encode($json_data)); |
|
652 | 651 | } |
653 | 652 | |
654 | -add_action( 'wp_ajax_give_donation_import', 'give_donation_import_callback' ); |
|
653 | +add_action('wp_ajax_give_donation_import', 'give_donation_import_callback'); |
|
655 | 654 | |
656 | 655 | /** |
657 | 656 | * Load core settings import ajax callback |
@@ -663,8 +662,8 @@ discard block |
||
663 | 662 | */ |
664 | 663 | |
665 | 664 | function give_core_settings_import_callback() { |
666 | - $fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null; |
|
667 | - parse_str( $fields, $fields ); |
|
665 | + $fields = isset($_POST['fields']) ? $_POST['fields'] : null; |
|
666 | + parse_str($fields, $fields); |
|
668 | 667 | |
669 | 668 | $json_data['success'] = false; |
670 | 669 | |
@@ -679,22 +678,22 @@ discard block |
||
679 | 678 | * |
680 | 679 | * @return array $fields |
681 | 680 | */ |
682 | - $fields = (array) apply_filters( 'give_import_core_settings_fields', $fields ); |
|
681 | + $fields = (array) apply_filters('give_import_core_settings_fields', $fields); |
|
683 | 682 | |
684 | - $file_name = ( ! empty( $fields['file_name'] ) ? give_clean( $fields['file_name'] ) : false ); |
|
683 | + $file_name = ( ! empty($fields['file_name']) ? give_clean($fields['file_name']) : false); |
|
685 | 684 | |
686 | - if ( ! empty( $file_name ) ) { |
|
687 | - $type = ( ! empty( $fields['type'] ) ? give_clean( $fields['type'] ) : 'merge' ); |
|
685 | + if ( ! empty($file_name)) { |
|
686 | + $type = ( ! empty($fields['type']) ? give_clean($fields['type']) : 'merge'); |
|
688 | 687 | |
689 | 688 | // Get the json data from the file and then alter it in array format |
690 | - $json_string = give_get_core_settings_json( $file_name ); |
|
691 | - $json_to_array = json_decode( $json_string, true ); |
|
689 | + $json_string = give_get_core_settings_json($file_name); |
|
690 | + $json_to_array = json_decode($json_string, true); |
|
692 | 691 | |
693 | 692 | // get the current settign from the options table. |
694 | - $host_give_options = get_option( 'give_settings', array() ); |
|
693 | + $host_give_options = get_option('give_settings', array()); |
|
695 | 694 | |
696 | 695 | // Save old settins for backup. |
697 | - update_option( 'give_settings_old', $host_give_options ); |
|
696 | + update_option('give_settings_old', $host_give_options); |
|
698 | 697 | |
699 | 698 | /** |
700 | 699 | * Filter to Modify Core Settings that are being going to get import in options table as give settings. |
@@ -710,9 +709,9 @@ discard block |
||
710 | 709 | * |
711 | 710 | * @return array $json_to_array Setting that are being going to get imported |
712 | 711 | */ |
713 | - $json_to_array = (array) apply_filters( 'give_import_core_settings_data', $json_to_array, $type, $host_give_options, $fields ); |
|
712 | + $json_to_array = (array) apply_filters('give_import_core_settings_data', $json_to_array, $type, $host_give_options, $fields); |
|
714 | 713 | |
715 | - update_option( 'give_settings', $json_to_array ); |
|
714 | + update_option('give_settings', $json_to_array); |
|
716 | 715 | |
717 | 716 | $json_data['success'] = true; |
718 | 717 | } |
@@ -728,16 +727,16 @@ discard block |
||
728 | 727 | * |
729 | 728 | * @return array $url |
730 | 729 | */ |
731 | - $json_data['url'] = give_import_page_url( (array) apply_filters( 'give_import_core_settings_success_url', array( |
|
732 | - 'step' => ( empty( $json_data['success'] ) ? '1' : '3' ), |
|
730 | + $json_data['url'] = give_import_page_url((array) apply_filters('give_import_core_settings_success_url', array( |
|
731 | + 'step' => (empty($json_data['success']) ? '1' : '3'), |
|
733 | 732 | 'importer-type' => 'import_core_setting', |
734 | - 'success' => ( empty( $json_data['success'] ) ? '0' : '1' ), |
|
735 | - ) ) ); |
|
733 | + 'success' => (empty($json_data['success']) ? '0' : '1'), |
|
734 | + ))); |
|
736 | 735 | |
737 | - wp_send_json( $json_data ); |
|
736 | + wp_send_json($json_data); |
|
738 | 737 | } |
739 | 738 | |
740 | -add_action( 'wp_ajax_give_core_settings_import', 'give_core_settings_import_callback' ); |
|
739 | +add_action('wp_ajax_give_core_settings_import', 'give_core_settings_import_callback'); |
|
741 | 740 | |
742 | 741 | /** |
743 | 742 | * Initializes blank slate content if a list table is empty. |
@@ -749,7 +748,7 @@ discard block |
||
749 | 748 | $blank_slate->init(); |
750 | 749 | } |
751 | 750 | |
752 | -add_action( 'current_screen', 'give_blank_slate' ); |
|
751 | +add_action('current_screen', 'give_blank_slate'); |
|
753 | 752 | |
754 | 753 | /** |
755 | 754 | * Validate Fields of User Profile |
@@ -762,24 +761,24 @@ discard block |
||
762 | 761 | * |
763 | 762 | * @return mixed |
764 | 763 | */ |
765 | -function give_validate_user_profile( $errors, $update, $user ) { |
|
764 | +function give_validate_user_profile($errors, $update, $user) { |
|
766 | 765 | |
767 | - if ( ! empty( $_POST['action'] ) && ( 'adduser' === $_POST['action'] || 'createuser' === $_POST['action'] ) ) { |
|
766 | + if ( ! empty($_POST['action']) && ('adduser' === $_POST['action'] || 'createuser' === $_POST['action'])) { |
|
768 | 767 | return; |
769 | 768 | } |
770 | 769 | |
771 | - if ( ! empty( $user->ID ) ) { |
|
772 | - $donor = Give()->donors->get_donor_by( 'user_id', $user->ID ); |
|
770 | + if ( ! empty($user->ID)) { |
|
771 | + $donor = Give()->donors->get_donor_by('user_id', $user->ID); |
|
773 | 772 | |
774 | - if ( $donor ) { |
|
773 | + if ($donor) { |
|
775 | 774 | // If Donor is attached with User, then validate first name. |
776 | - if ( empty( $_POST['first_name'] ) ) { |
|
775 | + if (empty($_POST['first_name'])) { |
|
777 | 776 | $errors->add( |
778 | 777 | 'empty_first_name', |
779 | 778 | sprintf( |
780 | 779 | '<strong>%1$s:</strong> %2$s', |
781 | - __( 'ERROR', 'give' ), |
|
782 | - __( 'Please enter your first name.', 'give' ) |
|
780 | + __('ERROR', 'give'), |
|
781 | + __('Please enter your first name.', 'give') |
|
783 | 782 | ) |
784 | 783 | ); |
785 | 784 | } |
@@ -788,7 +787,7 @@ discard block |
||
788 | 787 | |
789 | 788 | } |
790 | 789 | |
791 | -add_action( 'user_profile_update_errors', 'give_validate_user_profile', 10, 3 ); |
|
790 | +add_action('user_profile_update_errors', 'give_validate_user_profile', 10, 3); |
|
792 | 791 | |
793 | 792 | /** |
794 | 793 | * Show Donor Information on User Profile Page. |
@@ -797,19 +796,19 @@ discard block |
||
797 | 796 | * |
798 | 797 | * @since 2.0 |
799 | 798 | */ |
800 | -function give_donor_information_profile_fields( $user ) { |
|
801 | - $donor = Give()->donors->get_donor_by( 'user_id', $user->ID ); |
|
799 | +function give_donor_information_profile_fields($user) { |
|
800 | + $donor = Give()->donors->get_donor_by('user_id', $user->ID); |
|
802 | 801 | |
803 | 802 | // Display Donor Information, only if donor is attached with User. |
804 | - if ( ! empty( $donor->user_id ) ) { |
|
803 | + if ( ! empty($donor->user_id)) { |
|
805 | 804 | ?> |
806 | 805 | <table class="form-table"> |
807 | 806 | <tbody> |
808 | 807 | <tr> |
809 | - <th scope="row"><?php _e( 'Donor', 'give' ); ?></th> |
|
808 | + <th scope="row"><?php _e('Donor', 'give'); ?></th> |
|
810 | 809 | <td> |
811 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>"> |
|
812 | - <?php _e( 'View Donor Information', 'give' ); ?> |
|
810 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>"> |
|
811 | + <?php _e('View Donor Information', 'give'); ?> |
|
813 | 812 | </a> |
814 | 813 | </td> |
815 | 814 | </tr> |
@@ -819,7 +818,7 @@ discard block |
||
819 | 818 | } |
820 | 819 | } |
821 | 820 | |
822 | -add_action( 'personal_options', 'give_donor_information_profile_fields' ); |
|
821 | +add_action('personal_options', 'give_donor_information_profile_fields'); |
|
823 | 822 | /** |
824 | 823 | * Get Array of WP User Roles. |
825 | 824 | * |
@@ -831,8 +830,8 @@ discard block |
||
831 | 830 | $user_roles = array(); |
832 | 831 | |
833 | 832 | // Loop through User Roles. |
834 | - foreach ( get_editable_roles() as $role_name => $role_info ) : |
|
835 | - $user_roles[ $role_name ] = $role_info['name']; |
|
833 | + foreach (get_editable_roles() as $role_name => $role_info) : |
|
834 | + $user_roles[$role_name] = $role_info['name']; |
|
836 | 835 | endforeach; |
837 | 836 | |
838 | 837 | return $user_roles; |
@@ -849,48 +848,46 @@ discard block |
||
849 | 848 | function __give_ajax_donor_manage_addresses() { |
850 | 849 | // Bailout. |
851 | 850 | if ( |
852 | - empty( $_POST['form'] ) || |
|
853 | - empty( $_POST['donorID'] ) |
|
851 | + empty($_POST['form']) || |
|
852 | + empty($_POST['donorID']) |
|
854 | 853 | ) { |
855 | - wp_send_json_error( array( |
|
854 | + wp_send_json_error(array( |
|
856 | 855 | 'error' => 1, |
857 | - ) ); |
|
856 | + )); |
|
858 | 857 | } |
859 | 858 | |
860 | - $post = give_clean( wp_parse_args( $_POST ) ); |
|
861 | - $donorID = absint( $post['donorID'] ); |
|
862 | - $form_data = give_clean( wp_parse_args( $post['form'] ) ); |
|
863 | - $is_multi_address_type = ( 'billing' === $form_data['address-id'] || false !== strpos( $form_data['address-id'], '_' ) ); |
|
864 | - $address_type = false !== strpos( $form_data['address-id'], '_' ) ? |
|
865 | - array_shift( explode( '_', $form_data['address-id'] ) ) : |
|
866 | - $form_data['address-id']; |
|
867 | - $address_id = false !== strpos( $form_data['address-id'], '_' ) ? |
|
868 | - array_pop( explode( '_', $form_data['address-id'] ) ) : |
|
869 | - null; |
|
859 | + $post = give_clean(wp_parse_args($_POST)); |
|
860 | + $donorID = absint($post['donorID']); |
|
861 | + $form_data = give_clean(wp_parse_args($post['form'])); |
|
862 | + $is_multi_address_type = ('billing' === $form_data['address-id'] || false !== strpos($form_data['address-id'], '_')); |
|
863 | + $address_type = false !== strpos($form_data['address-id'], '_') ? |
|
864 | + array_shift(explode('_', $form_data['address-id'])) : $form_data['address-id']; |
|
865 | + $address_id = false !== strpos($form_data['address-id'], '_') ? |
|
866 | + array_pop(explode('_', $form_data['address-id'])) : null; |
|
870 | 867 | $response_data = array( |
871 | 868 | 'action' => $form_data['address-action'], |
872 | 869 | 'id' => $form_data['address-id'], |
873 | 870 | ); |
874 | 871 | |
875 | 872 | // Security check. |
876 | - if ( ! wp_verify_nonce( $form_data['_wpnonce'], 'give-manage-donor-addresses' ) ) { |
|
877 | - wp_send_json_error( array( |
|
873 | + if ( ! wp_verify_nonce($form_data['_wpnonce'], 'give-manage-donor-addresses')) { |
|
874 | + wp_send_json_error(array( |
|
878 | 875 | 'error' => 1, |
879 | 876 | 'error_msg' => wp_sprintf( |
880 | 877 | '<div class="notice notice-error"><p>%s</p></div>', |
881 | - __( 'Error: Security issue.', 'give' ) |
|
878 | + __('Error: Security issue.', 'give') |
|
882 | 879 | ), |
883 | 880 | ) |
884 | 881 | ); |
885 | 882 | } |
886 | 883 | |
887 | - $donor = new Give_Donor( $donorID ); |
|
884 | + $donor = new Give_Donor($donorID); |
|
888 | 885 | |
889 | 886 | // Verify donor. |
890 | - if ( ! $donor->id ) { |
|
891 | - wp_send_json_error( array( |
|
887 | + if ( ! $donor->id) { |
|
888 | + wp_send_json_error(array( |
|
892 | 889 | 'error' => 3, |
893 | - ) ); |
|
890 | + )); |
|
894 | 891 | } |
895 | 892 | |
896 | 893 | // Unset all data except address. |
@@ -901,59 +898,57 @@ discard block |
||
901 | 898 | ); |
902 | 899 | |
903 | 900 | // Process action. |
904 | - switch ( $response_data['action'] ) { |
|
901 | + switch ($response_data['action']) { |
|
905 | 902 | |
906 | 903 | case 'add': |
907 | - if ( ! $donor->add_address( "{$address_type}[]", $form_data ) ) { |
|
908 | - wp_send_json_error( array( |
|
904 | + if ( ! $donor->add_address("{$address_type}[]", $form_data)) { |
|
905 | + wp_send_json_error(array( |
|
909 | 906 | 'error' => 1, |
910 | 907 | 'error_msg' => wp_sprintf( |
911 | 908 | '<div class="notice notice-error"><p>%s</p></div>', |
912 | - __( 'Error: Unable to save the address. Please check if address already exist.', 'give' ) |
|
909 | + __('Error: Unable to save the address. Please check if address already exist.', 'give') |
|
913 | 910 | ), |
914 | 911 | ) |
915 | 912 | ); |
916 | 913 | } |
917 | 914 | |
918 | - $total_addresses = count( $donor->address[ $address_type ] ); |
|
915 | + $total_addresses = count($donor->address[$address_type]); |
|
919 | 916 | |
920 | 917 | $address_index = $is_multi_address_type ? |
921 | - $total_addresses - 1 : |
|
922 | - $address_type; |
|
918 | + $total_addresses - 1 : $address_type; |
|
923 | 919 | |
924 | - $array_keys = array_keys( $donor->address[ $address_type ] ); |
|
920 | + $array_keys = array_keys($donor->address[$address_type]); |
|
925 | 921 | |
926 | 922 | $address_id = $is_multi_address_type ? |
927 | - end( $array_keys ) : |
|
928 | - $address_type; |
|
923 | + end($array_keys) : $address_type; |
|
929 | 924 | |
930 | 925 | $response_data['address_html'] = __give_get_format_address( |
931 | - end( $donor->address['billing'] ), |
|
926 | + end($donor->address['billing']), |
|
932 | 927 | array( |
933 | 928 | // We can add only billing address from donor screen. |
934 | 929 | 'type' => 'billing', |
935 | 930 | 'id' => $address_id, |
936 | - 'index' => ++ $address_index, |
|
931 | + 'index' => ++$address_index, |
|
937 | 932 | ) |
938 | 933 | ); |
939 | - $response_data['success_msg'] = wp_sprintf( |
|
934 | + $response_data['success_msg'] = wp_sprintf( |
|
940 | 935 | '<div class="notice updated"><p>%s</p></div>', |
941 | - __( 'Successfully added a new address to the donor.', 'give' ) |
|
936 | + __('Successfully added a new address to the donor.', 'give') |
|
942 | 937 | ); |
943 | 938 | |
944 | - if ( $is_multi_address_type ) { |
|
939 | + if ($is_multi_address_type) { |
|
945 | 940 | $response_data['id'] = "{$response_data['id']}_{$address_index}"; |
946 | 941 | } |
947 | 942 | |
948 | 943 | break; |
949 | 944 | |
950 | 945 | case 'remove': |
951 | - if ( ! $donor->remove_address( $response_data['id'] ) ) { |
|
952 | - wp_send_json_error( array( |
|
946 | + if ( ! $donor->remove_address($response_data['id'])) { |
|
947 | + wp_send_json_error(array( |
|
953 | 948 | 'error' => 2, |
954 | 949 | 'error_msg' => wp_sprintf( |
955 | 950 | '<div class="notice notice-error"><p>%s</p></div>', |
956 | - __( 'Error: Unable to delete address.', 'give' ) |
|
951 | + __('Error: Unable to delete address.', 'give') |
|
957 | 952 | ), |
958 | 953 | ) |
959 | 954 | ); |
@@ -961,18 +956,18 @@ discard block |
||
961 | 956 | |
962 | 957 | $response_data['success_msg'] = wp_sprintf( |
963 | 958 | '<div class="notice updated"><p>%s</p></div>', |
964 | - __( 'Successfully removed a address of donor.', 'give' ) |
|
959 | + __('Successfully removed a address of donor.', 'give') |
|
965 | 960 | ); |
966 | 961 | |
967 | 962 | break; |
968 | 963 | |
969 | 964 | case 'update': |
970 | - if ( ! $donor->update_address( $response_data['id'], $form_data ) ) { |
|
971 | - wp_send_json_error( array( |
|
965 | + if ( ! $donor->update_address($response_data['id'], $form_data)) { |
|
966 | + wp_send_json_error(array( |
|
972 | 967 | 'error' => 3, |
973 | 968 | 'error_msg' => wp_sprintf( |
974 | 969 | '<div class="notice notice-error"><p>%s</p></div>', |
975 | - __( 'Error: Unable to update address. Please check if address already exist.', 'give' ) |
|
970 | + __('Error: Unable to update address. Please check if address already exist.', 'give') |
|
976 | 971 | ), |
977 | 972 | ) |
978 | 973 | ); |
@@ -980,26 +975,25 @@ discard block |
||
980 | 975 | |
981 | 976 | $response_data['address_html'] = __give_get_format_address( |
982 | 977 | $is_multi_address_type ? |
983 | - $donor->address[ $address_type ][ $address_id ] : |
|
984 | - $donor->address[ $address_type ], |
|
978 | + $donor->address[$address_type][$address_id] : $donor->address[$address_type], |
|
985 | 979 | array( |
986 | 980 | 'type' => $address_type, |
987 | 981 | 'id' => $address_id, |
988 | 982 | 'index' => $address_id, |
989 | 983 | ) |
990 | 984 | ); |
991 | - $response_data['success_msg'] = wp_sprintf( |
|
985 | + $response_data['success_msg'] = wp_sprintf( |
|
992 | 986 | '<div class="notice updated"><p>%s</p></div>', |
993 | - __( 'Successfully updated a address of donor', 'give' ) |
|
987 | + __('Successfully updated a address of donor', 'give') |
|
994 | 988 | ); |
995 | 989 | |
996 | 990 | break; |
997 | 991 | }// End switch(). |
998 | 992 | |
999 | - wp_send_json_success( $response_data ); |
|
993 | + wp_send_json_success($response_data); |
|
1000 | 994 | } |
1001 | 995 | |
1002 | -add_action( 'wp_ajax_donor_manage_addresses', '__give_ajax_donor_manage_addresses' ); |
|
996 | +add_action('wp_ajax_donor_manage_addresses', '__give_ajax_donor_manage_addresses'); |
|
1003 | 997 | |
1004 | 998 | /** |
1005 | 999 | * Admin donor billing address label |
@@ -1010,13 +1004,13 @@ discard block |
||
1010 | 1004 | * |
1011 | 1005 | * @return string |
1012 | 1006 | */ |
1013 | -function __give_donor_billing_address_label( $address_label ) { |
|
1014 | - $address_label = __( 'Billing Address', 'give' ); |
|
1007 | +function __give_donor_billing_address_label($address_label) { |
|
1008 | + $address_label = __('Billing Address', 'give'); |
|
1015 | 1009 | |
1016 | 1010 | return $address_label; |
1017 | 1011 | } |
1018 | 1012 | |
1019 | -add_action( 'give_donor_billing_address_label', '__give_donor_billing_address_label' ); |
|
1013 | +add_action('give_donor_billing_address_label', '__give_donor_billing_address_label'); |
|
1020 | 1014 | |
1021 | 1015 | /** |
1022 | 1016 | * Admin donor personal address label |
@@ -1027,13 +1021,13 @@ discard block |
||
1027 | 1021 | * |
1028 | 1022 | * @return string |
1029 | 1023 | */ |
1030 | -function __give_donor_personal_address_label( $address_label ) { |
|
1031 | - $address_label = __( 'Personal Address', 'give' ); |
|
1024 | +function __give_donor_personal_address_label($address_label) { |
|
1025 | + $address_label = __('Personal Address', 'give'); |
|
1032 | 1026 | |
1033 | 1027 | return $address_label; |
1034 | 1028 | } |
1035 | 1029 | |
1036 | -add_action( 'give_donor_personal_address_label', '__give_donor_personal_address_label' ); |
|
1030 | +add_action('give_donor_personal_address_label', '__give_donor_personal_address_label'); |
|
1037 | 1031 | |
1038 | 1032 | /** |
1039 | 1033 | * Update Donor Information when User Profile is updated from admin. |
@@ -1046,34 +1040,34 @@ discard block |
||
1046 | 1040 | * |
1047 | 1041 | * @return bool |
1048 | 1042 | */ |
1049 | -function give_update_donor_name_on_user_update( $user_id = 0 ) { |
|
1043 | +function give_update_donor_name_on_user_update($user_id = 0) { |
|
1050 | 1044 | |
1051 | - if ( current_user_can( 'edit_user', $user_id ) ) { |
|
1045 | + if (current_user_can('edit_user', $user_id)) { |
|
1052 | 1046 | |
1053 | - $donor = new Give_Donor( $user_id, true ); |
|
1047 | + $donor = new Give_Donor($user_id, true); |
|
1054 | 1048 | |
1055 | 1049 | // Bailout, if donor doesn't exists. |
1056 | - if ( ! $donor ) { |
|
1050 | + if ( ! $donor) { |
|
1057 | 1051 | return false; |
1058 | 1052 | } |
1059 | 1053 | |
1060 | 1054 | // Get User First name and Last name. |
1061 | - $first_name = ( $_POST['first_name'] ) ? give_clean( $_POST['first_name'] ) : get_user_meta( $user_id, 'first_name', true ); |
|
1062 | - $last_name = ( $_POST['last_name'] ) ? give_clean( $_POST['last_name'] ) : get_user_meta( $user_id, 'last_name', true ); |
|
1063 | - $full_name = strip_tags( wp_unslash( trim( "{$first_name} {$last_name}" ) ) ); |
|
1055 | + $first_name = ($_POST['first_name']) ? give_clean($_POST['first_name']) : get_user_meta($user_id, 'first_name', true); |
|
1056 | + $last_name = ($_POST['last_name']) ? give_clean($_POST['last_name']) : get_user_meta($user_id, 'last_name', true); |
|
1057 | + $full_name = strip_tags(wp_unslash(trim("{$first_name} {$last_name}"))); |
|
1064 | 1058 | |
1065 | 1059 | // Assign User First name and Last name to Donor. |
1066 | - Give()->donors->update( $donor->id, array( |
|
1060 | + Give()->donors->update($donor->id, array( |
|
1067 | 1061 | 'name' => $full_name, |
1068 | - ) ); |
|
1069 | - Give()->donor_meta->update_meta( $donor->id, '_give_donor_first_name', $first_name ); |
|
1070 | - Give()->donor_meta->update_meta( $donor->id, '_give_donor_last_name', $last_name ); |
|
1062 | + )); |
|
1063 | + Give()->donor_meta->update_meta($donor->id, '_give_donor_first_name', $first_name); |
|
1064 | + Give()->donor_meta->update_meta($donor->id, '_give_donor_last_name', $last_name); |
|
1071 | 1065 | |
1072 | 1066 | } |
1073 | 1067 | } |
1074 | 1068 | |
1075 | -add_action( 'edit_user_profile_update', 'give_update_donor_name_on_user_update', 10 ); |
|
1076 | -add_action( 'personal_options_update', 'give_update_donor_name_on_user_update', 10 ); |
|
1069 | +add_action('edit_user_profile_update', 'give_update_donor_name_on_user_update', 10); |
|
1070 | +add_action('personal_options_update', 'give_update_donor_name_on_user_update', 10); |
|
1077 | 1071 | |
1078 | 1072 | |
1079 | 1073 | /** |
@@ -1088,31 +1082,31 @@ discard block |
||
1088 | 1082 | * |
1089 | 1083 | * @return bool |
1090 | 1084 | */ |
1091 | -function give_update_donor_email_on_user_update( $user_id = 0, $old_user_data = false ) { |
|
1085 | +function give_update_donor_email_on_user_update($user_id = 0, $old_user_data = false) { |
|
1092 | 1086 | |
1093 | - $donor = new Give_Donor( $user_id, true ); |
|
1087 | + $donor = new Give_Donor($user_id, true); |
|
1094 | 1088 | |
1095 | - if ( ! $donor ) { |
|
1089 | + if ( ! $donor) { |
|
1096 | 1090 | return false; |
1097 | 1091 | } |
1098 | 1092 | |
1099 | - $user = get_userdata( $user_id ); |
|
1093 | + $user = get_userdata($user_id); |
|
1100 | 1094 | |
1101 | - if ( ! empty( $user ) && $user->user_email !== $donor->email ) { |
|
1095 | + if ( ! empty($user) && $user->user_email !== $donor->email) { |
|
1102 | 1096 | |
1103 | - $success = Give()->donors->update( $donor->id, array( |
|
1097 | + $success = Give()->donors->update($donor->id, array( |
|
1104 | 1098 | 'email' => $user->user_email, |
1105 | - ) ); |
|
1099 | + )); |
|
1106 | 1100 | |
1107 | - if ( $success ) { |
|
1101 | + if ($success) { |
|
1108 | 1102 | // Update some payment meta if we need to |
1109 | - $payments_array = explode( ',', $donor->payment_ids ); |
|
1103 | + $payments_array = explode(',', $donor->payment_ids); |
|
1110 | 1104 | |
1111 | - if ( ! empty( $payments_array ) ) { |
|
1105 | + if ( ! empty($payments_array)) { |
|
1112 | 1106 | |
1113 | - foreach ( $payments_array as $payment_id ) { |
|
1107 | + foreach ($payments_array as $payment_id) { |
|
1114 | 1108 | |
1115 | - give_update_payment_meta( $payment_id, 'email', $user->user_email ); |
|
1109 | + give_update_payment_meta($payment_id, 'email', $user->user_email); |
|
1116 | 1110 | |
1117 | 1111 | } |
1118 | 1112 | } |
@@ -1125,14 +1119,14 @@ discard block |
||
1125 | 1119 | * @param WP_User $user WordPress User object. |
1126 | 1120 | * @param Give_Donor $donor Give donor object. |
1127 | 1121 | */ |
1128 | - do_action( 'give_update_donor_email_on_user_update', $user, $donor ); |
|
1122 | + do_action('give_update_donor_email_on_user_update', $user, $donor); |
|
1129 | 1123 | |
1130 | 1124 | } |
1131 | 1125 | } |
1132 | 1126 | |
1133 | 1127 | } |
1134 | 1128 | |
1135 | -add_action( 'profile_update', 'give_update_donor_email_on_user_update', 10, 2 ); |
|
1129 | +add_action('profile_update', 'give_update_donor_email_on_user_update', 10, 2); |
|
1136 | 1130 | |
1137 | 1131 | |
1138 | 1132 | /** |
@@ -1141,15 +1135,15 @@ discard block |
||
1141 | 1135 | function give_cache_flush() { |
1142 | 1136 | $result = Give_Cache::flush_cache(); |
1143 | 1137 | |
1144 | - if ( $result ) { |
|
1145 | - wp_send_json_success( array( |
|
1146 | - 'message' => __( 'Cache flushed successfully.', 'give' ), |
|
1138 | + if ($result) { |
|
1139 | + wp_send_json_success(array( |
|
1140 | + 'message' => __('Cache flushed successfully.', 'give'), |
|
1147 | 1141 | )); |
1148 | 1142 | } else { |
1149 | - wp_send_json_error( array( |
|
1150 | - 'message' => __( 'An error occured while flushing the cache.', 'give' ), |
|
1143 | + wp_send_json_error(array( |
|
1144 | + 'message' => __('An error occured while flushing the cache.', 'give'), |
|
1151 | 1145 | )); |
1152 | 1146 | } |
1153 | 1147 | } |
1154 | 1148 | |
1155 | -add_action( 'wp_ajax_give_cache_flush', 'give_cache_flush', 10, 0 ); |
|
1149 | +add_action('wp_ajax_give_cache_flush', 'give_cache_flush', 10, 0); |