@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @return bool $ret True if guest checkout is enabled, false otherwise |
29 | 29 | */ |
30 | -function give_no_guest_checkout( $form_id ) { |
|
30 | +function give_no_guest_checkout($form_id) { |
|
31 | 31 | |
32 | 32 | $backtrace = debug_backtrace(); |
33 | 33 | |
34 | - _give_deprecated_function( __FUNCTION__, '1.4.1', null, $backtrace ); |
|
34 | + _give_deprecated_function(__FUNCTION__, '1.4.1', null, $backtrace); |
|
35 | 35 | |
36 | - $ret = get_post_meta( $form_id, '_give_logged_in_only', true ); |
|
36 | + $ret = get_post_meta($form_id, '_give_logged_in_only', true); |
|
37 | 37 | |
38 | - return (bool) apply_filters( 'give_no_guest_checkout', give_is_setting_enabled( $ret ) ); |
|
38 | + return (bool) apply_filters('give_no_guest_checkout', give_is_setting_enabled($ret)); |
|
39 | 39 | } |
40 | 40 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,104 +25,104 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_load_scripts() { |
27 | 27 | |
28 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
29 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
30 | - $scripts_footer = ( give_get_option( 'scripts_footer' ) == 'on' ) ? true : false; |
|
28 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
29 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
30 | + $scripts_footer = (give_get_option('scripts_footer') == 'on') ? true : false; |
|
31 | 31 | |
32 | 32 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
33 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
33 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
34 | 34 | |
35 | 35 | // Localize / PHP to AJAX vars. |
36 | - $localize_give_checkout = apply_filters( 'give_global_script_vars', array( |
|
36 | + $localize_give_checkout = apply_filters('give_global_script_vars', array( |
|
37 | 37 | 'ajaxurl' => give_get_ajax_url(), |
38 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
39 | - 'currency_sign' => give_currency_filter( '' ), |
|
38 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
39 | + 'currency_sign' => give_currency_filter(''), |
|
40 | 40 | 'currency_pos' => give_get_currency_position(), |
41 | 41 | 'thousands_separator' => give_get_price_thousand_separator(), |
42 | 42 | 'decimal_separator' => give_get_price_decimal_separator(), |
43 | - 'no_gateway' => esc_html__( 'Please select a payment method.', 'give' ), |
|
44 | - 'bad_minimum' => esc_html__( 'The minimum donation amount for this form is', 'give' ), |
|
45 | - 'general_loading' => esc_html__( 'Loading...', 'give' ), |
|
46 | - 'purchase_loading' => esc_html__( 'Please Wait...', 'give' ), |
|
43 | + 'no_gateway' => esc_html__('Please select a payment method.', 'give'), |
|
44 | + 'bad_minimum' => esc_html__('The minimum donation amount for this form is', 'give'), |
|
45 | + 'general_loading' => esc_html__('Loading...', 'give'), |
|
46 | + 'purchase_loading' => esc_html__('Please Wait...', 'give'), |
|
47 | 47 | 'number_decimals' => give_get_price_decimals(), |
48 | 48 | 'give_version' => GIVE_VERSION, |
49 | 49 | 'form_translation' => apply_filters( |
50 | 50 | 'give_form_translation_js', |
51 | 51 | array( |
52 | 52 | // Field name Validation message. |
53 | - 'payment-mode' => esc_html__( 'Please select payment mode.', 'give' ), |
|
54 | - 'give_first' => esc_html__( 'Please enter your first name.', 'give' ), |
|
55 | - 'give_email' => esc_html__( 'Please enter a valid email address.', 'give' ), |
|
56 | - 'give_user_login' => esc_html__( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
|
57 | - 'give_user_pass' => esc_html__( 'Enter a password.', 'give' ), |
|
58 | - 'give_user_pass_confirm' => esc_html__( 'Enter a confirm password.', 'give' ), |
|
53 | + 'payment-mode' => esc_html__('Please select payment mode.', 'give'), |
|
54 | + 'give_first' => esc_html__('Please enter your first name.', 'give'), |
|
55 | + 'give_email' => esc_html__('Please enter a valid email address.', 'give'), |
|
56 | + 'give_user_login' => esc_html__('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'), |
|
57 | + 'give_user_pass' => esc_html__('Enter a password.', 'give'), |
|
58 | + 'give_user_pass_confirm' => esc_html__('Enter a confirm password.', 'give'), |
|
59 | 59 | ) |
60 | 60 | ), |
61 | - ) ); |
|
62 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
61 | + )); |
|
62 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
63 | 63 | 'ajaxurl' => give_get_ajax_url(), |
64 | - 'loading' => esc_html__( 'Loading', 'give' ), |
|
64 | + 'loading' => esc_html__('Loading', 'give'), |
|
65 | 65 | // General loading message. |
66 | - 'select_option' => esc_html__( 'Please select an option', 'give' ), |
|
66 | + 'select_option' => esc_html__('Please select an option', 'give'), |
|
67 | 67 | // Variable pricing error with multi-donation option enabled. |
68 | - 'default_gateway' => give_get_default_gateway( null ), |
|
69 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
68 | + 'default_gateway' => give_get_default_gateway(null), |
|
69 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
70 | 70 | 'number_decimals' => give_get_price_decimals(), |
71 | - ) ); |
|
71 | + )); |
|
72 | 72 | |
73 | 73 | // DEBUG is On. |
74 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
74 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
75 | 75 | |
76 | - if ( give_is_cc_verify_enabled() ) { |
|
77 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
78 | - wp_enqueue_script( 'give-cc-validator' ); |
|
76 | + if (give_is_cc_verify_enabled()) { |
|
77 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
78 | + wp_enqueue_script('give-cc-validator'); |
|
79 | 79 | } |
80 | 80 | |
81 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
82 | - wp_enqueue_script( 'give-float-labels' ); |
|
81 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
82 | + wp_enqueue_script('give-float-labels'); |
|
83 | 83 | |
84 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
85 | - wp_enqueue_script( 'give-blockui' ); |
|
84 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
85 | + wp_enqueue_script('give-blockui'); |
|
86 | 86 | |
87 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
88 | - wp_enqueue_script( 'give-qtip' ); |
|
87 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
88 | + wp_enqueue_script('give-qtip'); |
|
89 | 89 | |
90 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
91 | - wp_enqueue_script( 'give-accounting' ); |
|
90 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
91 | + wp_enqueue_script('give-accounting'); |
|
92 | 92 | |
93 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
94 | - wp_enqueue_script( 'give-magnific' ); |
|
93 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
94 | + wp_enqueue_script('give-magnific'); |
|
95 | 95 | |
96 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
97 | - wp_enqueue_script( 'give-checkout-global' ); |
|
96 | + wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
97 | + wp_enqueue_script('give-checkout-global'); |
|
98 | 98 | |
99 | 99 | // General scripts. |
100 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
101 | - wp_enqueue_script( 'give-scripts' ); |
|
100 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
101 | + wp_enqueue_script('give-scripts'); |
|
102 | 102 | |
103 | 103 | // Load AJAX scripts, if enabled. |
104 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
105 | - wp_enqueue_script( 'give-ajax' ); |
|
104 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
105 | + wp_enqueue_script('give-ajax'); |
|
106 | 106 | |
107 | 107 | // Localize / Pass AJAX vars from PHP, |
108 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_checkout ); |
|
109 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
108 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_checkout); |
|
109 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
110 | 110 | |
111 | 111 | } else { |
112 | 112 | |
113 | 113 | // DEBUG is OFF (one JS file to rule them all!). |
114 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
115 | - wp_enqueue_script( 'give' ); |
|
114 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
115 | + wp_enqueue_script('give'); |
|
116 | 116 | |
117 | 117 | // Localize / Pass AJAX vars from PHP. |
118 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_checkout ); |
|
119 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
118 | + wp_localize_script('give', 'give_global_vars', $localize_give_checkout); |
|
119 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
120 | 120 | |
121 | 121 | } |
122 | 122 | |
123 | 123 | } |
124 | 124 | |
125 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
125 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Register styles. |
@@ -135,16 +135,16 @@ discard block |
||
135 | 135 | */ |
136 | 136 | function give_register_styles() { |
137 | 137 | |
138 | - if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
|
138 | + if ( ! give_is_setting_enabled(give_get_option('css'))) { |
|
139 | 139 | return; |
140 | 140 | } |
141 | 141 | |
142 | - wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
143 | - wp_enqueue_style( 'give-styles' ); |
|
142 | + wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
143 | + wp_enqueue_style('give-styles'); |
|
144 | 144 | |
145 | 145 | } |
146 | 146 | |
147 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
147 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
148 | 148 | |
149 | 149 | |
150 | 150 | /** |
@@ -157,42 +157,42 @@ discard block |
||
157 | 157 | function give_get_stylesheet_uri() { |
158 | 158 | |
159 | 159 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
160 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
160 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
161 | 161 | |
162 | 162 | // LTR or RTL files. |
163 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
163 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
164 | 164 | |
165 | - $file = 'give' . $direction . $suffix . '.css'; |
|
165 | + $file = 'give'.$direction.$suffix.'.css'; |
|
166 | 166 | $templates_dir = give_get_theme_template_dir_name(); |
167 | 167 | |
168 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
169 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
170 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
171 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
172 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
168 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
169 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css'; |
|
170 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
171 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css'; |
|
172 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
173 | 173 | |
174 | 174 | $uri = false; |
175 | 175 | |
176 | 176 | // Look in the child theme directory first, followed by the parent theme, |
177 | 177 | // followed by the Give core templates directory also look for the min version first, followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
178 | 178 | // This allows users to copy just give.css to their theme. |
179 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
180 | - if ( ! empty( $nonmin ) ) { |
|
181 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
179 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
180 | + if ( ! empty($nonmin)) { |
|
181 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
182 | 182 | } else { |
183 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
183 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
184 | 184 | } |
185 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
186 | - if ( ! empty( $nonmin ) ) { |
|
187 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
185 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
186 | + if ( ! empty($nonmin)) { |
|
187 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
188 | 188 | } else { |
189 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
189 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
190 | 190 | } |
191 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
192 | - $uri = trailingslashit( give_get_templates_url() ) . $file; |
|
191 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
192 | + $uri = trailingslashit(give_get_templates_url()).$file; |
|
193 | 193 | } |
194 | 194 | |
195 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
195 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
196 | 196 | |
197 | 197 | } |
198 | 198 | |
@@ -209,73 +209,73 @@ discard block |
||
209 | 209 | * |
210 | 210 | * @return void |
211 | 211 | */ |
212 | -function give_load_admin_scripts( $hook ) { |
|
212 | +function give_load_admin_scripts($hook) { |
|
213 | 213 | |
214 | 214 | global $post, $post_type; |
215 | 215 | |
216 | 216 | $give_options = give_get_settings(); |
217 | 217 | |
218 | 218 | // Directories of assets. |
219 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
220 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
221 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
219 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
220 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
221 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
222 | 222 | |
223 | 223 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
224 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
224 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
225 | 225 | |
226 | 226 | // LTR or RTL files. |
227 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
227 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
228 | 228 | |
229 | 229 | // Global Admin. |
230 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
231 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
230 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
231 | + wp_enqueue_style('give-admin-bar-notification'); |
|
232 | 232 | |
233 | 233 | // Give Admin Only. |
234 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
234 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
235 | 235 | return; |
236 | 236 | } |
237 | 237 | |
238 | 238 | // CSS. |
239 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
240 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
241 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', GIVE_VERSION ); |
|
242 | - wp_enqueue_style( 'give-admin' ); |
|
243 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
244 | - wp_enqueue_style( 'jquery-chosen' ); |
|
245 | - wp_enqueue_style( 'thickbox' ); |
|
239 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
240 | + wp_enqueue_style('jquery-ui-css'); |
|
241 | + wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', GIVE_VERSION); |
|
242 | + wp_enqueue_style('give-admin'); |
|
243 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
244 | + wp_enqueue_style('jquery-chosen'); |
|
245 | + wp_enqueue_style('thickbox'); |
|
246 | 246 | |
247 | 247 | // JS. |
248 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
249 | - wp_enqueue_script( 'jquery-chosen' ); |
|
248 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
249 | + wp_enqueue_script('jquery-chosen'); |
|
250 | 250 | |
251 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
252 | - wp_enqueue_script( 'give-accounting' ); |
|
251 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
252 | + wp_enqueue_script('give-accounting'); |
|
253 | 253 | |
254 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
255 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
254 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
255 | + wp_enqueue_script('give-admin-scripts'); |
|
256 | 256 | |
257 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
258 | - wp_enqueue_script( 'jquery-flot' ); |
|
257 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
258 | + wp_enqueue_script('jquery-flot'); |
|
259 | 259 | |
260 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
261 | - wp_enqueue_script( 'give-qtip' ); |
|
260 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
261 | + wp_enqueue_script('give-qtip'); |
|
262 | 262 | |
263 | - wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
264 | - wp_enqueue_script( 'give-repeatable-fields' ); |
|
263 | + wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
264 | + wp_enqueue_script('give-repeatable-fields'); |
|
265 | 265 | |
266 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
267 | - wp_enqueue_script( 'thickbox' ); |
|
266 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
267 | + wp_enqueue_script('thickbox'); |
|
268 | 268 | |
269 | 269 | // Forms CPT Script. |
270 | - if ( $post_type === 'give_forms' ) { |
|
271 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
272 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
270 | + if ($post_type === 'give_forms') { |
|
271 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
272 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | // Settings Scripts. |
276 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) { |
|
277 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
278 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
276 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
277 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
278 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | // Price Separators. |
@@ -283,42 +283,42 @@ discard block |
||
283 | 283 | $decimal_separator = give_get_price_decimal_separator(); |
284 | 284 | |
285 | 285 | // Localize strings & variables for JS. |
286 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
287 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
286 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
287 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
288 | 288 | 'give_version' => GIVE_VERSION, |
289 | 289 | 'thousands_separator' => $thousand_separator, |
290 | 290 | 'decimal_separator' => $decimal_separator, |
291 | - 'quick_edit_warning' => esc_html__( 'Not available for variable priced forms.', 'give' ), |
|
292 | - 'delete_payment' => esc_html__( 'Are you sure you wish to delete this payment?', 'give' ), |
|
293 | - 'delete_payment_note' => esc_html__( 'Are you sure you wish to delete this note?', 'give' ), |
|
294 | - 'revoke_api_key' => esc_html__( 'Are you sure you wish to revoke this API key?', 'give' ), |
|
295 | - 'regenerate_api_key' => esc_html__( 'Are you sure you wish to regenerate this API key?', 'give' ), |
|
296 | - 'resend_receipt' => esc_html__( 'Are you sure you wish to resend the donation receipt?', 'give' ), |
|
297 | - 'logo' => esc_html__( 'Logo', 'give' ), |
|
298 | - 'use_this_image' => esc_html__( 'Use this image', 'give' ), |
|
299 | - 'one_option' => esc_html__( 'Choose a form', 'give' ), |
|
300 | - 'one_or_more_option' => esc_html__( 'Choose one or more forms', 'give' ), |
|
301 | - 'currency_sign' => give_currency_filter( '' ), |
|
302 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
303 | - 'currency_decimals' => give_currency_decimal_filter( give_get_price_decimals() ), |
|
304 | - 'batch_export_no_class' => esc_html__( 'You must choose a method.', 'give' ), |
|
305 | - 'batch_export_no_reqs' => esc_html__( 'Required fields not completed.', 'give' ), |
|
306 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
307 | - 'price_format_guide' => sprintf( esc_html__( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
|
291 | + 'quick_edit_warning' => esc_html__('Not available for variable priced forms.', 'give'), |
|
292 | + 'delete_payment' => esc_html__('Are you sure you wish to delete this payment?', 'give'), |
|
293 | + 'delete_payment_note' => esc_html__('Are you sure you wish to delete this note?', 'give'), |
|
294 | + 'revoke_api_key' => esc_html__('Are you sure you wish to revoke this API key?', 'give'), |
|
295 | + 'regenerate_api_key' => esc_html__('Are you sure you wish to regenerate this API key?', 'give'), |
|
296 | + 'resend_receipt' => esc_html__('Are you sure you wish to resend the donation receipt?', 'give'), |
|
297 | + 'logo' => esc_html__('Logo', 'give'), |
|
298 | + 'use_this_image' => esc_html__('Use this image', 'give'), |
|
299 | + 'one_option' => esc_html__('Choose a form', 'give'), |
|
300 | + 'one_or_more_option' => esc_html__('Choose one or more forms', 'give'), |
|
301 | + 'currency_sign' => give_currency_filter(''), |
|
302 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
303 | + 'currency_decimals' => give_currency_decimal_filter(give_get_price_decimals()), |
|
304 | + 'batch_export_no_class' => esc_html__('You must choose a method.', 'give'), |
|
305 | + 'batch_export_no_reqs' => esc_html__('Required fields not completed.', 'give'), |
|
306 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
307 | + 'price_format_guide' => sprintf(esc_html__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator), |
|
308 | 308 | /* translators : %s: Donation form options metabox */ |
309 | - 'confirm_before_remove_row_text' => __( 'Do you want to delete this level?', 'give' ), |
|
310 | - 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
311 | - 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
312 | - ) ); |
|
309 | + 'confirm_before_remove_row_text' => __('Do you want to delete this level?', 'give'), |
|
310 | + 'matched_success_failure_page' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
311 | + 'dismiss_notice_text' => __('Dismiss this notice.', 'give'), |
|
312 | + )); |
|
313 | 313 | |
314 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) { |
|
314 | + if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) { |
|
315 | 315 | // call for new media manager. |
316 | 316 | wp_enqueue_media(); |
317 | 317 | } |
318 | 318 | |
319 | 319 | } |
320 | 320 | |
321 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
321 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
322 | 322 | |
323 | 323 | /** |
324 | 324 | * Admin Give Icon |
@@ -333,13 +333,13 @@ discard block |
||
333 | 333 | ?> |
334 | 334 | <style type="text/css" media="screen"> |
335 | 335 | |
336 | - <?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?> |
|
336 | + <?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?> |
|
337 | 337 | @font-face { |
338 | 338 | font-family: 'give-icomoon'; |
339 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
340 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
341 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
342 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
339 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
340 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
341 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
342 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
343 | 343 | font-weight: normal; |
344 | 344 | font-style: normal; |
345 | 345 | } |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | <?php |
359 | 359 | } |
360 | 360 | |
361 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
361 | +add_action('admin_head', 'give_admin_icon'); |
|
362 | 362 | |
363 | 363 | /** |
364 | 364 | * Admin js code |
@@ -388,4 +388,4 @@ discard block |
||
388 | 388 | <?php |
389 | 389 | } |
390 | 390 | |
391 | -add_action( 'admin_head', 'give_admin_hide_notice_shortly_js' ); |
|
391 | +add_action('admin_head', 'give_admin_hide_notice_shortly_js'); |
@@ -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_Page' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Page')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Page. |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | // Get current setting page. |
63 | 63 | $this->current_setting_page = give_get_current_setting_page(); |
64 | 64 | |
65 | - add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 ); |
|
66 | - add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 ); |
|
67 | - add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array( $this, 'output_sections' ) ); |
|
68 | - add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
69 | - add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) ); |
|
65 | + add_filter("give_default_setting_tab_section_{$this->id}", array($this, 'set_default_setting_tab'), 10); |
|
66 | + add_filter("{$this->current_setting_page}_tabs_array", array($this, 'add_settings_page'), 20); |
|
67 | + add_action("{$this->current_setting_page}_sections_{$this->id}_page", array($this, 'output_sections')); |
|
68 | + add_action("{$this->current_setting_page}_settings_{$this->id}_page", array($this, 'output')); |
|
69 | + add_action("{$this->current_setting_page}_save_{$this->id}", array($this, 'save')); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param $setting_tab |
77 | 77 | * @return string |
78 | 78 | */ |
79 | - function set_default_setting_tab( $setting_tab ) { |
|
79 | + function set_default_setting_tab($setting_tab) { |
|
80 | 80 | return $this->default_tab; |
81 | 81 | } |
82 | 82 | |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * @param array $pages Lst of pages. |
88 | 88 | * @return array |
89 | 89 | */ |
90 | - public function add_settings_page( $pages ) { |
|
91 | - $pages[ $this->id ] = $this->label; |
|
90 | + public function add_settings_page($pages) { |
|
91 | + $pages[$this->id] = $this->label; |
|
92 | 92 | |
93 | 93 | return $pages; |
94 | 94 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @since 1.8 |
107 | 107 | * @param array $settings |
108 | 108 | */ |
109 | - $settings = apply_filters( 'give_get_settings_' . $this->id, array() ); |
|
109 | + $settings = apply_filters('give_get_settings_'.$this->id, array()); |
|
110 | 110 | |
111 | 111 | // Output. |
112 | 112 | return $settings; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @return array |
120 | 120 | */ |
121 | 121 | public function get_sections() { |
122 | - return apply_filters( 'give_get_sections_' . $this->id, array() ); |
|
122 | + return apply_filters('give_get_sections_'.$this->id, array()); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -137,21 +137,21 @@ discard block |
||
137 | 137 | |
138 | 138 | |
139 | 139 | // Bailout. |
140 | - if ( empty( $sections ) || 1 === sizeof( $sections ) ) { |
|
140 | + if (empty($sections) || 1 === sizeof($sections)) { |
|
141 | 141 | return; |
142 | 142 | } |
143 | 143 | |
144 | - if( is_null( $this->current_setting_page ) ) { |
|
144 | + if (is_null($this->current_setting_page)) { |
|
145 | 145 | $this->current_setting_page = give_get_current_setting_page(); |
146 | 146 | } |
147 | 147 | |
148 | 148 | echo '<ul class="subsubsub">'; |
149 | 149 | |
150 | 150 | // Get section keys. |
151 | - $array_keys = array_keys( $sections ); |
|
151 | + $array_keys = array_keys($sections); |
|
152 | 152 | |
153 | - foreach ( $sections as $id => $label ) { |
|
154 | - echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=' . $this->current_setting_page . '&tab=' . $this->id . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>'; |
|
153 | + foreach ($sections as $id => $label) { |
|
154 | + echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page='.$this->current_setting_page.'&tab='.$this->id.'§ion='.sanitize_title($id)).'" class="'.($current_section == $id ? 'current' : '').'">'.$label.'</a> '.(end($array_keys) == $id ? '' : '|').' </li>'; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | echo '</ul><br class="clear" />'; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | public function output() { |
167 | 167 | $settings = $this->get_settings(); |
168 | 168 | |
169 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
169 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -179,14 +179,14 @@ discard block |
||
179 | 179 | $settings = $this->get_settings(); |
180 | 180 | $current_section = give_get_current_setting_section(); |
181 | 181 | |
182 | - Give_Admin_Settings::save_fields( $settings, 'give_settings' ); |
|
182 | + Give_Admin_Settings::save_fields($settings, 'give_settings'); |
|
183 | 183 | |
184 | 184 | /** |
185 | 185 | * Trigger Action |
186 | 186 | * |
187 | 187 | * @since 1.8 |
188 | 188 | */ |
189 | - do_action( 'give_update_options_' . $this->id . '_' . $current_section ); |
|
189 | + do_action('give_update_options_'.$this->id.'_'.$current_section); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -25,34 +25,34 @@ 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 | 49 | |
50 | - if ( $did_upgrade ) { |
|
51 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
50 | + if ($did_upgrade) { |
|
51 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | -add_action( 'admin_init', 'give_do_automatic_upgrades' ); |
|
55 | +add_action('admin_init', 'give_do_automatic_upgrades'); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * Display Upgrade Notices |
@@ -62,18 +62,18 @@ discard block |
||
62 | 62 | */ |
63 | 63 | function give_show_upgrade_notices() { |
64 | 64 | // Don't show notices on the upgrades page. |
65 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) { |
|
65 | + if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') { |
|
66 | 66 | return; |
67 | 67 | } |
68 | 68 | |
69 | - $give_version = get_option( 'give_version' ); |
|
69 | + $give_version = get_option('give_version'); |
|
70 | 70 | |
71 | - if ( ! $give_version ) { |
|
71 | + if ( ! $give_version) { |
|
72 | 72 | // 1.0 is the first version to use this option so we must add it. |
73 | 73 | $give_version = '1.0'; |
74 | 74 | } |
75 | 75 | |
76 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
76 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
77 | 77 | |
78 | 78 | /* |
79 | 79 | * NOTICE: |
@@ -84,27 +84,27 @@ discard block |
||
84 | 84 | */ |
85 | 85 | |
86 | 86 | // v1.3.2 Upgrades |
87 | - if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) { |
|
87 | + if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) { |
|
88 | 88 | // translators: %s: upgrade URL. |
89 | 89 | printf( |
90 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
91 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) ) |
|
90 | + '<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
91 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id')) |
|
92 | 92 | ); |
93 | 93 | } |
94 | 94 | |
95 | 95 | // v1.3.4 Upgrades //ensure the user has gone through 1.3.4. |
96 | - if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) { |
|
96 | + if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) { |
|
97 | 97 | // translators: %s: upgrade URL. |
98 | 98 | printf( |
99 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
100 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) ) |
|
99 | + '<div class="updated"><p>'.__('Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
100 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status')) |
|
101 | 101 | ); |
102 | 102 | } |
103 | 103 | |
104 | 104 | // End 'Stepped' upgrade process notices. |
105 | 105 | } |
106 | 106 | |
107 | -add_action( 'admin_notices', 'give_show_upgrade_notices' ); |
|
107 | +add_action('admin_notices', 'give_show_upgrade_notices'); |
|
108 | 108 | |
109 | 109 | /** |
110 | 110 | * Triggers all upgrade functions |
@@ -116,26 +116,26 @@ discard block |
||
116 | 116 | */ |
117 | 117 | function give_trigger_upgrades() { |
118 | 118 | |
119 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
120 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
119 | + if ( ! current_user_can('manage_give_settings')) { |
|
120 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
121 | 121 | } |
122 | 122 | |
123 | - $give_version = get_option( 'give_version' ); |
|
123 | + $give_version = get_option('give_version'); |
|
124 | 124 | |
125 | - if ( ! $give_version ) { |
|
125 | + if ( ! $give_version) { |
|
126 | 126 | // 1.0 is the first version to use this option so we must add it. |
127 | 127 | $give_version = '1.0'; |
128 | - add_option( 'give_version', $give_version ); |
|
128 | + add_option('give_version', $give_version); |
|
129 | 129 | } |
130 | 130 | |
131 | - update_option( 'give_version', GIVE_VERSION ); |
|
131 | + update_option('give_version', GIVE_VERSION); |
|
132 | 132 | |
133 | - if ( DOING_AJAX ) { |
|
134 | - die( 'complete' ); |
|
133 | + if (DOING_AJAX) { |
|
134 | + die('complete'); |
|
135 | 135 | } // Let AJAX know that the upgrade is complete. |
136 | 136 | } |
137 | 137 | |
138 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
138 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
139 | 139 | |
140 | 140 | /** |
141 | 141 | * Check if the upgrade routine has been run for a specific action |
@@ -146,15 +146,15 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @return bool If the action has been added to the completed actions array |
148 | 148 | */ |
149 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
149 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
150 | 150 | |
151 | - if ( empty( $upgrade_action ) ) { |
|
151 | + if (empty($upgrade_action)) { |
|
152 | 152 | return false; |
153 | 153 | } |
154 | 154 | |
155 | 155 | $completed_upgrades = give_get_completed_upgrades(); |
156 | 156 | |
157 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
157 | + return in_array($upgrade_action, $completed_upgrades); |
|
158 | 158 | |
159 | 159 | } |
160 | 160 | |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @return bool If the function was successfully added |
169 | 169 | */ |
170 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
170 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
171 | 171 | |
172 | - if ( empty( $upgrade_action ) ) { |
|
172 | + if (empty($upgrade_action)) { |
|
173 | 173 | return false; |
174 | 174 | } |
175 | 175 | |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | $completed_upgrades[] = $upgrade_action; |
178 | 178 | |
179 | 179 | // Remove any blanks, and only show uniques. |
180 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
180 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
181 | 181 | |
182 | - return update_option( 'give_completed_upgrades', $completed_upgrades ); |
|
182 | + return update_option('give_completed_upgrades', $completed_upgrades); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | */ |
191 | 191 | function give_get_completed_upgrades() { |
192 | 192 | |
193 | - $completed_upgrades = get_option( 'give_completed_upgrades' ); |
|
193 | + $completed_upgrades = get_option('give_completed_upgrades'); |
|
194 | 194 | |
195 | - if ( false === $completed_upgrades ) { |
|
195 | + if (false === $completed_upgrades) { |
|
196 | 196 | $completed_upgrades = array(); |
197 | 197 | } |
198 | 198 | |
@@ -209,29 +209,29 @@ discard block |
||
209 | 209 | */ |
210 | 210 | function give_v132_upgrade_give_payment_customer_id() { |
211 | 211 | global $wpdb; |
212 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
213 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
212 | + if ( ! current_user_can('manage_give_settings')) { |
|
213 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
214 | 214 | } |
215 | 215 | |
216 | - ignore_user_abort( true ); |
|
216 | + ignore_user_abort(true); |
|
217 | 217 | |
218 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
219 | - @set_time_limit( 0 ); |
|
218 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
219 | + @set_time_limit(0); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | // UPDATE DB METAKEYS. |
223 | 223 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
224 | - $query = $wpdb->query( $sql ); |
|
224 | + $query = $wpdb->query($sql); |
|
225 | 225 | |
226 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
227 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
228 | - delete_option( 'give_doing_upgrade' ); |
|
229 | - wp_redirect( admin_url() ); |
|
226 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
227 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
228 | + delete_option('give_doing_upgrade'); |
|
229 | + wp_redirect(admin_url()); |
|
230 | 230 | exit; |
231 | 231 | |
232 | 232 | } |
233 | 233 | |
234 | -add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' ); |
|
234 | +add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id'); |
|
235 | 235 | |
236 | 236 | /** |
237 | 237 | * Upgrades the Offline Status |
@@ -244,14 +244,14 @@ discard block |
||
244 | 244 | |
245 | 245 | global $wpdb; |
246 | 246 | |
247 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
248 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
247 | + if ( ! current_user_can('manage_give_settings')) { |
|
248 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
249 | 249 | } |
250 | 250 | |
251 | - ignore_user_abort( true ); |
|
251 | + ignore_user_abort(true); |
|
252 | 252 | |
253 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
254 | - @set_time_limit( 0 ); |
|
253 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
254 | + @set_time_limit(0); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | // Get abandoned offline payments. |
@@ -261,31 +261,31 @@ discard block |
||
261 | 261 | $where .= "AND ( p.post_status = 'abandoned' )"; |
262 | 262 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
263 | 263 | |
264 | - $sql = $select . $join . $where; |
|
265 | - $found_payments = $wpdb->get_col( $sql ); |
|
264 | + $sql = $select.$join.$where; |
|
265 | + $found_payments = $wpdb->get_col($sql); |
|
266 | 266 | |
267 | - foreach ( $found_payments as $payment ) { |
|
267 | + foreach ($found_payments as $payment) { |
|
268 | 268 | |
269 | 269 | // Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves. |
270 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
270 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
271 | 271 | |
272 | 272 | // 1450124863 = 12/10/2015 20:42:25. |
273 | - if ( $modified_time >= 1450124863 ) { |
|
273 | + if ($modified_time >= 1450124863) { |
|
274 | 274 | |
275 | - give_update_payment_status( $payment, 'pending' ); |
|
275 | + give_update_payment_status($payment, 'pending'); |
|
276 | 276 | |
277 | 277 | } |
278 | 278 | } |
279 | 279 | |
280 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
281 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
282 | - delete_option( 'give_doing_upgrade' ); |
|
283 | - wp_redirect( admin_url() ); |
|
280 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
281 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
282 | + delete_option('give_doing_upgrade'); |
|
283 | + wp_redirect(admin_url()); |
|
284 | 284 | exit; |
285 | 285 | |
286 | 286 | } |
287 | 287 | |
288 | -add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' ); |
|
288 | +add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status'); |
|
289 | 289 | |
290 | 290 | /** |
291 | 291 | * Cleanup User Roles |
@@ -296,17 +296,17 @@ discard block |
||
296 | 296 | */ |
297 | 297 | function give_v152_cleanup_users() { |
298 | 298 | |
299 | - $give_version = get_option( 'give_version' ); |
|
299 | + $give_version = get_option('give_version'); |
|
300 | 300 | |
301 | - if ( ! $give_version ) { |
|
301 | + if ( ! $give_version) { |
|
302 | 302 | // 1.0 is the first version to use this option so we must add it. |
303 | 303 | $give_version = '1.0'; |
304 | 304 | } |
305 | 305 | |
306 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
306 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
307 | 307 | |
308 | 308 | // v1.5.2 Upgrades |
309 | - if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) { |
|
309 | + if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) { |
|
310 | 310 | |
311 | 311 | // Delete all caps with "ss". |
312 | 312 | // Also delete all unused "campaign" roles. |
@@ -353,9 +353,9 @@ discard block |
||
353 | 353 | ); |
354 | 354 | |
355 | 355 | global $wp_roles; |
356 | - foreach ( $delete_caps as $cap ) { |
|
357 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
358 | - $wp_roles->remove_cap( $role, $cap ); |
|
356 | + foreach ($delete_caps as $cap) { |
|
357 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
358 | + $wp_roles->remove_cap($role, $cap); |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | |
@@ -365,15 +365,15 @@ discard block |
||
365 | 365 | $roles->add_caps(); |
366 | 366 | |
367 | 367 | // The Update Ran. |
368 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
369 | - give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' ); |
|
370 | - delete_option( 'give_doing_upgrade' ); |
|
368 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
369 | + give_set_upgrade_complete('upgrade_give_user_caps_cleanup'); |
|
370 | + delete_option('give_doing_upgrade'); |
|
371 | 371 | |
372 | 372 | } |
373 | 373 | |
374 | 374 | } |
375 | 375 | |
376 | -add_action( 'admin_init', 'give_v152_cleanup_users' ); |
|
376 | +add_action('admin_init', 'give_v152_cleanup_users'); |
|
377 | 377 | |
378 | 378 | /** |
379 | 379 | * 1.6 Upgrade routine to create the customer meta table. |
@@ -410,53 +410,53 @@ discard block |
||
410 | 410 | |
411 | 411 | // Get addons license key. |
412 | 412 | $addons = array(); |
413 | - foreach ( $give_options as $key => $value ) { |
|
414 | - if ( false !== strpos( $key, '_license_key' ) ) { |
|
415 | - $addons[ $key ] = $value; |
|
413 | + foreach ($give_options as $key => $value) { |
|
414 | + if (false !== strpos($key, '_license_key')) { |
|
415 | + $addons[$key] = $value; |
|
416 | 416 | } |
417 | 417 | } |
418 | 418 | |
419 | 419 | // Bailout: We do not have any addon license data to upgrade. |
420 | - if ( empty( $addons ) ) { |
|
420 | + if (empty($addons)) { |
|
421 | 421 | return false; |
422 | 422 | } |
423 | 423 | |
424 | - foreach ( $addons as $key => $addon_license ) { |
|
424 | + foreach ($addons as $key => $addon_license) { |
|
425 | 425 | |
426 | 426 | // Get addon shortname. |
427 | - $shortname = str_replace( '_license_key', '', $key ); |
|
427 | + $shortname = str_replace('_license_key', '', $key); |
|
428 | 428 | |
429 | 429 | // Addon license option name. |
430 | - $addon_license_option_name = $shortname . '_license_active'; |
|
430 | + $addon_license_option_name = $shortname.'_license_active'; |
|
431 | 431 | |
432 | 432 | // bailout if license is empty. |
433 | - if ( empty( $addon_license ) ) { |
|
434 | - delete_option( $addon_license_option_name ); |
|
433 | + if (empty($addon_license)) { |
|
434 | + delete_option($addon_license_option_name); |
|
435 | 435 | continue; |
436 | 436 | } |
437 | 437 | |
438 | 438 | // Get addon name. |
439 | 439 | $addon_name = array(); |
440 | - $addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) ); |
|
441 | - foreach ( $addon_name_parts as $name_part ) { |
|
440 | + $addon_name_parts = explode('_', str_replace('give_', '', $shortname)); |
|
441 | + foreach ($addon_name_parts as $name_part) { |
|
442 | 442 | |
443 | 443 | // Fix addon name. |
444 | - switch ( $name_part ) { |
|
444 | + switch ($name_part) { |
|
445 | 445 | case 'authorizenet' : |
446 | 446 | $name_part = 'authorize.net'; |
447 | 447 | break; |
448 | 448 | } |
449 | 449 | |
450 | - $addon_name[] = ucfirst( $name_part ); |
|
450 | + $addon_name[] = ucfirst($name_part); |
|
451 | 451 | } |
452 | 452 | |
453 | - $addon_name = implode( ' ', $addon_name ); |
|
453 | + $addon_name = implode(' ', $addon_name); |
|
454 | 454 | |
455 | 455 | // Data to send to the API. |
456 | 456 | $api_params = array( |
457 | 457 | 'edd_action' => 'activate_license', // never change from "edd_" to "give_"! |
458 | 458 | 'license' => $addon_license, |
459 | - 'item_name' => urlencode( $addon_name ), |
|
459 | + 'item_name' => urlencode($addon_name), |
|
460 | 460 | 'url' => home_url(), |
461 | 461 | ); |
462 | 462 | |
@@ -471,17 +471,17 @@ discard block |
||
471 | 471 | ); |
472 | 472 | |
473 | 473 | // Make sure there are no errors. |
474 | - if ( is_wp_error( $response ) ) { |
|
475 | - delete_option( $addon_license_option_name ); |
|
474 | + if (is_wp_error($response)) { |
|
475 | + delete_option($addon_license_option_name); |
|
476 | 476 | continue; |
477 | 477 | } |
478 | 478 | |
479 | 479 | // Tell WordPress to look for updates. |
480 | - set_site_transient( 'update_plugins', null ); |
|
480 | + set_site_transient('update_plugins', null); |
|
481 | 481 | |
482 | 482 | // Decode license data. |
483 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
484 | - update_option( $addon_license_option_name, $license_data ); |
|
483 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
484 | + update_option($addon_license_option_name, $license_data); |
|
485 | 485 | } |
486 | 486 | } |
487 | 487 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | function give_v18_upgrades_core_setting() { |
535 | 535 | // Core settings which changes from checkbox to radio. |
536 | 536 | $core_setting_names = array_merge( |
537 | - array_keys( give_v18_renamed_core_settings() ), |
|
537 | + array_keys(give_v18_renamed_core_settings()), |
|
538 | 538 | array( |
539 | 539 | 'uninstall_on_delete', |
540 | 540 | 'scripts_footer', |
@@ -546,44 +546,44 @@ discard block |
||
546 | 546 | ); |
547 | 547 | |
548 | 548 | // Bailout: If not any setting define. |
549 | - if ( $give_settings = get_option( 'give_settings' ) ) { |
|
549 | + if ($give_settings = get_option('give_settings')) { |
|
550 | 550 | |
551 | 551 | $setting_changed = false; |
552 | 552 | |
553 | 553 | // Loop: check each setting field. |
554 | - foreach ( $core_setting_names as $setting_name ) { |
|
554 | + foreach ($core_setting_names as $setting_name) { |
|
555 | 555 | // New setting name. |
556 | - $new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name ); |
|
556 | + $new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name); |
|
557 | 557 | |
558 | 558 | // Continue: If setting already set. |
559 | 559 | if ( |
560 | - array_key_exists( $new_setting_name, $give_settings ) |
|
561 | - && in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) ) |
|
560 | + array_key_exists($new_setting_name, $give_settings) |
|
561 | + && in_array($give_settings[$new_setting_name], array('enabled', 'disabled')) |
|
562 | 562 | ) { |
563 | 563 | continue; |
564 | 564 | } |
565 | 565 | |
566 | 566 | // Set checkbox value to radio value. |
567 | - $give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' ); |
|
567 | + $give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled'); |
|
568 | 568 | |
569 | 569 | // @see https://github.com/WordImpress/Give/issues/1063 |
570 | - if ( false !== strpos( $setting_name, 'disable_' ) ) { |
|
570 | + if (false !== strpos($setting_name, 'disable_')) { |
|
571 | 571 | |
572 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' ); |
|
573 | - } elseif ( false !== strpos( $setting_name, 'enable_' ) ) { |
|
572 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled'); |
|
573 | + } elseif (false !== strpos($setting_name, 'enable_')) { |
|
574 | 574 | |
575 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enable' : 'disabled' ); |
|
575 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enable' : 'disabled'); |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | // Tell bot to update core setting to db. |
579 | - if ( ! $setting_changed ) { |
|
579 | + if ( ! $setting_changed) { |
|
580 | 580 | $setting_changed = true; |
581 | 581 | } |
582 | 582 | } |
583 | 583 | |
584 | 584 | // Update setting only if they changed. |
585 | - if ( $setting_changed ) { |
|
586 | - update_option( 'give_settings', $give_settings ); |
|
585 | + if ($setting_changed) { |
|
586 | + update_option('give_settings', $give_settings); |
|
587 | 587 | } |
588 | 588 | } |
589 | 589 | } |
@@ -596,25 +596,25 @@ discard block |
||
596 | 596 | * @return void |
597 | 597 | */ |
598 | 598 | function give_v18_upgrades_form_metadata() { |
599 | - $forms = new WP_Query( array( |
|
599 | + $forms = new WP_Query(array( |
|
600 | 600 | 'post_type' => 'give_forms', |
601 | - 'posts_per_page' => - 1, |
|
601 | + 'posts_per_page' => -1, |
|
602 | 602 | ) |
603 | 603 | ); |
604 | 604 | |
605 | - if ( $forms->have_posts() ) { |
|
606 | - while ( $forms->have_posts() ) { |
|
605 | + if ($forms->have_posts()) { |
|
606 | + while ($forms->have_posts()) { |
|
607 | 607 | $forms->the_post(); |
608 | 608 | |
609 | 609 | // Form content. |
610 | 610 | // Note in version 1.8 display content setting split into display content and content placement setting. |
611 | - $show_content = get_post_meta( get_the_ID(), '_give_content_option', true ); |
|
612 | - if ( $show_content && ! get_post_meta( get_the_ID(), '_give_display_content', true ) ) { |
|
613 | - $field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' ); |
|
614 | - update_post_meta( get_the_ID(), '_give_display_content', $field_value ); |
|
611 | + $show_content = get_post_meta(get_the_ID(), '_give_content_option', true); |
|
612 | + if ($show_content && ! get_post_meta(get_the_ID(), '_give_display_content', true)) { |
|
613 | + $field_value = ('none' !== $show_content ? 'enabled' : 'disabled'); |
|
614 | + update_post_meta(get_the_ID(), '_give_display_content', $field_value); |
|
615 | 615 | |
616 | - $field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' ); |
|
617 | - update_post_meta( get_the_ID(), '_give_content_option', $field_value ); |
|
616 | + $field_value = ('none' !== $show_content ? $show_content : 'give_pre_form'); |
|
617 | + update_post_meta(get_the_ID(), '_give_content_option', $field_value); |
|
618 | 618 | } |
619 | 619 | |
620 | 620 | |
@@ -643,15 +643,15 @@ discard block |
||
643 | 643 | ); |
644 | 644 | |
645 | 645 | |
646 | - foreach ( $form_radio_settings as $meta_key ) { |
|
646 | + foreach ($form_radio_settings as $meta_key) { |
|
647 | 647 | // Get value. |
648 | - $field_value = get_post_meta( get_the_ID(), $meta_key, true ); |
|
648 | + $field_value = get_post_meta(get_the_ID(), $meta_key, true); |
|
649 | 649 | |
650 | 650 | // Convert meta value only if it is in yes/no/none. |
651 | - if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) { |
|
651 | + if (in_array($field_value, array('yes', 'on', 'no', 'none'))) { |
|
652 | 652 | |
653 | - $field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' ); |
|
654 | - update_post_meta( get_the_ID(), $meta_key, $field_value ); |
|
653 | + $field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled'); |
|
654 | + update_post_meta(get_the_ID(), $meta_key, $field_value); |
|
655 | 655 | } |
656 | 656 | |
657 | 657 | } |
@@ -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 | |
@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_add_shortcode_to_publish_metabox() { |
24 | 24 | |
25 | - if ( 'give_forms' !== get_post_type() ) { |
|
25 | + if ('give_forms' !== get_post_type()) { |
|
26 | 26 | return false; |
27 | 27 | } |
28 | 28 | global $post; |
29 | 29 | |
30 | 30 | //Shortcode column with select all input |
31 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
32 | - echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
31 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
32 | + echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
33 | 33 | } |
34 | 34 | |
35 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
35 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Exit if accessed directly. |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -29,23 +29,23 @@ discard block |
||
29 | 29 | * @return void |
30 | 30 | */ |
31 | 31 | function give_reports_page() { |
32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
33 | - $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'reports'; |
|
32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
33 | + $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'reports'; |
|
34 | 34 | ?> |
35 | 35 | <div class="wrap"> |
36 | 36 | |
37 | 37 | <h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1> |
38 | 38 | |
39 | 39 | <h2 class="nav-tab-wrapper"> |
40 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
40 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
41 | 41 | 'tab' => 'reports', |
42 | 42 | 'settings-updated' => false |
43 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Reports', 'give' ); ?></a> |
|
44 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
45 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
43 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Reports', 'give'); ?></a> |
|
44 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
45 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
46 | 46 | 'tab' => 'export', |
47 | 47 | 'settings-updated' => false |
48 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
48 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
49 | 49 | <?php } |
50 | 50 | /** |
51 | 51 | * Fires in the report tabs. |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @since 1.0 |
56 | 56 | */ |
57 | - do_action( 'give_reports_tabs' ); |
|
57 | + do_action('give_reports_tabs'); |
|
58 | 58 | ?> |
59 | 59 | </h2> |
60 | 60 | |
@@ -64,21 +64,21 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @since 1.0 |
66 | 66 | */ |
67 | - do_action( 'give_reports_page_top' ); |
|
67 | + do_action('give_reports_page_top'); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Fires the report page active tab. |
71 | 71 | * |
72 | 72 | * @since 1.0 |
73 | 73 | */ |
74 | - do_action( "give_reports_tab_{$active_tab}" ); |
|
74 | + do_action("give_reports_tab_{$active_tab}"); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Fires after the report page. |
78 | 78 | * |
79 | 79 | * @since 1.0 |
80 | 80 | */ |
81 | - do_action( 'give_reports_page_bottom' ); |
|
81 | + do_action('give_reports_page_bottom'); |
|
82 | 82 | ?> |
83 | 83 | </div><!-- .wrap --> |
84 | 84 | <?php |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | */ |
93 | 93 | function give_reports_default_views() { |
94 | 94 | $views = array( |
95 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
96 | - 'forms' => esc_html__( 'Forms', 'give' ), |
|
97 | - 'donors' => esc_html__( 'Donors', 'give' ), |
|
98 | - 'gateways' => esc_html__( 'Payment Methods', 'give' ) |
|
95 | + 'earnings' => esc_html__('Income', 'give'), |
|
96 | + 'forms' => esc_html__('Forms', 'give'), |
|
97 | + 'donors' => esc_html__('Donors', 'give'), |
|
98 | + 'gateways' => esc_html__('Payment Methods', 'give') |
|
99 | 99 | ); |
100 | 100 | |
101 | - $views = apply_filters( 'give_report_views', $views ); |
|
101 | + $views = apply_filters('give_report_views', $views); |
|
102 | 102 | |
103 | 103 | return $views; |
104 | 104 | } |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | * @return string $view Report View |
115 | 115 | * |
116 | 116 | */ |
117 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
117 | +function give_get_reporting_view($default = 'earnings') { |
|
118 | 118 | |
119 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
119 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
120 | 120 | $view = $default; |
121 | 121 | } else { |
122 | 122 | $view = $_GET['view']; |
123 | 123 | } |
124 | 124 | |
125 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
125 | + return apply_filters('give_get_reporting_view', $view); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $current_view = 'earnings'; |
136 | 136 | $views = give_reports_default_views(); |
137 | 137 | |
138 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) { |
|
138 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) { |
|
139 | 139 | $current_view = $_GET['view']; |
140 | 140 | } |
141 | 141 | |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @since 1.0 |
146 | 146 | */ |
147 | - do_action( "give_reports_view_{$current_view}" ); |
|
147 | + do_action("give_reports_view_{$current_view}"); |
|
148 | 148 | } |
149 | 149 | |
150 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
150 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
151 | 151 | |
152 | 152 | /** |
153 | 153 | * Renders the Reports Page Views Drop Downs |
@@ -157,19 +157,19 @@ discard block |
||
157 | 157 | */ |
158 | 158 | function give_report_views() { |
159 | 159 | $views = give_reports_default_views(); |
160 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
160 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
161 | 161 | /** |
162 | 162 | * Fires before the report page actions form. |
163 | 163 | * |
164 | 164 | * @since 1.0 |
165 | 165 | */ |
166 | - do_action( 'give_report_view_actions_before' ); |
|
166 | + do_action('give_report_view_actions_before'); |
|
167 | 167 | ?> |
168 | 168 | <form id="give-reports-filter" method="get"> |
169 | 169 | <select id="give-reports-view" name="view"> |
170 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
171 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
172 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
170 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
171 | + <?php foreach ($views as $view_id => $label) : ?> |
|
172 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
173 | 173 | <?php endforeach; ?> |
174 | 174 | </select> |
175 | 175 | |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @since 1.0 |
183 | 183 | */ |
184 | - do_action( 'give_report_view_actions' ); |
|
184 | + do_action('give_report_view_actions'); |
|
185 | 185 | ?> |
186 | 186 | |
187 | 187 | <input type="hidden" name="post_type" value="give_forms"/> |
188 | 188 | <input type="hidden" name="page" value="give-reports"/> |
189 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
189 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
190 | 190 | </form> |
191 | 191 | <?php |
192 | 192 | /** |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * |
195 | 195 | * @since 1.0 |
196 | 196 | */ |
197 | - do_action( 'give_report_view_actions_after' ); |
|
197 | + do_action('give_report_view_actions_after'); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
@@ -207,18 +207,18 @@ discard block |
||
207 | 207 | */ |
208 | 208 | function give_reports_forms_table() { |
209 | 209 | |
210 | - if ( isset( $_GET['form-id'] ) ) { |
|
210 | + if (isset($_GET['form-id'])) { |
|
211 | 211 | return; |
212 | 212 | } |
213 | 213 | |
214 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
214 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
215 | 215 | |
216 | 216 | $give_table = new Give_Form_Reports_Table(); |
217 | 217 | $give_table->prepare_items(); |
218 | 218 | $give_table->display(); |
219 | 219 | } |
220 | 220 | |
221 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
221 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
222 | 222 | |
223 | 223 | /** |
224 | 224 | * Renders the detailed report for a specific give form |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * @return void |
228 | 228 | */ |
229 | 229 | function give_reports_form_details() { |
230 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
230 | + if ( ! isset($_GET['form-id'])) { |
|
231 | 231 | return; |
232 | 232 | } |
233 | 233 | ?> |
@@ -235,14 +235,14 @@ discard block |
||
235 | 235 | <div class="actions bulkactions"> |
236 | 236 | <?php give_report_views(); ?> |
237 | 237 | |
238 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
238 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
239 | 239 | </div> |
240 | 240 | </div> |
241 | 241 | <?php |
242 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
242 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
243 | 243 | } |
244 | 244 | |
245 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
245 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Renders the Reports Donors Table |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @return void |
254 | 254 | */ |
255 | 255 | function give_reports_donors_table() { |
256 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
256 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
257 | 257 | |
258 | 258 | $give_table = new Give_Donor_Reports_Table(); |
259 | 259 | $give_table->prepare_items(); |
@@ -265,11 +265,11 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @since 1.0 |
267 | 267 | */ |
268 | - do_action( 'give_logs_donors_table_top' ); |
|
268 | + do_action('give_logs_donors_table_top'); |
|
269 | 269 | ?> |
270 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>"> |
|
270 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>"> |
|
271 | 271 | <?php |
272 | - $give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' ); |
|
272 | + $give_table->search_box(esc_html__('Search', 'give'), 'give-donors'); |
|
273 | 273 | $give_table->display(); |
274 | 274 | ?> |
275 | 275 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -282,13 +282,13 @@ discard block |
||
282 | 282 | * |
283 | 283 | * @since 1.0 |
284 | 284 | */ |
285 | - do_action( 'give_logs_donors_table_bottom' ); |
|
285 | + do_action('give_logs_donors_table_bottom'); |
|
286 | 286 | ?> |
287 | 287 | </div> |
288 | 288 | <?php |
289 | 289 | } |
290 | 290 | |
291 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
291 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
292 | 292 | |
293 | 293 | |
294 | 294 | /** |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | * @return void |
301 | 301 | */ |
302 | 302 | function give_reports_gateways_table() { |
303 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
303 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
304 | 304 | |
305 | 305 | $give_table = new Give_Gateawy_Reports_Table(); |
306 | 306 | $give_table->prepare_items(); |
307 | 307 | $give_table->display(); |
308 | 308 | } |
309 | 309 | |
310 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
310 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
311 | 311 | |
312 | 312 | |
313 | 313 | /** |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | function give_reports_earnings() { |
320 | 320 | ?> |
321 | 321 | <div class="tablenav top reports-table-nav"> |
322 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Over Time', 'give' ); ?></span></h3> |
|
322 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Over Time', 'give'); ?></span></h3> |
|
323 | 323 | |
324 | 324 | <div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div> |
325 | 325 | </div> |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | give_reports_graph(); |
328 | 328 | } |
329 | 329 | |
330 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
330 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
331 | 331 | |
332 | 332 | |
333 | 333 | /** |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @since 1.0 |
350 | 350 | */ |
351 | - do_action( 'give_reports_tab_export_content_top' ); |
|
351 | + do_action('give_reports_tab_export_content_top'); |
|
352 | 352 | ?> |
353 | 353 | |
354 | 354 | <table class="widefat export-options-table give-table"> |
355 | 355 | <thead> |
356 | 356 | <tr> |
357 | - <th scope="col"><?php esc_html_e( 'Export Type', 'give' ); ?></th> |
|
358 | - <th scope="col"><?php esc_html_e( 'Export Options', 'give' ); ?></th> |
|
357 | + <th scope="col"><?php esc_html_e('Export Type', 'give'); ?></th> |
|
358 | + <th scope="col"><?php esc_html_e('Export Options', 'give'); ?></th> |
|
359 | 359 | </tr> |
360 | 360 | </thead> |
361 | 361 | <tbody> |
@@ -367,41 +367,41 @@ discard block |
||
367 | 367 | * |
368 | 368 | * @since 1.0 |
369 | 369 | */ |
370 | - do_action( 'give_reports_tab_export_table_top' ); |
|
370 | + do_action('give_reports_tab_export_table_top'); |
|
371 | 371 | ?> |
372 | 372 | <tr class="give-export-pdf-sales-earnings"> |
373 | 373 | <td scope="row" class="row-title"> |
374 | - <h3><span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3> |
|
375 | - <p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
374 | + <h3><span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span></h3> |
|
375 | + <p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
376 | 376 | </td> |
377 | 377 | <td> |
378 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php esc_html_e( 'Generate PDF', 'give' ); ?></a> |
|
378 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php esc_html_e('Generate PDF', 'give'); ?></a> |
|
379 | 379 | </td> |
380 | 380 | </tr> |
381 | 381 | <tr class="alternate give-export-sales-earnings"> |
382 | 382 | <td scope="row" class="row-title"> |
383 | - <h3><span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span></h3> |
|
384 | - <p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
383 | + <h3><span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span></h3> |
|
384 | + <p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
385 | 385 | </td> |
386 | 386 | <td> |
387 | 387 | <form method="post"> |
388 | 388 | <?php |
389 | 389 | printf( |
390 | 390 | /* translators: 1: start date dropdown 2: end date dropdown */ |
391 | - esc_html__( '%1$s to %2$s', 'give' ), |
|
392 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
393 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
391 | + esc_html__('%1$s to %2$s', 'give'), |
|
392 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
393 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
394 | 394 | ); |
395 | 395 | ?> |
396 | 396 | <input type="hidden" name="give-action" value="earnings_export"/> |
397 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
397 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
398 | 398 | </form> |
399 | 399 | </td> |
400 | 400 | </tr> |
401 | 401 | <tr class="give-export-payment-history"> |
402 | 402 | <td scope="row" class="row-title"> |
403 | - <h3><span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span></h3> |
|
404 | - <p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
403 | + <h3><span><?php esc_html_e('Export Donation History', 'give'); ?></span></h3> |
|
404 | + <p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
405 | 405 | </td> |
406 | 406 | <td> |
407 | 407 | <form id="give-export-payments" class="give-export-form" method="post"> |
@@ -409,29 +409,29 @@ discard block |
||
409 | 409 | $args = array( |
410 | 410 | 'id' => 'give-payment-export-start', |
411 | 411 | 'name' => 'start', |
412 | - 'placeholder' => esc_attr__( 'Start date', 'give' ) |
|
412 | + 'placeholder' => esc_attr__('Start date', 'give') |
|
413 | 413 | ); |
414 | - echo Give()->html->date_field( $args ); ?> |
|
414 | + echo Give()->html->date_field($args); ?> |
|
415 | 415 | <?php |
416 | 416 | $args = array( |
417 | 417 | 'id' => 'give-payment-export-end', |
418 | 418 | 'name' => 'end', |
419 | - 'placeholder' => esc_attr__( 'End date', 'give' ) |
|
419 | + 'placeholder' => esc_attr__('End date', 'give') |
|
420 | 420 | ); |
421 | - echo Give()->html->date_field( $args ); ?> |
|
421 | + echo Give()->html->date_field($args); ?> |
|
422 | 422 | <select name="status"> |
423 | - <option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option> |
|
423 | + <option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option> |
|
424 | 424 | <?php |
425 | 425 | $statuses = give_get_payment_statuses(); |
426 | - foreach ( $statuses as $status => $label ) { |
|
427 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
426 | + foreach ($statuses as $status => $label) { |
|
427 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
428 | 428 | } |
429 | 429 | ?> |
430 | 430 | </select> |
431 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
431 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
432 | 432 | <input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/> |
433 | 433 | <span> |
434 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
434 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
435 | 435 | <span class="spinner"></span> |
436 | 436 | </span> |
437 | 437 | </form> |
@@ -439,8 +439,8 @@ discard block |
||
439 | 439 | </tr> |
440 | 440 | <tr class="alternate give-export-donors"> |
441 | 441 | <td scope="row" class="row-title"> |
442 | - <h3><span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span></h3> |
|
443 | - <p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p> |
|
442 | + <h3><span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span></h3> |
|
443 | + <p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p> |
|
444 | 444 | </td> |
445 | 445 | <td> |
446 | 446 | <form method="post" id="give_donor_export" class="give-export-form"> |
@@ -451,44 +451,44 @@ discard block |
||
451 | 451 | 'id' => 'give_customer_export_form', |
452 | 452 | 'chosen' => true |
453 | 453 | ); |
454 | - echo Give()->html->forms_dropdown( $args ); ?> |
|
454 | + echo Give()->html->forms_dropdown($args); ?> |
|
455 | 455 | |
456 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
456 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
457 | 457 | |
458 | 458 | <div id="export-donor-options-wrap" class="give-clearfix"> |
459 | - <p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p> |
|
459 | + <p><?php esc_html_e('Export Columns:', 'give'); ?></p> |
|
460 | 460 | <ul id="give-export-option-ul"> |
461 | 461 | <li> |
462 | - <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?> |
|
462 | + <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?> |
|
463 | 463 | </label> |
464 | 464 | </li> |
465 | 465 | <li> |
466 | - <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?> |
|
466 | + <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e('Email', 'give'); ?> |
|
467 | 467 | </label> |
468 | 468 | </li> |
469 | 469 | <li> |
470 | - <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?> |
|
470 | + <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e('Address', 'give'); ?> |
|
471 | 471 | </label> |
472 | 472 | </li> |
473 | 473 | <li> |
474 | - <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?> |
|
474 | + <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?> |
|
475 | 475 | </label> |
476 | 476 | </li> |
477 | 477 | <li> |
478 | - <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?> |
|
478 | + <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?> |
|
479 | 479 | </label> |
480 | 480 | </li> |
481 | 481 | <li> |
482 | - <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?> |
|
482 | + <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?> |
|
483 | 483 | </label> |
484 | 484 | </li> |
485 | 485 | <li> |
486 | - <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?> |
|
486 | + <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?> |
|
487 | 487 | </label> |
488 | 488 | </li> |
489 | 489 | </ul> |
490 | 490 | </div> |
491 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
491 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
492 | 492 | <input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/> |
493 | 493 | <input type="hidden" name="give-action" value="email_export"/> |
494 | 494 | </form> |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | * |
503 | 503 | * @since 1.0 |
504 | 504 | */ |
505 | - do_action( 'give_reports_tab_export_table_bottom' ); |
|
505 | + do_action('give_reports_tab_export_table_bottom'); |
|
506 | 506 | ?> |
507 | 507 | </tbody> |
508 | 508 | </table> |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | * |
514 | 514 | * @since 1.0 |
515 | 515 | */ |
516 | - do_action( 'give_reports_tab_export_content_bottom' ); |
|
516 | + do_action('give_reports_tab_export_content_bottom'); |
|
517 | 517 | ?> |
518 | 518 | |
519 | 519 | </div> |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | <?php |
525 | 525 | } |
526 | 526 | |
527 | -add_action( 'give_reports_tab_export', 'give_reports_tab_export' ); |
|
527 | +add_action('give_reports_tab_export', 'give_reports_tab_export'); |
|
528 | 528 | |
529 | 529 | /** |
530 | 530 | * Renders the Reports page |
@@ -534,12 +534,12 @@ discard block |
||
534 | 534 | */ |
535 | 535 | function give_reports_tab_logs() { |
536 | 536 | |
537 | - require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' ); |
|
537 | + require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php'); |
|
538 | 538 | |
539 | 539 | $current_view = 'sales'; |
540 | 540 | $log_views = give_log_default_views(); |
541 | 541 | |
542 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) { |
|
542 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) { |
|
543 | 543 | $current_view = $_GET['view']; |
544 | 544 | } |
545 | 545 | |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * |
549 | 549 | * @since 1.0 |
550 | 550 | */ |
551 | - do_action( "give_logs_view_{$current_view}" ); |
|
551 | + do_action("give_logs_view_{$current_view}"); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | /** |
@@ -559,9 +559,9 @@ discard block |
||
559 | 559 | */ |
560 | 560 | function give_estimated_monthly_stats() { |
561 | 561 | |
562 | - $estimated = get_transient( 'give_estimated_monthly_stats' ); |
|
562 | + $estimated = get_transient('give_estimated_monthly_stats'); |
|
563 | 563 | |
564 | - if ( false === $estimated ) { |
|
564 | + if (false === $estimated) { |
|
565 | 565 | |
566 | 566 | $estimated = array( |
567 | 567 | 'earnings' => 0, |
@@ -570,20 +570,20 @@ discard block |
||
570 | 570 | |
571 | 571 | $stats = new Give_Payment_Stats; |
572 | 572 | |
573 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
574 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
573 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
574 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
575 | 575 | |
576 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
577 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
578 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
579 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
576 | + $current_day = date('d', current_time('timestamp')); |
|
577 | + $current_month = date('n', current_time('timestamp')); |
|
578 | + $current_year = date('Y', current_time('timestamp')); |
|
579 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
580 | 580 | |
581 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
582 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
581 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
582 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
583 | 583 | |
584 | 584 | // Cache for one day |
585 | - set_transient( 'give_estimated_monthly_stats', $estimated, 86400 ); |
|
585 | + set_transient('give_estimated_monthly_stats', $estimated, 86400); |
|
586 | 586 | } |
587 | 587 | |
588 | - return maybe_unserialize( $estimated ); |
|
588 | + return maybe_unserialize($estimated); |
|
589 | 589 | } |
@@ -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,7 +23,7 @@ discard block |
||
23 | 23 | * @return void |
24 | 24 | */ |
25 | 25 | function give_logs_view_sales() { |
26 | - include( dirname( __FILE__ ) . '/class-sales-logs-list-table.php' ); |
|
26 | + include(dirname(__FILE__).'/class-sales-logs-list-table.php'); |
|
27 | 27 | |
28 | 28 | $logs_table = new Give_Sales_Log_Table(); |
29 | 29 | $logs_table->prepare_items(); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | } |
33 | 33 | |
34 | -add_action( 'give_logs_view_sales', 'give_logs_view_sales' ); |
|
34 | +add_action('give_logs_view_sales', 'give_logs_view_sales'); |
|
35 | 35 | |
36 | 36 | |
37 | 37 | /** |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | * @return void |
44 | 44 | */ |
45 | 45 | function give_logs_view_gateway_errors() { |
46 | - include( dirname( __FILE__ ) . '/class-gateway-error-logs-list-table.php' ); |
|
46 | + include(dirname(__FILE__).'/class-gateway-error-logs-list-table.php'); |
|
47 | 47 | |
48 | 48 | $logs_table = new Give_Gateway_Error_Log_Table(); |
49 | 49 | $logs_table->prepare_items(); |
50 | 50 | $logs_table->display(); |
51 | 51 | } |
52 | 52 | |
53 | -add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' ); |
|
53 | +add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors'); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * API Request Logs |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @return void |
63 | 63 | */ |
64 | 64 | function give_logs_view_api_requests() { |
65 | - include( dirname( __FILE__ ) . '/class-api-requests-logs-list-table.php' ); |
|
65 | + include(dirname(__FILE__).'/class-api-requests-logs-list-table.php'); |
|
66 | 66 | |
67 | 67 | $logs_table = new Give_API_Request_Log_Table(); |
68 | 68 | $logs_table->prepare_items(); |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @since 1.0 |
77 | 77 | */ |
78 | - do_action( 'give_logs_api_requests_top' ); |
|
78 | + do_action('give_logs_api_requests_top'); |
|
79 | 79 | ?> |
80 | 80 | |
81 | 81 | <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs'; ?>"> |
82 | 82 | <?php |
83 | - $logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' ); |
|
83 | + $logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests'); |
|
84 | 84 | $logs_table->display(); |
85 | 85 | ?> |
86 | 86 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @since 1.0 |
95 | 95 | */ |
96 | - do_action( 'give_logs_api_requests_bottom' ); |
|
96 | + do_action('give_logs_api_requests_bottom'); |
|
97 | 97 | ?> |
98 | 98 | |
99 | 99 | </div> |
100 | 100 | <?php |
101 | 101 | } |
102 | 102 | |
103 | -add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' ); |
|
103 | +add_action('give_logs_view_api_requests', 'give_logs_view_api_requests'); |
|
104 | 104 | |
105 | 105 | |
106 | 106 | /** |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | */ |
112 | 112 | function give_log_default_views() { |
113 | 113 | $views = array( |
114 | - 'sales' => esc_html__( 'Donations', 'give' ), |
|
115 | - 'gateway_errors' => esc_html__( 'Payment Errors', 'give' ), |
|
116 | - 'api_requests' => esc_html__( 'API Requests', 'give' ) |
|
114 | + 'sales' => esc_html__('Donations', 'give'), |
|
115 | + 'gateway_errors' => esc_html__('Payment Errors', 'give'), |
|
116 | + 'api_requests' => esc_html__('API Requests', 'give') |
|
117 | 117 | ); |
118 | 118 | |
119 | - $views = apply_filters( 'give_log_views', $views ); |
|
119 | + $views = apply_filters('give_log_views', $views); |
|
120 | 120 | |
121 | 121 | return $views; |
122 | 122 | } |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | */ |
130 | 130 | function give_log_views() { |
131 | 131 | $views = give_log_default_views(); |
132 | - $current_view = isset( $_GET['view'] ) && array_key_exists( $_GET['view'], give_log_default_views() ) ? sanitize_text_field( $_GET['view'] ) : 'sales'; |
|
132 | + $current_view = isset($_GET['view']) && array_key_exists($_GET['view'], give_log_default_views()) ? sanitize_text_field($_GET['view']) : 'sales'; |
|
133 | 133 | ?> |
134 | 134 | <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs'; ?>"> |
135 | 135 | <select id="give-logs-view" name="view"> |
136 | 136 | <optgroup label="Log Type:"> |
137 | - <?php foreach ( $views as $view_id => $label ): ?> |
|
138 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
137 | + <?php foreach ($views as $view_id => $label): ?> |
|
138 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
139 | 139 | <?php endforeach; ?> |
140 | 140 | </optgroup> |
141 | 141 | </select> |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @since 1.0 |
150 | 150 | */ |
151 | - do_action( 'give_log_view_actions' ); |
|
151 | + do_action('give_log_view_actions'); |
|
152 | 152 | ?> |
153 | 153 | |
154 | 154 | <input type="hidden" name="post_type" value="give_forms"/> |
155 | 155 | <input type="hidden" name="page" value="give-tools"/> |
156 | 156 | <input type="hidden" name="tab" value="logs"/> |
157 | 157 | |
158 | - <?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?> |
|
158 | + <?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?> |
|
159 | 159 | </form> |
160 | 160 | <?php |
161 | 161 | } |
162 | 162 | \ No newline at end of file |
@@ -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 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_tools_recount_stats_display() { |
24 | 24 | |
25 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
25 | + if ( ! current_user_can('manage_give_settings')) { |
|
26 | 26 | return; |
27 | 27 | } |
28 | 28 | |
@@ -31,27 +31,27 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @since 1.5 |
33 | 33 | */ |
34 | - do_action( 'give_tools_recount_stats_before' ); |
|
34 | + do_action('give_tools_recount_stats_before'); |
|
35 | 35 | ?> |
36 | 36 | <div id="poststuff"> |
37 | 37 | <div class="postbox"> |
38 | 38 | |
39 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
39 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
40 | 40 | |
41 | 41 | <div class="inside recount-stats-controls"> |
42 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
42 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
43 | 43 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
44 | 44 | |
45 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
45 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
46 | 46 | |
47 | 47 | <select name="give-export-class" id="recount-stats-type"> |
48 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
49 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
50 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
51 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
52 | - <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
53 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Transactions', 'give' ); ?></option> |
|
54 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
48 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
49 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
50 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
51 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
52 | + <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
53 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Transactions', 'give'); ?></option> |
|
54 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
55 | 55 | <?php |
56 | 56 | /** |
57 | 57 | * Fires in the recount stats selectbox. |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @since 1.5 |
62 | 62 | */ |
63 | - do_action( 'give_recount_tool_options' ); |
|
63 | + do_action('give_recount_tool_options'); |
|
64 | 64 | ?> |
65 | 65 | </select> |
66 | 66 | |
@@ -68,22 +68,22 @@ discard block |
||
68 | 68 | <?php |
69 | 69 | $args = array( |
70 | 70 | 'name' => 'form_id', |
71 | - 'number' => - 1, |
|
71 | + 'number' => -1, |
|
72 | 72 | 'chosen' => true, |
73 | 73 | ); |
74 | - echo Give()->html->forms_dropdown( $args ); |
|
74 | + echo Give()->html->forms_dropdown($args); |
|
75 | 75 | ?> |
76 | 76 | </span> |
77 | 77 | |
78 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
78 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
79 | 79 | |
80 | 80 | <br/> |
81 | 81 | |
82 | 82 | <span class="give-recount-stats-descriptions"> |
83 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
84 | - <span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span> |
|
85 | - <span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
|
86 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
83 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
84 | + <span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span> |
|
85 | + <span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span> |
|
86 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
87 | 87 | <?php |
88 | 88 | /** |
89 | 89 | * Fires in the recount stats description area. |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @since 1.5 |
94 | 94 | */ |
95 | - do_action( 'give_recount_tool_descriptions' ); |
|
95 | + do_action('give_recount_tool_descriptions'); |
|
96 | 96 | ?> |
97 | - <span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
|
98 | - <span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
97 | + <span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span> |
|
98 | + <span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
99 | 99 | </span> |
100 | 100 | |
101 | 101 | <span class="spinner"></span> |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @since 1.5 |
111 | 111 | */ |
112 | - do_action( 'give_tools_recount_forms' ); |
|
112 | + do_action('give_tools_recount_forms'); |
|
113 | 113 | ?> |
114 | 114 | </div><!-- .inside --> |
115 | 115 | </div><!-- .postbox --> |
@@ -120,5 +120,5 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @since 1.5 |
122 | 122 | */ |
123 | - do_action( 'give_tools_recount_stats_after' ); |
|
123 | + do_action('give_tools_recount_stats_after'); |
|
124 | 124 | } |
125 | 125 | \ No newline at end of file |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; // Exit if accessed directly |
13 | 13 | } |
14 | 14 | |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | * @param $field |
21 | 21 | * @return bool|string |
22 | 22 | */ |
23 | -function give_is_field_callback_exist( $field ) { |
|
24 | - return ( give_get_field_callback( $field ) ? true : false ); |
|
23 | +function give_is_field_callback_exist($field) { |
|
24 | + return (give_get_field_callback($field) ? true : false); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | * @param $field |
32 | 32 | * @return bool|string |
33 | 33 | */ |
34 | -function give_get_field_callback( $field ){ |
|
34 | +function give_get_field_callback($field) { |
|
35 | 35 | $func_name_prefix = 'give'; |
36 | 36 | $func_name = ''; |
37 | 37 | |
38 | 38 | // Set callback function on basis of cmb2 field name. |
39 | - switch( $field['type'] ) { |
|
39 | + switch ($field['type']) { |
|
40 | 40 | case 'radio_inline': |
41 | - $func_name = "{$func_name_prefix}_radio"; |
|
41 | + $func_name = "{$func_name_prefix}_radio"; |
|
42 | 42 | break; |
43 | 43 | |
44 | 44 | case 'text': |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | break; |
56 | 56 | |
57 | 57 | case 'colorpicker' : |
58 | - $func_name = "{$func_name_prefix}_{$field['type']}"; |
|
58 | + $func_name = "{$func_name_prefix}_{$field['type']}"; |
|
59 | 59 | break; |
60 | 60 | |
61 | 61 | case 'levels_id': |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | $func_name = "{$func_name_prefix}_{$field['type']}"; |
75 | 75 | } |
76 | 76 | |
77 | - $func_name = apply_filters( 'give_setting_callback', $func_name, $field ); |
|
77 | + $func_name = apply_filters('give_setting_callback', $func_name, $field); |
|
78 | 78 | |
79 | 79 | // Check if render callback exist or not. |
80 | - if ( ! function_exists( "$func_name" ) || empty( $func_name ) ){ |
|
80 | + if ( ! function_exists("$func_name") || empty($func_name)) { |
|
81 | 81 | return false; |
82 | 82 | } |
83 | 83 | |
84 | - return apply_filters( 'give_setting_callback', $func_name, $field ); |
|
84 | + return apply_filters('give_setting_callback', $func_name, $field); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -91,37 +91,37 @@ discard block |
||
91 | 91 | * @param array $field Field argument array. |
92 | 92 | * @return bool |
93 | 93 | */ |
94 | -function give_render_field( $field ) { |
|
95 | - $func_name = give_get_field_callback( $field ); |
|
94 | +function give_render_field($field) { |
|
95 | + $func_name = give_get_field_callback($field); |
|
96 | 96 | |
97 | 97 | // Check if render callback exist or not. |
98 | - if ( ! $func_name ){ |
|
98 | + if ( ! $func_name) { |
|
99 | 99 | return false; |
100 | 100 | } |
101 | 101 | |
102 | 102 | // CMB2 compatibility: Push all classes to attributes's class key |
103 | - if( empty( $field['class'] ) ) { |
|
103 | + if (empty($field['class'])) { |
|
104 | 104 | $field['class'] = ''; |
105 | 105 | } |
106 | 106 | |
107 | - if( empty( $field['attributes']['class'] ) ) { |
|
107 | + if (empty($field['attributes']['class'])) { |
|
108 | 108 | $field['attributes']['class'] = ''; |
109 | 109 | } |
110 | 110 | |
111 | - $field['attributes']['class'] = trim( "give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}" ); |
|
112 | - unset( $field['class'] ); |
|
111 | + $field['attributes']['class'] = trim("give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}"); |
|
112 | + unset($field['class']); |
|
113 | 113 | |
114 | 114 | |
115 | 115 | // CMB2 compatibility: Set wrapper class if any. |
116 | - if( ! empty( $field['row_classes'] ) ) { |
|
116 | + if ( ! empty($field['row_classes'])) { |
|
117 | 117 | $field['wrapper_class'] = $field['row_classes']; |
118 | - unset( $field['row_classes'] ); |
|
118 | + unset($field['row_classes']); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | // Set field params on basis of cmb2 field name. |
122 | - switch( $field['type'] ) { |
|
122 | + switch ($field['type']) { |
|
123 | 123 | case 'radio_inline': |
124 | - if( empty( $field['wrapper_class'] ) ) { |
|
124 | + if (empty($field['wrapper_class'])) { |
|
125 | 125 | $field['wrapper_class'] = ''; |
126 | 126 | } |
127 | 127 | $field['wrapper_class'] .= ' give-inline-radio-fields'; |
@@ -134,15 +134,15 @@ discard block |
||
134 | 134 | case 'text-small' : |
135 | 135 | case 'text_small' : |
136 | 136 | // CMB2 compatibility: Set field type to text. |
137 | - $field['type'] = isset( $field['attributes']['type'] ) ? $field['attributes']['type'] : 'text'; |
|
137 | + $field['type'] = isset($field['attributes']['type']) ? $field['attributes']['type'] : 'text'; |
|
138 | 138 | |
139 | 139 | // CMB2 compatibility: Set data type to price. |
140 | - if( |
|
141 | - empty( $field['data_type'] ) |
|
142 | - && ! empty( $field['attributes']['class'] ) |
|
140 | + if ( |
|
141 | + empty($field['data_type']) |
|
142 | + && ! empty($field['attributes']['class']) |
|
143 | 143 | && ( |
144 | - false !== strpos( $field['attributes']['class'], 'money' ) |
|
145 | - || false !== strpos( $field['attributes']['class'], 'amount' ) |
|
144 | + false !== strpos($field['attributes']['class'], 'money') |
|
145 | + || false !== strpos($field['attributes']['class'], 'amount') |
|
146 | 146 | ) |
147 | 147 | ) { |
148 | 148 | $field['data_type'] = 'decimal'; |
@@ -161,19 +161,19 @@ discard block |
||
161 | 161 | case 'give_default_radio_inline': |
162 | 162 | $field['type'] = 'radio'; |
163 | 163 | $field['options'] = array( |
164 | - 'default' => __( 'Default') |
|
164 | + 'default' => __('Default') |
|
165 | 165 | ); |
166 | 166 | break; |
167 | 167 | } |
168 | 168 | |
169 | 169 | // CMB2 compatibility: Add support to define field description by desc & description param. |
170 | 170 | // We encourage you to use description param. |
171 | - $field['description'] = ( ! empty( $field['description'] ) |
|
171 | + $field['description'] = ( ! empty($field['description']) |
|
172 | 172 | ? $field['description'] |
173 | - : ( ! empty( $field['desc'] ) ? $field['desc'] : '' ) ); |
|
173 | + : ( ! empty($field['desc']) ? $field['desc'] : '')); |
|
174 | 174 | |
175 | 175 | // Call render function. |
176 | - $func_name( $field ); |
|
176 | + $func_name($field); |
|
177 | 177 | |
178 | 178 | return true; |
179 | 179 | } |
@@ -200,29 +200,29 @@ discard block |
||
200 | 200 | * } |
201 | 201 | * @return void |
202 | 202 | */ |
203 | -function give_text_input( $field ) { |
|
203 | +function give_text_input($field) { |
|
204 | 204 | global $thepostid, $post; |
205 | 205 | |
206 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
207 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
208 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
209 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
210 | - $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text'; |
|
206 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
207 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
208 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
209 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
210 | + $field['type'] = isset($field['type']) ? $field['type'] : 'text'; |
|
211 | 211 | $field['before_field'] = ''; |
212 | 212 | $field['after_field'] = ''; |
213 | - $data_type = empty( $field['data_type'] ) ? '' : $field['data_type']; |
|
213 | + $data_type = empty($field['data_type']) ? '' : $field['data_type']; |
|
214 | 214 | |
215 | - switch ( $data_type ) { |
|
215 | + switch ($data_type) { |
|
216 | 216 | case 'price' : |
217 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_amount( $field['value'] ) : $field['value'] ); |
|
217 | + $field['value'] = ( ! empty($field['value']) ? give_format_amount($field['value']) : $field['value']); |
|
218 | 218 | |
219 | - $field['before_field'] = ! empty( $field['before_field'] ) ? $field['before_field'] : ( give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' ); |
|
220 | - $field['after_field'] = ! empty( $field['after_field'] ) ? $field['after_field'] : ( give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' ); |
|
219 | + $field['before_field'] = ! empty($field['before_field']) ? $field['before_field'] : (give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : ''); |
|
220 | + $field['after_field'] = ! empty($field['after_field']) ? $field['after_field'] : (give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : ''); |
|
221 | 221 | break; |
222 | 222 | |
223 | 223 | case 'decimal' : |
224 | 224 | $field['attributes']['class'] .= ' give_input_decimal'; |
225 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( $field['value'] ) : $field['value'] ); |
|
225 | + $field['value'] = ( ! empty($field['value']) ? give_format_decimal($field['value']) : $field['value']); |
|
226 | 226 | break; |
227 | 227 | |
228 | 228 | default : |
@@ -232,17 +232,17 @@ discard block |
||
232 | 232 | // Custom attribute handling |
233 | 233 | $custom_attributes = array(); |
234 | 234 | |
235 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
235 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
236 | 236 | |
237 | - foreach ( $field['attributes'] as $attribute => $value ){ |
|
238 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
237 | + foreach ($field['attributes'] as $attribute => $value) { |
|
238 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
239 | 239 | } |
240 | 240 | } |
241 | 241 | |
242 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label>' . $field['before_field'] . '<input type="' . esc_attr( $field['type'] ) . '" style="' . esc_attr( $field['style'] ) . '" name="' . give_get_field_name( $field ) . '" id="' . esc_attr( $field['id'] ) . '" value="' . esc_attr( $field['value'] ) . '" ' . implode( ' ', $custom_attributes ) . ' />' . $field['after_field']; |
|
242 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label>'.$field['before_field'].'<input type="'.esc_attr($field['type']).'" style="'.esc_attr($field['style']).'" name="'.give_get_field_name($field).'" id="'.esc_attr($field['id']).'" value="'.esc_attr($field['value']).'" '.implode(' ', $custom_attributes).' />'.$field['after_field']; |
|
243 | 243 | |
244 | - if ( ! empty( $field['description'] ) ) { |
|
245 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
244 | + if ( ! empty($field['description'])) { |
|
245 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
246 | 246 | } |
247 | 247 | echo '</p>'; |
248 | 248 | } |
@@ -263,23 +263,23 @@ discard block |
||
263 | 263 | * } |
264 | 264 | * @return void |
265 | 265 | */ |
266 | -function give_hidden_input( $field ) { |
|
266 | +function give_hidden_input($field) { |
|
267 | 267 | global $thepostid, $post; |
268 | 268 | |
269 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
270 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
269 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
270 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
271 | 271 | |
272 | 272 | // Custom attribute handling |
273 | 273 | $custom_attributes = array(); |
274 | 274 | |
275 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
275 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
276 | 276 | |
277 | - foreach ( $field['attributes'] as $attribute => $value ){ |
|
278 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
277 | + foreach ($field['attributes'] as $attribute => $value) { |
|
278 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | |
282 | - echo '<input type="hidden" name="' . give_get_field_name( $field ) . '" id="' . esc_attr( $field['id'] ) . '" value="' . esc_attr( $field['value'] ) . '" ' . implode( ' ', $custom_attributes ) .'/> '; |
|
282 | + echo '<input type="hidden" name="'.give_get_field_name($field).'" id="'.esc_attr($field['id']).'" value="'.esc_attr($field['value']).'" '.implode(' ', $custom_attributes).'/> '; |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
@@ -301,28 +301,28 @@ discard block |
||
301 | 301 | * } |
302 | 302 | * @return void |
303 | 303 | */ |
304 | -function give_textarea_input( $field ) { |
|
304 | +function give_textarea_input($field) { |
|
305 | 305 | global $thepostid, $post; |
306 | 306 | |
307 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
308 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
309 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
310 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
307 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
308 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
309 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
310 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
311 | 311 | |
312 | 312 | // Custom attribute handling |
313 | 313 | $custom_attributes = array(); |
314 | 314 | |
315 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
315 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
316 | 316 | |
317 | - foreach ( $field['attributes'] as $attribute => $value ){ |
|
318 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
317 | + foreach ($field['attributes'] as $attribute => $value) { |
|
318 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
322 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label><textarea style="' . esc_attr( $field['style'] ) . '" name="' . give_get_field_name( $field ) . '" id="' . esc_attr( $field['id'] ) . '" rows="10" cols="20" ' . implode( ' ', $custom_attributes ) . '>' . esc_textarea( $field['value'] ) . '</textarea> '; |
|
322 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label><textarea style="'.esc_attr($field['style']).'" name="'.give_get_field_name($field).'" id="'.esc_attr($field['id']).'" rows="10" cols="20" '.implode(' ', $custom_attributes).'>'.esc_textarea($field['value']).'</textarea> '; |
|
323 | 323 | |
324 | - if ( ! empty( $field['description'] ) ) { |
|
325 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
324 | + if ( ! empty($field['description'])) { |
|
325 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
326 | 326 | } |
327 | 327 | echo '</p>'; |
328 | 328 | } |
@@ -345,43 +345,43 @@ discard block |
||
345 | 345 | * } |
346 | 346 | * @return void |
347 | 347 | */ |
348 | -function give_wysiwyg( $field ) { |
|
348 | +function give_wysiwyg($field) { |
|
349 | 349 | global $thepostid, $post; |
350 | 350 | |
351 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
352 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
353 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
354 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
351 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
352 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
353 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
354 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
355 | 355 | |
356 | 356 | // Custom attribute handling |
357 | 357 | $custom_attributes = array(); |
358 | 358 | |
359 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
360 | - foreach ( $field['attributes'] as $attribute => $value ){ |
|
361 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
359 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
360 | + foreach ($field['attributes'] as $attribute => $value) { |
|
361 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
365 | 365 | // Add backward compatibility to cmb2 attributes. |
366 | 366 | $custom_attributes = array_merge( |
367 | 367 | array( |
368 | - 'textarea_name' => esc_attr( $field['id'] ), |
|
368 | + 'textarea_name' => esc_attr($field['id']), |
|
369 | 369 | 'textarea_rows' => '10', |
370 | - 'editor_css' => esc_attr( $field['style'] ), |
|
370 | + 'editor_css' => esc_attr($field['style']), |
|
371 | 371 | ), |
372 | 372 | $custom_attributes |
373 | 373 | ); |
374 | 374 | |
375 | - echo '<div class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label>'; |
|
375 | + echo '<div class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label>'; |
|
376 | 376 | |
377 | 377 | wp_editor( |
378 | 378 | $field['value'], |
379 | - give_get_field_name( $field ), |
|
379 | + give_get_field_name($field), |
|
380 | 380 | $custom_attributes |
381 | 381 | ); |
382 | 382 | |
383 | - if ( ! empty( $field['description'] ) ) { |
|
384 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
383 | + if ( ! empty($field['description'])) { |
|
384 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
385 | 385 | } |
386 | 386 | echo '</div>'; |
387 | 387 | } |
@@ -405,30 +405,30 @@ discard block |
||
405 | 405 | * } |
406 | 406 | * @return void |
407 | 407 | */ |
408 | -function give_checkbox( $field ) { |
|
408 | +function give_checkbox($field) { |
|
409 | 409 | global $thepostid, $post; |
410 | 410 | |
411 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
412 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
413 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
414 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
415 | - $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'on'; |
|
416 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
411 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
412 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
413 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
414 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
415 | + $field['cbvalue'] = isset($field['cbvalue']) ? $field['cbvalue'] : 'on'; |
|
416 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
417 | 417 | |
418 | 418 | // Custom attribute handling. |
419 | 419 | $custom_attributes = array(); |
420 | 420 | |
421 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
421 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
422 | 422 | |
423 | - foreach ( $field['attributes'] as $attribute => $value ){ |
|
424 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
423 | + foreach ($field['attributes'] as $attribute => $value) { |
|
424 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
425 | 425 | } |
426 | 426 | } |
427 | 427 | |
428 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label><input type="checkbox" style="' . esc_attr( $field['style'] ) . '" name="' . give_get_field_name( $field ) . '" id="' . esc_attr( $field['id'] ) . '" value="' . esc_attr( $field['cbvalue'] ) . '" ' . checked( $field['value'], $field['cbvalue'], false ) . ' ' . implode( ' ', $custom_attributes ) . '/> '; |
|
428 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label><input type="checkbox" style="'.esc_attr($field['style']).'" name="'.give_get_field_name($field).'" id="'.esc_attr($field['id']).'" value="'.esc_attr($field['cbvalue']).'" '.checked($field['value'], $field['cbvalue'], false).' '.implode(' ', $custom_attributes).'/> '; |
|
429 | 429 | |
430 | - if ( ! empty( $field['description'] ) ) { |
|
431 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
430 | + if ( ! empty($field['description'])) { |
|
431 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | echo '</p>'; |
@@ -454,35 +454,35 @@ discard block |
||
454 | 454 | * } |
455 | 455 | * @return void |
456 | 456 | */ |
457 | -function give_select( $field ) { |
|
457 | +function give_select($field) { |
|
458 | 458 | global $thepostid, $post; |
459 | 459 | |
460 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
461 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
462 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
463 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
464 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
460 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
461 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
462 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
463 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
464 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
465 | 465 | |
466 | 466 | // Custom attribute handling |
467 | 467 | $custom_attributes = array(); |
468 | 468 | |
469 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
469 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
470 | 470 | |
471 | - foreach ( $field['attributes'] as $attribute => $value ){ |
|
472 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
471 | + foreach ($field['attributes'] as $attribute => $value) { |
|
472 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
473 | 473 | } |
474 | 474 | } |
475 | 475 | |
476 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label><select id="' . esc_attr( $field['id'] ) . '" name="' . give_get_field_name( $field ) . '" style="' . esc_attr( $field['style'] ) . '" ' . implode( ' ', $custom_attributes ) . '>'; |
|
476 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label><select id="'.esc_attr($field['id']).'" name="'.give_get_field_name($field).'" style="'.esc_attr($field['style']).'" '.implode(' ', $custom_attributes).'>'; |
|
477 | 477 | |
478 | - foreach ( $field['options'] as $key => $value ) { |
|
479 | - echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>'; |
|
478 | + foreach ($field['options'] as $key => $value) { |
|
479 | + echo '<option value="'.esc_attr($key).'" '.selected(esc_attr($field['value']), esc_attr($key), false).'>'.esc_html($value).'</option>'; |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | echo '</select> '; |
483 | 483 | |
484 | - if ( ! empty( $field['description'] ) ) { |
|
485 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
484 | + if ( ! empty($field['description'])) { |
|
485 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
486 | 486 | } |
487 | 487 | echo '</p>'; |
488 | 488 | } |
@@ -507,43 +507,43 @@ discard block |
||
507 | 507 | * } |
508 | 508 | * @return void |
509 | 509 | */ |
510 | -function give_radio( $field ) { |
|
510 | +function give_radio($field) { |
|
511 | 511 | global $thepostid, $post; |
512 | 512 | |
513 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
514 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
515 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
516 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
517 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
513 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
514 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
515 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
516 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
517 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
518 | 518 | |
519 | 519 | // Custom attribute handling |
520 | 520 | $custom_attributes = array(); |
521 | 521 | |
522 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
522 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
523 | 523 | |
524 | - foreach ( $field['attributes'] as $attribute => $value ){ |
|
525 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
524 | + foreach ($field['attributes'] as $attribute => $value) { |
|
525 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
526 | 526 | } |
527 | 527 | } |
528 | 528 | |
529 | - echo '<fieldset class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><legend>' . wp_kses_post( $field['name'] ) . '</legend><ul class="give-radios">'; |
|
529 | + echo '<fieldset class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><legend>'.wp_kses_post($field['name']).'</legend><ul class="give-radios">'; |
|
530 | 530 | |
531 | - foreach ( $field['options'] as $key => $value ) { |
|
531 | + foreach ($field['options'] as $key => $value) { |
|
532 | 532 | |
533 | 533 | echo '<li><label><input |
534 | - name="' . give_get_field_name( $field ) . '" |
|
535 | - value="' . esc_attr( $key ) . '" |
|
534 | + name="' . give_get_field_name($field).'" |
|
535 | + value="' . esc_attr($key).'" |
|
536 | 536 | type="radio" |
537 | - style="' . esc_attr( $field['style'] ) . '" |
|
538 | - ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
|
539 | - . implode( ' ', $custom_attributes ) . ' |
|
540 | - /> ' . esc_html( $value ) . '</label> |
|
537 | + style="' . esc_attr($field['style']).'" |
|
538 | + ' . checked(esc_attr($field['value']), esc_attr($key), false).' ' |
|
539 | + . implode(' ', $custom_attributes).' |
|
540 | + /> ' . esc_html($value).'</label> |
|
541 | 541 | </li>'; |
542 | 542 | } |
543 | 543 | echo '</ul>'; |
544 | 544 | |
545 | - if ( ! empty( $field['description'] ) ) { |
|
546 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
545 | + if ( ! empty($field['description'])) { |
|
546 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | echo '</fieldset>'; |
@@ -567,30 +567,30 @@ discard block |
||
567 | 567 | * } |
568 | 568 | * @return void |
569 | 569 | */ |
570 | -function give_colorpicker( $field ) { |
|
570 | +function give_colorpicker($field) { |
|
571 | 571 | global $thepostid, $post; |
572 | 572 | |
573 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
574 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
575 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
576 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
577 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
573 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
574 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
575 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
576 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
577 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
578 | 578 | $field['type'] = 'text'; |
579 | 579 | |
580 | 580 | // Custom attribute handling |
581 | 581 | $custom_attributes = array(); |
582 | 582 | |
583 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
583 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
584 | 584 | |
585 | - foreach ( $field['attributes'] as $attribute => $value ){ |
|
586 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
585 | + foreach ($field['attributes'] as $attribute => $value) { |
|
586 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
587 | 587 | } |
588 | 588 | } |
589 | 589 | |
590 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label><input type="' . esc_attr( $field['type'] ) . '" style="' . esc_attr( $field['style'] ) . '" name="' . give_get_field_name( $field ) . '" id="' . esc_attr( $field['id'] ) . '" value="' . esc_attr( $field['value'] ) . '" ' . implode( ' ', $custom_attributes ) . ' /> '; |
|
590 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label><input type="'.esc_attr($field['type']).'" style="'.esc_attr($field['style']).'" name="'.give_get_field_name($field).'" id="'.esc_attr($field['id']).'" value="'.esc_attr($field['value']).'" '.implode(' ', $custom_attributes).' /> '; |
|
591 | 591 | |
592 | - if ( ! empty( $field['description'] ) ) { |
|
593 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
592 | + if ( ! empty($field['description'])) { |
|
593 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
594 | 594 | } |
595 | 595 | echo '</p>'; |
596 | 596 | } |
@@ -602,24 +602,24 @@ discard block |
||
602 | 602 | * @param array $field |
603 | 603 | * @return void |
604 | 604 | */ |
605 | -function give_default_gateway( $field ) { |
|
605 | +function give_default_gateway($field) { |
|
606 | 606 | global $thepostid, $post; |
607 | 607 | |
608 | 608 | // get all active payment gateways. |
609 | - $gateways = give_get_enabled_payment_gateways( $thepostid ); |
|
609 | + $gateways = give_get_enabled_payment_gateways($thepostid); |
|
610 | 610 | |
611 | 611 | // Set field option value. |
612 | - foreach ( $gateways as $key => $option ) { |
|
613 | - $field['options'][ $key ] = $option['admin_label']; |
|
612 | + foreach ($gateways as $key => $option) { |
|
613 | + $field['options'][$key] = $option['admin_label']; |
|
614 | 614 | } |
615 | 615 | |
616 | 616 | //Add a field to the Give Form admin single post view of this field |
617 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
618 | - $field['options'] = array_merge( array( 'global' => esc_html__( 'Global Default', 'give' ) ), $field['options'] ); |
|
617 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
618 | + $field['options'] = array_merge(array('global' => esc_html__('Global Default', 'give')), $field['options']); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | // Render select field. |
622 | - give_select( $field ); |
|
622 | + give_select($field); |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | |
@@ -633,13 +633,13 @@ discard block |
||
633 | 633 | * @param int $postid |
634 | 634 | * @return mixed |
635 | 635 | */ |
636 | -function give_get_field_value( $field, $postid ) { |
|
637 | - if( isset( $field['attributes']['value'] ) ) { |
|
636 | +function give_get_field_value($field, $postid) { |
|
637 | + if (isset($field['attributes']['value'])) { |
|
638 | 638 | return $field['attributes']['value']; |
639 | 639 | } |
640 | 640 | |
641 | 641 | // Get value from db. |
642 | - $field_value = get_post_meta( $postid, $field['id'], true ); |
|
642 | + $field_value = get_post_meta($postid, $field['id'], true); |
|
643 | 643 | |
644 | 644 | /** |
645 | 645 | * Filter the field value before apply default value. |
@@ -647,11 +647,11 @@ discard block |
||
647 | 647 | * @since 1.8 |
648 | 648 | * @param mixed $field_value Field value. |
649 | 649 | */ |
650 | - $field_value = apply_filters( "{$field['id']}_field_value", $field_value, $field, $postid ); |
|
650 | + $field_value = apply_filters("{$field['id']}_field_value", $field_value, $field, $postid); |
|
651 | 651 | |
652 | 652 | |
653 | 653 | // Set default value if no any data saved to db. |
654 | - if( ! $field_value && isset( $field['default'] )) { |
|
654 | + if ( ! $field_value && isset($field['default'])) { |
|
655 | 655 | $field_value = $field['default']; |
656 | 656 | } |
657 | 657 | |
@@ -666,8 +666,8 @@ discard block |
||
666 | 666 | * @param array $field |
667 | 667 | * @return string |
668 | 668 | */ |
669 | -function give_get_field_name( $field ) { |
|
670 | - return esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] ); |
|
669 | +function give_get_field_name($field) { |
|
670 | + return esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']); |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | /** |
@@ -678,11 +678,11 @@ discard block |
||
678 | 678 | * @param array $fields |
679 | 679 | * @return void |
680 | 680 | */ |
681 | -function _give_metabox_form_data_repeater_fields( $fields ) { |
|
681 | +function _give_metabox_form_data_repeater_fields($fields) { |
|
682 | 682 | global $thepostid, $post; |
683 | 683 | |
684 | 684 | // Bailout. |
685 | - if( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) { |
|
685 | + if ( ! isset($fields['fields']) || empty($fields['fields'])) { |
|
686 | 686 | return; |
687 | 687 | } |
688 | 688 | |
@@ -690,11 +690,11 @@ discard block |
||
690 | 690 | <div class="give-repeatable-field-section" id="<?php echo "{$fields['id']}_field"; ?>"> |
691 | 691 | <table class="give-repeatable-fields-section-wrapper" cellspacing="0"> |
692 | 692 | <?php |
693 | - $donation_levels = get_post_meta( $thepostid, $fields['id'], true ); |
|
693 | + $donation_levels = get_post_meta($thepostid, $fields['id'], true); |
|
694 | 694 | |
695 | 695 | // Check if level is not created or we have to add default level. |
696 | - if( is_array( $donation_levels ) && ( $levels_count = count( $donation_levels ) ) ) { |
|
697 | - $donation_levels = array_values( $donation_levels ); |
|
696 | + if (is_array($donation_levels) && ($levels_count = count($donation_levels))) { |
|
697 | + $donation_levels = array_values($donation_levels); |
|
698 | 698 | $set_default_donation_level = false; |
699 | 699 | } else { |
700 | 700 | $levels_count = 1; |
@@ -706,72 +706,72 @@ discard block |
||
706 | 706 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
707 | 707 | <div class="give-row-head give-move"> |
708 | 708 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span></button> |
709 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Donation Level', 'give' ); ?>">-</sapn> |
|
709 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Donation Level', 'give'); ?>">-</sapn> |
|
710 | 710 | <h2> |
711 | - <span><?php esc_html_e( 'Donation Level', 'give' ); ?></span> |
|
711 | + <span><?php esc_html_e('Donation Level', 'give'); ?></span> |
|
712 | 712 | </h2> |
713 | 713 | </div> |
714 | 714 | <div class="give-row-body"> |
715 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
716 | - <?php if ( ! give_is_field_callback_exist( $field ) ) continue; ?> |
|
715 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
716 | + <?php if ( ! give_is_field_callback_exist($field)) continue; ?> |
|
717 | 717 | <?php |
718 | 718 | $field['repeat'] = true; |
719 | - $field['repeatable_field_id'] = ( '_give_id' === $field['id'] ) ? "{$fields['id']}[{{row-count-placeholder}}][{$field['id']}][level_id]" : "{$fields['id']}[{{row-count-placeholder}}][{$field['id']}]"; |
|
720 | - $field['id'] = str_replace( array( '[', ']' ), array( '_', '' ), $field['repeatable_field_id'] ); |
|
719 | + $field['repeatable_field_id'] = ('_give_id' === $field['id']) ? "{$fields['id']}[{{row-count-placeholder}}][{$field['id']}][level_id]" : "{$fields['id']}[{{row-count-placeholder}}][{$field['id']}]"; |
|
720 | + $field['id'] = str_replace(array('[', ']'), array('_', ''), $field['repeatable_field_id']); |
|
721 | 721 | ?> |
722 | - <?php give_render_field( $field ); ?> |
|
722 | + <?php give_render_field($field); ?> |
|
723 | 723 | <?php endforeach; ?> |
724 | 724 | </div> |
725 | 725 | </td> |
726 | 726 | </tr> |
727 | 727 | |
728 | - <?php if( ! empty( $donation_levels ) ) : ?> |
|
729 | - <?php foreach ( $donation_levels as $index => $level ) : ?> |
|
728 | + <?php if ( ! empty($donation_levels)) : ?> |
|
729 | + <?php foreach ($donation_levels as $index => $level) : ?> |
|
730 | 730 | <tr class="give-row"> |
731 | 731 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
732 | 732 | <div class="give-row-head give-move"> |
733 | 733 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span></button> |
734 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Donation Level', 'give' ); ?>">-</sapn> |
|
734 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Donation Level', 'give'); ?>">-</sapn> |
|
735 | 735 | <h2> |
736 | - <span><?php echo sprintf( esc_html__( 'Donation Level: %s', 'give' ), ( ! empty( $level['_give_text'] ) ? $level['_give_text'] : '') ); ?></span> |
|
736 | + <span><?php echo sprintf(esc_html__('Donation Level: %s', 'give'), ( ! empty($level['_give_text']) ? $level['_give_text'] : '')); ?></span> |
|
737 | 737 | </h2> |
738 | 738 | </div> |
739 | 739 | <div class="give-row-body"> |
740 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
741 | - <?php if ( ! give_is_field_callback_exist( $field ) ) continue; ?> |
|
740 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
741 | + <?php if ( ! give_is_field_callback_exist($field)) continue; ?> |
|
742 | 742 | <?php |
743 | 743 | $field['repeat'] = true; |
744 | - $field['repeatable_field_id'] = ( '_give_id' === $field['id'] ) ? "{$fields['id']}[{$index}][{$field['id']}][level_id]" : "{$fields['id']}[{$index}][{$field['id']}]"; |
|
745 | - $field['attributes']['value'] = ( '_give_id' === $field['id'] ) ? $level[$field['id']]['level_id'] : ( isset( $level[$field['id']] ) ? $level[$field['id']] : '' ); |
|
746 | - $field['id'] = str_replace( array( '[', ']' ), array( '_', '' ), $field['repeatable_field_id'] ); |
|
744 | + $field['repeatable_field_id'] = ('_give_id' === $field['id']) ? "{$fields['id']}[{$index}][{$field['id']}][level_id]" : "{$fields['id']}[{$index}][{$field['id']}]"; |
|
745 | + $field['attributes']['value'] = ('_give_id' === $field['id']) ? $level[$field['id']]['level_id'] : (isset($level[$field['id']]) ? $level[$field['id']] : ''); |
|
746 | + $field['id'] = str_replace(array('[', ']'), array('_', ''), $field['repeatable_field_id']); |
|
747 | 747 | ?> |
748 | - <?php give_render_field( $field ); ?> |
|
748 | + <?php give_render_field($field); ?> |
|
749 | 749 | <?php endforeach; ?> |
750 | 750 | </div> |
751 | 751 | </td> |
752 | 752 | </tr> |
753 | - <?php endforeach;; ?> |
|
753 | + <?php endforeach; ; ?> |
|
754 | 754 | |
755 | - <?php elseif ( $set_default_donation_level ) : ?> |
|
755 | + <?php elseif ($set_default_donation_level) : ?> |
|
756 | 756 | <tr class="give-row"> |
757 | 757 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
758 | 758 | <div class="give-row-head give-move"> |
759 | 759 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span></button> |
760 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Donation Level', 'give' ); ?>">-</sapn> |
|
760 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Donation Level', 'give'); ?>">-</sapn> |
|
761 | 761 | <h2> |
762 | - <span><?php esc_html_e( 'Donation Level', 'give' ); ?></span> |
|
762 | + <span><?php esc_html_e('Donation Level', 'give'); ?></span> |
|
763 | 763 | </h2> |
764 | 764 | </div> |
765 | 765 | <div class="give-row-body"> |
766 | 766 | <?php $index = 0; ?> |
767 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
768 | - <?php if ( ! give_is_field_callback_exist( $field ) ) continue; ?> |
|
767 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
768 | + <?php if ( ! give_is_field_callback_exist($field)) continue; ?> |
|
769 | 769 | <?php |
770 | 770 | $field['repeat'] = true; |
771 | - $field['repeatable_field_id'] = ( '_give_id' === $field['id'] ) ? "{$fields['id']}[{$index}][{$field['id']}][level_id]" : "{$fields['id']}[{$index}][{$field['id']}]"; |
|
771 | + $field['repeatable_field_id'] = ('_give_id' === $field['id']) ? "{$fields['id']}[{$index}][{$field['id']}][level_id]" : "{$fields['id']}[{$index}][{$field['id']}]"; |
|
772 | 772 | |
773 | 773 | // Set default value. |
774 | - switch ( $field['id'] ) { |
|
774 | + switch ($field['id']) { |
|
775 | 775 | case '_give_id': |
776 | 776 | $field['attributes']['value'] = 0; |
777 | 777 | break; |
@@ -784,9 +784,9 @@ discard block |
||
784 | 784 | $field['attributes']['value'] = ''; |
785 | 785 | } |
786 | 786 | |
787 | - $field['id'] = str_replace( array( '[', ']' ), array( '_', '' ), $field['repeatable_field_id'] ); |
|
787 | + $field['id'] = str_replace(array('[', ']'), array('_', ''), $field['repeatable_field_id']); |
|
788 | 788 | ?> |
789 | - <?php give_render_field( $field ); ?> |
|
789 | + <?php give_render_field($field); ?> |
|
790 | 790 | <?php endforeach; ?> |
791 | 791 | </div> |
792 | 792 | </td> |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | </tbody> |
796 | 796 | <tfoot> |
797 | 797 | <tr> |
798 | - <td colspan="2" class="give-add-repeater-field-section-row-wrap"><span id="give-add-repeater-field-section-row" class="button button-primary"><?php esc_html_e( 'Add Level', 'give' ); ?></span></td> |
|
798 | + <td colspan="2" class="give-add-repeater-field-section-row-wrap"><span id="give-add-repeater-field-section-row" class="button button-primary"><?php esc_html_e('Add Level', 'give'); ?></span></td> |
|
799 | 799 | </tr> |
800 | 800 | </tfoot> |
801 | 801 | </table> |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | * @since 1.8 |
811 | 811 | * @return string |
812 | 812 | */ |
813 | -function give_get_current_setting_tab(){ |
|
813 | +function give_get_current_setting_tab() { |
|
814 | 814 | // Get current setting page. |
815 | 815 | $current_setting_page = give_get_current_setting_page(); |
816 | 816 | |
@@ -820,10 +820,10 @@ discard block |
||
820 | 820 | * @since 1.8 |
821 | 821 | * @param string |
822 | 822 | */ |
823 | - $default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' ); |
|
823 | + $default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general'); |
|
824 | 824 | |
825 | 825 | // Get current tab. |
826 | - $current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] ); |
|
826 | + $current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']); |
|
827 | 827 | |
828 | 828 | // Output. |
829 | 829 | return $current_tab; |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | * @since 1.8 |
837 | 837 | * @return string |
838 | 838 | */ |
839 | -function give_get_current_setting_section(){ |
|
839 | +function give_get_current_setting_section() { |
|
840 | 840 | // Get current tab. |
841 | 841 | $current_tab = give_get_current_setting_tab(); |
842 | 842 | |
@@ -846,10 +846,10 @@ discard block |
||
846 | 846 | * @since 1.8 |
847 | 847 | * @param string |
848 | 848 | */ |
849 | - $default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' ); |
|
849 | + $default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", ''); |
|
850 | 850 | |
851 | 851 | // Get current section. |
852 | - $current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] ); |
|
852 | + $current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']); |
|
853 | 853 | |
854 | 854 | //Output. |
855 | 855 | return $current_section; |
@@ -861,9 +861,9 @@ discard block |
||
861 | 861 | * @since 1.8 |
862 | 862 | * @return string |
863 | 863 | */ |
864 | -function give_get_current_setting_page(){ |
|
864 | +function give_get_current_setting_page() { |
|
865 | 865 | // Get current page. |
866 | - $setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : ''; |
|
866 | + $setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : ''; |
|
867 | 867 | |
868 | 868 | //Output. |
869 | 869 | return $setting_page; |
@@ -880,20 +880,20 @@ discard block |
||
880 | 880 | * @param int $postid Form/Post ID. |
881 | 881 | * @return string |
882 | 882 | */ |
883 | -function _give_display_content_field_value( $field_value, $field, $postid ){ |
|
884 | - $show_content = get_post_meta( $postid, '_give_content_option', true ); |
|
883 | +function _give_display_content_field_value($field_value, $field, $postid) { |
|
884 | + $show_content = get_post_meta($postid, '_give_content_option', true); |
|
885 | 885 | |
886 | - if( |
|
887 | - ! get_post_meta( $postid, '_give_display_content', true ) |
|
886 | + if ( |
|
887 | + ! get_post_meta($postid, '_give_display_content', true) |
|
888 | 888 | && $show_content |
889 | - && ( 'none' !== $show_content ) |
|
889 | + && ('none' !== $show_content) |
|
890 | 890 | ) { |
891 | 891 | $field_value = 'enabled'; |
892 | 892 | } |
893 | 893 | |
894 | 894 | return $field_value; |
895 | 895 | } |
896 | -add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 ); |
|
896 | +add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3); |
|
897 | 897 | |
898 | 898 | |
899 | 899 | /** |
@@ -907,19 +907,19 @@ discard block |
||
907 | 907 | * @param int $postid Form/Post ID. |
908 | 908 | * @return string |
909 | 909 | */ |
910 | -function _give_content_placement_field_value( $field_value, $field, $postid ){ |
|
911 | - $show_content = get_post_meta( $postid, '_give_content_option', true ); |
|
910 | +function _give_content_placement_field_value($field_value, $field, $postid) { |
|
911 | + $show_content = get_post_meta($postid, '_give_content_option', true); |
|
912 | 912 | |
913 | - if( |
|
914 | - ! get_post_meta( $postid, '_give_content_placement', true ) |
|
915 | - && ( 'none' !== $show_content ) |
|
913 | + if ( |
|
914 | + ! get_post_meta($postid, '_give_content_placement', true) |
|
915 | + && ('none' !== $show_content) |
|
916 | 916 | ) { |
917 | 917 | $field_value = $show_content; |
918 | 918 | } |
919 | 919 | |
920 | 920 | return $field_value; |
921 | 921 | } |
922 | -add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 ); |
|
922 | +add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3); |
|
923 | 923 | |
924 | 924 | |
925 | 925 | /** |
@@ -933,16 +933,16 @@ discard block |
||
933 | 933 | * @param int $postid Form/Post ID. |
934 | 934 | * @return string |
935 | 935 | */ |
936 | -function _give_terms_option_field_value( $field_value, $field, $postid ){ |
|
937 | - $term_option = get_post_meta( $postid, '_give_terms_option', true ); |
|
936 | +function _give_terms_option_field_value($field_value, $field, $postid) { |
|
937 | + $term_option = get_post_meta($postid, '_give_terms_option', true); |
|
938 | 938 | |
939 | - if( in_array( $term_option, array( 'none', 'yes' ) ) ) { |
|
940 | - $field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' ); |
|
939 | + if (in_array($term_option, array('none', 'yes'))) { |
|
940 | + $field_value = ('yes' === $term_option ? 'enabled' : 'disabled'); |
|
941 | 941 | } |
942 | 942 | |
943 | 943 | return $field_value; |
944 | 944 | } |
945 | -add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 ); |
|
945 | +add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3); |
|
946 | 946 | |
947 | 947 | |
948 | 948 | /** |
@@ -956,18 +956,18 @@ discard block |
||
956 | 956 | * @param int $postid Form/Post ID. |
957 | 957 | * @return string |
958 | 958 | */ |
959 | -function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ){ |
|
960 | - $offline_donation = get_post_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true ); |
|
959 | +function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) { |
|
960 | + $offline_donation = get_post_meta($postid, '_give_offline_donation_enable_billing_fields_single', true); |
|
961 | 961 | |
962 | - if( 'on' === $offline_donation ) { |
|
962 | + if ('on' === $offline_donation) { |
|
963 | 963 | $field_value = 'enabled'; |
964 | 964 | } |
965 | 965 | |
966 | - error_log( print_r( $field_value, true ) . "\n", 3, WP_CONTENT_DIR . '/debug_new.log' ); |
|
966 | + error_log(print_r($field_value, true)."\n", 3, WP_CONTENT_DIR.'/debug_new.log'); |
|
967 | 967 | |
968 | 968 | return $field_value; |
969 | 969 | } |
970 | -add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 ); |
|
970 | +add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3); |
|
971 | 971 | |
972 | 972 | |
973 | 973 | /** |
@@ -981,16 +981,16 @@ discard block |
||
981 | 981 | * @param int $postid Form/Post ID. |
982 | 982 | * @return string |
983 | 983 | */ |
984 | -function _give_custom_amount_field_value( $field_value, $field, $postid ){ |
|
985 | - $custom_amount = get_post_meta( $postid, '_give_custom_amount', true ); |
|
984 | +function _give_custom_amount_field_value($field_value, $field, $postid) { |
|
985 | + $custom_amount = get_post_meta($postid, '_give_custom_amount', true); |
|
986 | 986 | |
987 | - if( in_array( $custom_amount, array( 'yes', 'no' ) ) ) { |
|
988 | - $field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' ); |
|
987 | + if (in_array($custom_amount, array('yes', 'no'))) { |
|
988 | + $field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled'); |
|
989 | 989 | } |
990 | 990 | |
991 | 991 | return $field_value; |
992 | 992 | } |
993 | -add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 ); |
|
993 | +add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3); |
|
994 | 994 | |
995 | 995 | |
996 | 996 | /** |
@@ -1004,16 +1004,16 @@ discard block |
||
1004 | 1004 | * @param int $postid Form/Post ID. |
1005 | 1005 | * @return string |
1006 | 1006 | */ |
1007 | -function _give_goal_option_field_value( $field_value, $field, $postid ){ |
|
1008 | - $goal_option = get_post_meta( $postid, '_give_goal_option', true ); |
|
1007 | +function _give_goal_option_field_value($field_value, $field, $postid) { |
|
1008 | + $goal_option = get_post_meta($postid, '_give_goal_option', true); |
|
1009 | 1009 | |
1010 | - if( in_array( $goal_option, array( 'yes', 'no' ) ) ) { |
|
1011 | - $field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' ); |
|
1010 | + if (in_array($goal_option, array('yes', 'no'))) { |
|
1011 | + $field_value = ('yes' === $goal_option ? 'enabled' : 'disabled'); |
|
1012 | 1012 | } |
1013 | 1013 | |
1014 | 1014 | return $field_value; |
1015 | 1015 | } |
1016 | -add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 ); |
|
1016 | +add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3); |
|
1017 | 1017 | |
1018 | 1018 | /** |
1019 | 1019 | * Set value for Donation Goal --> close Form. |
@@ -1026,16 +1026,16 @@ discard block |
||
1026 | 1026 | * @param int $postid Form/Post ID. |
1027 | 1027 | * @return string |
1028 | 1028 | */ |
1029 | -function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ){ |
|
1030 | - $close_form = get_post_meta( $postid, '_give_close_form_when_goal_achieved', true ); |
|
1029 | +function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) { |
|
1030 | + $close_form = get_post_meta($postid, '_give_close_form_when_goal_achieved', true); |
|
1031 | 1031 | |
1032 | - if( in_array( $close_form, array( 'yes', 'no' ) ) ) { |
|
1033 | - $field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' ); |
|
1032 | + if (in_array($close_form, array('yes', 'no'))) { |
|
1033 | + $field_value = ('yes' === $close_form ? 'enabled' : 'disabled'); |
|
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | return $field_value; |
1037 | 1037 | } |
1038 | -add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 ); |
|
1038 | +add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3); |
|
1039 | 1039 | |
1040 | 1040 | |
1041 | 1041 | /** |
@@ -1049,16 +1049,16 @@ discard block |
||
1049 | 1049 | * @param int $postid Form/Post ID. |
1050 | 1050 | * @return string |
1051 | 1051 | */ |
1052 | -function _give_logged_in_only_value( $field_value, $field, $postid ){ |
|
1053 | - $guest_donation = get_post_meta( $postid, '_give_logged_in_only', true ); |
|
1052 | +function _give_logged_in_only_value($field_value, $field, $postid) { |
|
1053 | + $guest_donation = get_post_meta($postid, '_give_logged_in_only', true); |
|
1054 | 1054 | |
1055 | - if( in_array( $guest_donation, array( 'yes', 'no' ) ) ) { |
|
1056 | - $field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' ); |
|
1055 | + if (in_array($guest_donation, array('yes', 'no'))) { |
|
1056 | + $field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled'); |
|
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | return $field_value; |
1060 | 1060 | } |
1061 | -add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 ); |
|
1061 | +add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3); |
|
1062 | 1062 | |
1063 | 1063 | /** |
1064 | 1064 | * Set value for Offline Donations --> Offline Donations. |
@@ -1071,13 +1071,13 @@ discard block |
||
1071 | 1071 | * @param int $postid Form/Post ID. |
1072 | 1072 | * @return string |
1073 | 1073 | */ |
1074 | -function _give_customize_offline_donations_value( $field_value, $field, $postid ){ |
|
1075 | - $customize_offline_text = get_post_meta( $postid, '_give_customize_offline_donations', true ); |
|
1074 | +function _give_customize_offline_donations_value($field_value, $field, $postid) { |
|
1075 | + $customize_offline_text = get_post_meta($postid, '_give_customize_offline_donations', true); |
|
1076 | 1076 | |
1077 | - if( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) { |
|
1078 | - $field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' ); |
|
1077 | + if (in_array($customize_offline_text, array('yes', 'no'))) { |
|
1078 | + $field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled'); |
|
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | return $field_value; |
1082 | 1082 | } |
1083 | -add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 ); |
|
1084 | 1083 | \ No newline at end of file |
1084 | +add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3); |
|
1085 | 1085 | \ No newline at end of file |
@@ -713,7 +713,10 @@ discard block |
||
713 | 713 | </div> |
714 | 714 | <div class="give-row-body"> |
715 | 715 | <?php foreach ( $fields['fields'] as $field ) : ?> |
716 | - <?php if ( ! give_is_field_callback_exist( $field ) ) continue; ?> |
|
716 | + <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
717 | + continue; |
|
718 | +} |
|
719 | +?> |
|
717 | 720 | <?php |
718 | 721 | $field['repeat'] = true; |
719 | 722 | $field['repeatable_field_id'] = ( '_give_id' === $field['id'] ) ? "{$fields['id']}[{{row-count-placeholder}}][{$field['id']}][level_id]" : "{$fields['id']}[{{row-count-placeholder}}][{$field['id']}]"; |
@@ -738,7 +741,10 @@ discard block |
||
738 | 741 | </div> |
739 | 742 | <div class="give-row-body"> |
740 | 743 | <?php foreach ( $fields['fields'] as $field ) : ?> |
741 | - <?php if ( ! give_is_field_callback_exist( $field ) ) continue; ?> |
|
744 | + <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
745 | + continue; |
|
746 | +} |
|
747 | +?> |
|
742 | 748 | <?php |
743 | 749 | $field['repeat'] = true; |
744 | 750 | $field['repeatable_field_id'] = ( '_give_id' === $field['id'] ) ? "{$fields['id']}[{$index}][{$field['id']}][level_id]" : "{$fields['id']}[{$index}][{$field['id']}]"; |
@@ -765,7 +771,10 @@ discard block |
||
765 | 771 | <div class="give-row-body"> |
766 | 772 | <?php $index = 0; ?> |
767 | 773 | <?php foreach ( $fields['fields'] as $field ) : ?> |
768 | - <?php if ( ! give_is_field_callback_exist( $field ) ) continue; ?> |
|
774 | + <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
775 | + continue; |
|
776 | +} |
|
777 | +?> |
|
769 | 778 | <?php |
770 | 779 | $field['repeat'] = true; |
771 | 780 | $field['repeatable_field_id'] = ( '_give_id' === $field['id'] ) ? "{$fields['id']}[{$index}][{$field['id']}][level_id]" : "{$fields['id']}[{$index}][{$field['id']}]"; |