@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,26 +25,26 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_load_scripts() { |
27 | 27 | |
28 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
29 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
30 | - $scripts_footer = ( give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ) ? true : false; |
|
28 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
29 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
30 | + $scripts_footer = (give_is_setting_enabled(give_get_option('scripts_footer'))) ? true : false; |
|
31 | 31 | |
32 | 32 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
33 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
33 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
34 | 34 | |
35 | 35 | // Localize / PHP to AJAX vars. |
36 | - $localize_give_vars = apply_filters( 'give_global_script_vars', array( |
|
36 | + $localize_give_vars = apply_filters('give_global_script_vars', array( |
|
37 | 37 | 'ajaxurl' => give_get_ajax_url(), |
38 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
38 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
39 | 39 | 'currency' => give_get_currency(), |
40 | - 'currency_sign' => give_currency_filter( '' ), |
|
40 | + 'currency_sign' => give_currency_filter(''), |
|
41 | 41 | 'currency_pos' => give_get_currency_position(), |
42 | 42 | 'thousands_separator' => give_get_price_thousand_separator(), |
43 | 43 | 'decimal_separator' => give_get_price_decimal_separator(), |
44 | - 'no_gateway' => __( 'Please select a payment method.', 'give' ), |
|
45 | - 'bad_minimum' => __( 'The minimum custom donation amount for this form is', 'give' ), |
|
46 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
47 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
44 | + 'no_gateway' => __('Please select a payment method.', 'give'), |
|
45 | + 'bad_minimum' => __('The minimum custom donation amount for this form is', 'give'), |
|
46 | + 'general_loading' => __('Loading...', 'give'), |
|
47 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
48 | 48 | 'number_decimals' => give_get_price_decimals(), |
49 | 49 | 'give_version' => GIVE_VERSION, |
50 | 50 | 'magnific_options' => apply_filters( |
@@ -58,81 +58,81 @@ discard block |
||
58 | 58 | 'give_form_translation_js', |
59 | 59 | array( |
60 | 60 | // Field name Validation message. |
61 | - 'payment-mode' => __( 'Please select payment mode.', 'give' ), |
|
62 | - 'give_first' => __( 'Please enter your first name.', 'give' ), |
|
63 | - 'give_email' => __( 'Please enter a valid email address.', 'give' ), |
|
64 | - 'give_user_login' => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
|
65 | - 'give_user_pass' => __( 'Enter a password.', 'give' ), |
|
66 | - 'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ), |
|
67 | - 'give_agree_to_terms' => __( 'You must agree to the terms and conditions.', 'give' ), |
|
61 | + 'payment-mode' => __('Please select payment mode.', 'give'), |
|
62 | + 'give_first' => __('Please enter your first name.', 'give'), |
|
63 | + 'give_email' => __('Please enter a valid email address.', 'give'), |
|
64 | + 'give_user_login' => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'), |
|
65 | + 'give_user_pass' => __('Enter a password.', 'give'), |
|
66 | + 'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'), |
|
67 | + 'give_agree_to_terms' => __('You must agree to the terms and conditions.', 'give'), |
|
68 | 68 | ) |
69 | 69 | ), |
70 | - ) ); |
|
70 | + )); |
|
71 | 71 | |
72 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
72 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
73 | 73 | 'ajaxurl' => give_get_ajax_url(), |
74 | - 'loading' => __( 'Loading', 'give' ), |
|
74 | + 'loading' => __('Loading', 'give'), |
|
75 | 75 | // General loading message. |
76 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
76 | + 'select_option' => __('Please select an option', 'give'), |
|
77 | 77 | // Variable pricing error with multi-donation option enabled. |
78 | - 'default_gateway' => give_get_default_gateway( null ), |
|
79 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
78 | + 'default_gateway' => give_get_default_gateway(null), |
|
79 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
80 | 80 | 'number_decimals' => give_get_price_decimals(), |
81 | - ) ); |
|
81 | + )); |
|
82 | 82 | |
83 | 83 | // DEBUG is On. |
84 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
84 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
85 | 85 | |
86 | - if ( give_is_cc_verify_enabled() ) { |
|
87 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
88 | - wp_enqueue_script( 'give-cc-validator' ); |
|
86 | + if (give_is_cc_verify_enabled()) { |
|
87 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
88 | + wp_enqueue_script('give-cc-validator'); |
|
89 | 89 | } |
90 | 90 | |
91 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
92 | - wp_enqueue_script( 'give-float-labels' ); |
|
91 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
92 | + wp_enqueue_script('give-float-labels'); |
|
93 | 93 | |
94 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
95 | - wp_enqueue_script( 'give-blockui' ); |
|
94 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
95 | + wp_enqueue_script('give-blockui'); |
|
96 | 96 | |
97 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
98 | - wp_enqueue_script( 'give-qtip' ); |
|
97 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
98 | + wp_enqueue_script('give-qtip'); |
|
99 | 99 | |
100 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
101 | - wp_enqueue_script( 'give-accounting' ); |
|
100 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
101 | + wp_enqueue_script('give-accounting'); |
|
102 | 102 | |
103 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
104 | - wp_enqueue_script( 'give-magnific' ); |
|
103 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
104 | + wp_enqueue_script('give-magnific'); |
|
105 | 105 | |
106 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
107 | - wp_enqueue_script( 'give-checkout-global' ); |
|
106 | + wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
107 | + wp_enqueue_script('give-checkout-global'); |
|
108 | 108 | |
109 | 109 | // General scripts. |
110 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
111 | - wp_enqueue_script( 'give-scripts' ); |
|
110 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
111 | + wp_enqueue_script('give-scripts'); |
|
112 | 112 | |
113 | 113 | // Load AJAX scripts, if enabled. |
114 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
115 | - wp_enqueue_script( 'give-ajax' ); |
|
114 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
115 | + wp_enqueue_script('give-ajax'); |
|
116 | 116 | |
117 | 117 | // Localize / Pass AJAX vars from PHP, |
118 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars ); |
|
119 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
118 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars); |
|
119 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
120 | 120 | |
121 | 121 | } else { |
122 | 122 | |
123 | 123 | // DEBUG is OFF (one JS file to rule them all!). |
124 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
125 | - wp_enqueue_script( 'give' ); |
|
124 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
125 | + wp_enqueue_script('give'); |
|
126 | 126 | |
127 | 127 | // Localize / Pass AJAX vars from PHP. |
128 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
|
129 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
128 | + wp_localize_script('give', 'give_global_vars', $localize_give_vars); |
|
129 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
130 | 130 | |
131 | 131 | } |
132 | 132 | |
133 | 133 | } |
134 | 134 | |
135 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
135 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
136 | 136 | |
137 | 137 | /** |
138 | 138 | * Register styles. |
@@ -145,16 +145,16 @@ discard block |
||
145 | 145 | */ |
146 | 146 | function give_register_styles() { |
147 | 147 | |
148 | - if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
|
148 | + if ( ! give_is_setting_enabled(give_get_option('css'))) { |
|
149 | 149 | return; |
150 | 150 | } |
151 | 151 | |
152 | - wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
153 | - wp_enqueue_style( 'give-styles' ); |
|
152 | + wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
153 | + wp_enqueue_style('give-styles'); |
|
154 | 154 | |
155 | 155 | } |
156 | 156 | |
157 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
157 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
158 | 158 | |
159 | 159 | |
160 | 160 | /** |
@@ -167,19 +167,19 @@ discard block |
||
167 | 167 | function give_get_stylesheet_uri() { |
168 | 168 | |
169 | 169 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
170 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
170 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
171 | 171 | |
172 | 172 | // LTR or RTL files. |
173 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
173 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
174 | 174 | |
175 | - $file = 'give' . $direction . $suffix . '.css'; |
|
175 | + $file = 'give'.$direction.$suffix.'.css'; |
|
176 | 176 | $templates_dir = give_get_theme_template_dir_name(); |
177 | 177 | |
178 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
179 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
180 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
181 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
182 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
178 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
179 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css'; |
|
180 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
181 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css'; |
|
182 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
183 | 183 | |
184 | 184 | $uri = false; |
185 | 185 | |
@@ -189,23 +189,23 @@ discard block |
||
189 | 189 | * followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
190 | 190 | * This allows users to copy just give.css to their theme. |
191 | 191 | */ |
192 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
193 | - if ( ! empty( $nonmin ) ) { |
|
194 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
192 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
193 | + if ( ! empty($nonmin)) { |
|
194 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
195 | 195 | } else { |
196 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
196 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
197 | 197 | } |
198 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
199 | - if ( ! empty( $nonmin ) ) { |
|
200 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
198 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
199 | + if ( ! empty($nonmin)) { |
|
200 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
201 | 201 | } else { |
202 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
202 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
203 | 203 | } |
204 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
205 | - $uri = trailingslashit( give_get_templates_url() ) . $file; |
|
204 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
205 | + $uri = trailingslashit(give_get_templates_url()).$file; |
|
206 | 206 | } |
207 | 207 | |
208 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
208 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
209 | 209 | |
210 | 210 | } |
211 | 211 | |
@@ -222,79 +222,79 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @return void |
224 | 224 | */ |
225 | -function give_load_admin_scripts( $hook ) { |
|
225 | +function give_load_admin_scripts($hook) { |
|
226 | 226 | |
227 | 227 | global $post, $post_type; |
228 | 228 | |
229 | 229 | $give_options = give_get_settings(); |
230 | 230 | |
231 | 231 | // Directories of assets. |
232 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
233 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
234 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
232 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
233 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
234 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
235 | 235 | |
236 | 236 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
237 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
237 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
238 | 238 | |
239 | 239 | // LTR or RTL files. |
240 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
240 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
241 | 241 | |
242 | 242 | // Global Admin. |
243 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
244 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
243 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
244 | + wp_enqueue_style('give-admin-bar-notification'); |
|
245 | 245 | |
246 | 246 | // Give Admin Only. |
247 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
247 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
248 | 248 | return; |
249 | 249 | } |
250 | 250 | |
251 | 251 | // CSS. |
252 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
253 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
254 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION ); |
|
255 | - wp_enqueue_style( 'give-admin' ); |
|
256 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
257 | - wp_enqueue_style( 'jquery-chosen' ); |
|
258 | - wp_enqueue_style( 'thickbox' ); |
|
259 | - wp_enqueue_style( 'wp-color-picker' ); |
|
252 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
253 | + wp_enqueue_style('jquery-ui-css'); |
|
254 | + wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', array(), GIVE_VERSION); |
|
255 | + wp_enqueue_style('give-admin'); |
|
256 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
257 | + wp_enqueue_style('jquery-chosen'); |
|
258 | + wp_enqueue_style('thickbox'); |
|
259 | + wp_enqueue_style('wp-color-picker'); |
|
260 | 260 | |
261 | 261 | |
262 | 262 | // JS. |
263 | - wp_register_script( 'give-selector-cache', $js_plugins . 'selector-cache' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
264 | - wp_enqueue_script( 'give-selector-cache' ); |
|
263 | + wp_register_script('give-selector-cache', $js_plugins.'selector-cache'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
264 | + wp_enqueue_script('give-selector-cache'); |
|
265 | 265 | |
266 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
267 | - wp_enqueue_script( 'jquery-chosen' ); |
|
266 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
267 | + wp_enqueue_script('jquery-chosen'); |
|
268 | 268 | |
269 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
270 | - wp_enqueue_script( 'give-accounting' ); |
|
269 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
270 | + wp_enqueue_script('give-accounting'); |
|
271 | 271 | |
272 | - wp_enqueue_script( 'wp-color-picker' ); |
|
273 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
274 | - wp_enqueue_script( 'thickbox' ); |
|
272 | + wp_enqueue_script('wp-color-picker'); |
|
273 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
274 | + wp_enqueue_script('thickbox'); |
|
275 | 275 | |
276 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query' ), GIVE_VERSION, false ); |
|
277 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
276 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query'), GIVE_VERSION, false); |
|
277 | + wp_enqueue_script('give-admin-scripts'); |
|
278 | 278 | |
279 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
280 | - wp_enqueue_script( 'jquery-flot' ); |
|
279 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
280 | + wp_enqueue_script('jquery-flot'); |
|
281 | 281 | |
282 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
283 | - wp_enqueue_script( 'give-qtip' ); |
|
282 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
283 | + wp_enqueue_script('give-qtip'); |
|
284 | 284 | |
285 | - wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
286 | - wp_enqueue_script( 'give-repeatable-fields' ); |
|
285 | + wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
286 | + wp_enqueue_script('give-repeatable-fields'); |
|
287 | 287 | |
288 | 288 | // Forms CPT Script. |
289 | - if ( $post_type === 'give_forms' ) { |
|
290 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
291 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
289 | + if ($post_type === 'give_forms') { |
|
290 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
291 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | // Settings Scripts. |
295 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) { |
|
296 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
297 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
295 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
296 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
297 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | // Price Separators. |
@@ -302,81 +302,81 @@ discard block |
||
302 | 302 | $decimal_separator = give_get_price_decimal_separator(); |
303 | 303 | |
304 | 304 | // Localize strings & variables for JS. |
305 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
306 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
305 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
306 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
307 | 307 | 'give_version' => GIVE_VERSION, |
308 | 308 | 'thousands_separator' => $thousand_separator, |
309 | 309 | 'decimal_separator' => $decimal_separator, |
310 | - 'quick_edit_warning' => __( 'Not available for variable priced forms.', 'give' ), |
|
311 | - 'delete_payment' => __( 'Are you sure you want to delete this payment?', 'give' ), |
|
312 | - 'delete_payment_note' => __( 'Are you sure you want to delete this note?', 'give' ), |
|
313 | - 'revoke_api_key' => __( 'Are you sure you want to revoke this API key?', 'give' ), |
|
314 | - 'regenerate_api_key' => __( 'Are you sure you want to regenerate this API key?', 'give' ), |
|
315 | - 'resend_receipt' => __( 'Are you sure you want to resend the donation receipt?', 'give' ), |
|
316 | - 'disconnect_user' => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ), |
|
317 | - 'one_option' => __( 'Choose a form', 'give' ), |
|
318 | - 'one_or_more_option' => __( 'Choose one or more forms', 'give' ), |
|
319 | - 'currency_sign' => give_currency_filter( '' ), |
|
320 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
310 | + 'quick_edit_warning' => __('Not available for variable priced forms.', 'give'), |
|
311 | + 'delete_payment' => __('Are you sure you want to delete this payment?', 'give'), |
|
312 | + 'delete_payment_note' => __('Are you sure you want to delete this note?', 'give'), |
|
313 | + 'revoke_api_key' => __('Are you sure you want to revoke this API key?', 'give'), |
|
314 | + 'regenerate_api_key' => __('Are you sure you want to regenerate this API key?', 'give'), |
|
315 | + 'resend_receipt' => __('Are you sure you want to resend the donation receipt?', 'give'), |
|
316 | + 'disconnect_user' => __('Are you sure you want to disconnect the user from this donor?', 'give'), |
|
317 | + 'one_option' => __('Choose a form', 'give'), |
|
318 | + 'one_or_more_option' => __('Choose one or more forms', 'give'), |
|
319 | + 'currency_sign' => give_currency_filter(''), |
|
320 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
321 | 321 | 'currency_decimals' => give_get_price_decimals(), |
322 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
323 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
324 | - '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' ), |
|
325 | - 'delete_test_donor' => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ), |
|
326 | - 'delete_import_donor' => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ), |
|
327 | - 'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
|
322 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
323 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
324 | + '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'), |
|
325 | + 'delete_test_donor' => __('Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give'), |
|
326 | + 'delete_import_donor' => __('Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give'), |
|
327 | + 'price_format_guide' => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator), |
|
328 | 328 | /* translators : %s: Donation form options metabox */ |
329 | - 'confirm_before_remove_row_text' => __( 'Do you want to delete this level?', 'give' ), |
|
330 | - 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
331 | - 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
332 | - 'search_placeholder' => __( 'Type to search all forms', 'give' ), |
|
333 | - 'search_placeholder_donor' => __( 'Type to search all donors', 'give' ), |
|
334 | - 'search_placeholder_country' => __( 'Type to search all countries', 'give' ), |
|
335 | - 'search_placeholder_state' => __( 'Type to search all states/provinces', 'give' ), |
|
329 | + 'confirm_before_remove_row_text' => __('Do you want to delete this level?', 'give'), |
|
330 | + 'matched_success_failure_page' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
331 | + 'dismiss_notice_text' => __('Dismiss this notice.', 'give'), |
|
332 | + 'search_placeholder' => __('Type to search all forms', 'give'), |
|
333 | + 'search_placeholder_donor' => __('Type to search all donors', 'give'), |
|
334 | + 'search_placeholder_country' => __('Type to search all countries', 'give'), |
|
335 | + 'search_placeholder_state' => __('Type to search all states/provinces', 'give'), |
|
336 | 336 | 'bulk_action' => array( |
337 | 337 | 'delete' => array( |
338 | - 'zero' => __( 'You must choose at least one or more payments to delete.', 'give' ), |
|
339 | - 'single' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
|
340 | - 'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
|
338 | + 'zero' => __('You must choose at least one or more payments to delete.', 'give'), |
|
339 | + 'single' => __('Are you sure you want to permanently delete this donation?', 'give'), |
|
340 | + 'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'), |
|
341 | 341 | ), |
342 | 342 | 'resend-receipt' => array( |
343 | - 'zero' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
|
344 | - 'single' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
|
345 | - 'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
|
343 | + 'zero' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'), |
|
344 | + 'single' => __('Are you sure you want to resend the email receipt to this recipient?', 'give'), |
|
345 | + 'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'), |
|
346 | 346 | ), |
347 | 347 | 'set-to-status' => array( |
348 | - 'zero' => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ), |
|
349 | - 'single' => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ), |
|
350 | - 'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ), |
|
348 | + 'zero' => __('You must choose at least one or more donations to set status to {status}.', 'give'), |
|
349 | + 'single' => __('Are you sure you want to set status of this donation to {status}?', 'give'), |
|
350 | + 'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'), |
|
351 | 351 | ), |
352 | 352 | ), |
353 | 353 | 'metabox_fields' => array( |
354 | 354 | 'media' => array( |
355 | - 'button_title' => __( 'Choose Image', 'give' ), |
|
355 | + 'button_title' => __('Choose Image', 'give'), |
|
356 | 356 | ), |
357 | 357 | 'file' => array( |
358 | - 'button_title' => __( 'Choose File', 'give' ), |
|
358 | + 'button_title' => __('Choose File', 'give'), |
|
359 | 359 | ), |
360 | 360 | ), |
361 | 361 | 'chosen' => array( |
362 | - 'no_results_msg' => __( 'No results match {search_term}', 'give' ), |
|
363 | - 'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ), |
|
362 | + 'no_results_msg' => __('No results match {search_term}', 'give'), |
|
363 | + 'ajax_search_msg' => __('Searching results for match {search_term}', 'give'), |
|
364 | 364 | ), |
365 | - 'db_update_confirmation_msg_button' => __( 'Run Updates', 'give' ), |
|
366 | - 'db_update_confirmation_msg' => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ), |
|
367 | - 'error_message' => __( 'Something went wrong kindly try again!', 'give' ), |
|
365 | + 'db_update_confirmation_msg_button' => __('Run Updates', 'give'), |
|
366 | + 'db_update_confirmation_msg' => __('The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give'), |
|
367 | + 'error_message' => __('Something went wrong kindly try again!', 'give'), |
|
368 | 368 | 'give_donation_import' => 'give_donation_import', |
369 | - 'setting_not_save_message' => __( 'Changes you made may not be saved.', 'give' ), |
|
370 | - ) ); |
|
369 | + 'setting_not_save_message' => __('Changes you made may not be saved.', 'give'), |
|
370 | + )); |
|
371 | 371 | |
372 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) { |
|
372 | + if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) { |
|
373 | 373 | // call for new media manager. |
374 | 374 | wp_enqueue_media(); |
375 | 375 | } |
376 | 376 | |
377 | 377 | } |
378 | 378 | |
379 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
379 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
380 | 380 | |
381 | 381 | /** |
382 | 382 | * Admin Give Icon |
@@ -391,13 +391,13 @@ discard block |
||
391 | 391 | ?> |
392 | 392 | <style type="text/css" media="screen"> |
393 | 393 | |
394 | - <?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?> |
|
394 | + <?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?> |
|
395 | 395 | @font-face { |
396 | 396 | font-family: 'give-icomoon'; |
397 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
398 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
399 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
400 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
397 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
398 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
399 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
400 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
401 | 401 | font-weight: normal; |
402 | 402 | font-style: normal; |
403 | 403 | } |
@@ -416,4 +416,4 @@ discard block |
||
416 | 416 | <?php |
417 | 417 | } |
418 | 418 | |
419 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
419 | +add_action('admin_head', 'give_admin_icon'); |
@@ -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,14 +25,14 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_get_actions() { |
27 | 27 | |
28 | - $_get_action = ! empty( $_GET['give_action'] ) ? $_GET['give_action'] : null; |
|
28 | + $_get_action = ! empty($_GET['give_action']) ? $_GET['give_action'] : null; |
|
29 | 29 | |
30 | 30 | // Add backward compatibility to give-action param ( $_GET ) |
31 | - if ( empty( $_get_action ) ) { |
|
32 | - $_get_action = ! empty( $_GET['give-action'] ) ? $_GET['give-action'] : null; |
|
31 | + if (empty($_get_action)) { |
|
32 | + $_get_action = ! empty($_GET['give-action']) ? $_GET['give-action'] : null; |
|
33 | 33 | } |
34 | 34 | |
35 | - if ( isset( $_get_action ) ) { |
|
35 | + if (isset($_get_action)) { |
|
36 | 36 | /** |
37 | 37 | * Fires in WordPress init or admin init, when give_action is present in $_GET. |
38 | 38 | * |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @param array $_GET Array of HTTP GET variables. |
42 | 42 | */ |
43 | - do_action( "give_{$_get_action}", $_GET ); |
|
43 | + do_action("give_{$_get_action}", $_GET); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | } |
47 | 47 | |
48 | -add_action( 'init', 'give_get_actions' ); |
|
48 | +add_action('init', 'give_get_actions'); |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Hooks Give actions, when present in the $_POST super global. Every give_action |
@@ -58,15 +58,15 @@ discard block |
||
58 | 58 | */ |
59 | 59 | function give_post_actions() { |
60 | 60 | |
61 | - $_post_action = ! empty( $_POST['give_action'] ) ? $_POST['give_action'] : null; |
|
61 | + $_post_action = ! empty($_POST['give_action']) ? $_POST['give_action'] : null; |
|
62 | 62 | |
63 | 63 | |
64 | 64 | // Add backward compatibility to give-action param ( $_POST ). |
65 | - if ( empty( $_post_action ) ) { |
|
66 | - $_post_action = ! empty( $_POST['give-action'] ) ? $_POST['give-action'] : null; |
|
65 | + if (empty($_post_action)) { |
|
66 | + $_post_action = ! empty($_POST['give-action']) ? $_POST['give-action'] : null; |
|
67 | 67 | } |
68 | 68 | |
69 | - if ( isset( $_post_action ) ) { |
|
69 | + if (isset($_post_action)) { |
|
70 | 70 | /** |
71 | 71 | * Fires in WordPress init or admin init, when give_action is present in $_POST. |
72 | 72 | * |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @param array $_POST Array of HTTP POST variables. |
76 | 76 | */ |
77 | - do_action( "give_{$_post_action}", $_POST ); |
|
77 | + do_action("give_{$_post_action}", $_POST); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | } |
81 | 81 | |
82 | -add_action( 'init', 'give_post_actions' ); |
|
82 | +add_action('init', 'give_post_actions'); |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Connect WordPress user with Donor. |
@@ -91,29 +91,29 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return void |
93 | 93 | */ |
94 | -function give_connect_donor_to_wpuser( $user_id, $user_data ) { |
|
94 | +function give_connect_donor_to_wpuser($user_id, $user_data) { |
|
95 | 95 | /* @var Give_Donor $donor */ |
96 | - $donor = new Give_Donor( $user_data['user_email'] ); |
|
96 | + $donor = new Give_Donor($user_data['user_email']); |
|
97 | 97 | |
98 | 98 | // Validate donor id and check if do nor is already connect to wp user or not. |
99 | - if ( $donor->id && ! $donor->user_id ) { |
|
99 | + if ($donor->id && ! $donor->user_id) { |
|
100 | 100 | |
101 | 101 | // Update donor user_id. |
102 | - if ( $donor->update( array( 'user_id' => $user_id ) ) ) { |
|
103 | - $donor_note = sprintf( esc_html__( 'WordPress user #%d is connected to #%d', 'give' ), $user_id, $donor->id ); |
|
104 | - $donor->add_note( $donor_note ); |
|
102 | + if ($donor->update(array('user_id' => $user_id))) { |
|
103 | + $donor_note = sprintf(esc_html__('WordPress user #%d is connected to #%d', 'give'), $user_id, $donor->id); |
|
104 | + $donor->add_note($donor_note); |
|
105 | 105 | |
106 | 106 | // Update user_id meta in payments. |
107 | - if ( ! empty( $donor->payment_ids ) && ( $donations = explode( ',', $donor->payment_ids ) ) ) { |
|
108 | - foreach ( $donations as $donation ) { |
|
109 | - give_update_meta( $donation, '_give_payment_user_id', $user_id ); |
|
107 | + if ( ! empty($donor->payment_ids) && ($donations = explode(',', $donor->payment_ids))) { |
|
108 | + foreach ($donations as $donation) { |
|
109 | + give_update_meta($donation, '_give_payment_user_id', $user_id); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | -add_action( 'give_insert_user', 'give_connect_donor_to_wpuser', 10, 2 ); |
|
116 | +add_action('give_insert_user', 'give_connect_donor_to_wpuser', 10, 2); |
|
117 | 117 | |
118 | 118 | |
119 | 119 | /** |
@@ -127,44 +127,44 @@ discard block |
||
127 | 127 | */ |
128 | 128 | function give_validate_license_when_site_migrated() { |
129 | 129 | // Store current site address if not already stored. |
130 | - $home_url_parts = parse_url( home_url() ); |
|
131 | - $home_url = isset( $home_url_parts['host'] ) ? $home_url_parts['host'] : false; |
|
132 | - $home_url .= isset( $home_url_parts['path'] ) ? $home_url_parts['path'] : ''; |
|
133 | - $site_address_before_migrate = get_option( 'give_site_address_before_migrate' ); |
|
130 | + $home_url_parts = parse_url(home_url()); |
|
131 | + $home_url = isset($home_url_parts['host']) ? $home_url_parts['host'] : false; |
|
132 | + $home_url .= isset($home_url_parts['path']) ? $home_url_parts['path'] : ''; |
|
133 | + $site_address_before_migrate = get_option('give_site_address_before_migrate'); |
|
134 | 134 | |
135 | 135 | // Need $home_url to proceed |
136 | - if ( ! $home_url ) { |
|
136 | + if ( ! $home_url) { |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
140 | 140 | // Save site address |
141 | - if ( ! $site_address_before_migrate ) { |
|
141 | + if ( ! $site_address_before_migrate) { |
|
142 | 142 | // Update site address. |
143 | - update_option( 'give_site_address_before_migrate', $home_url ); |
|
143 | + update_option('give_site_address_before_migrate', $home_url); |
|
144 | 144 | |
145 | 145 | return; |
146 | 146 | } |
147 | 147 | |
148 | 148 | // Backwards compat. for before when we were storing URL scheme. |
149 | - if ( strpos( $site_address_before_migrate, 'http' ) ) { |
|
150 | - $site_address_before_migrate = parse_url( $site_address_before_migrate ); |
|
151 | - $site_address_before_migrate = isset( $site_address_before_migrate['host'] ) ? $site_address_before_migrate['host'] : false; |
|
149 | + if (strpos($site_address_before_migrate, 'http')) { |
|
150 | + $site_address_before_migrate = parse_url($site_address_before_migrate); |
|
151 | + $site_address_before_migrate = isset($site_address_before_migrate['host']) ? $site_address_before_migrate['host'] : false; |
|
152 | 152 | // Add path for multisite installs. |
153 | - $site_address_before_migrate .= isset( $site_address_before_migrate['path'] ) ? $site_address_before_migrate['path'] : ''; |
|
153 | + $site_address_before_migrate .= isset($site_address_before_migrate['path']) ? $site_address_before_migrate['path'] : ''; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | // If the two URLs don't match run CRON. |
157 | - if ( $home_url !== $site_address_before_migrate ) { |
|
157 | + if ($home_url !== $site_address_before_migrate) { |
|
158 | 158 | // Immediately run cron. |
159 | - wp_schedule_single_event( time(), 'give_validate_license_when_site_migrated' ); |
|
159 | + wp_schedule_single_event(time(), 'give_validate_license_when_site_migrated'); |
|
160 | 160 | |
161 | 161 | // Update site address. |
162 | - update_option( 'give_site_address_before_migrate', $home_url ); |
|
162 | + update_option('give_site_address_before_migrate', $home_url); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | } |
166 | 166 | |
167 | -add_action( 'admin_init', 'give_validate_license_when_site_migrated' ); |
|
167 | +add_action('admin_init', 'give_validate_license_when_site_migrated'); |
|
168 | 168 | |
169 | 169 | |
170 | 170 | /** |
@@ -174,19 +174,19 @@ discard block |
||
174 | 174 | * |
175 | 175 | * @param $data |
176 | 176 | */ |
177 | -function give_donor_batch_export_complete( $data ) { |
|
177 | +function give_donor_batch_export_complete($data) { |
|
178 | 178 | // Remove donor ids cache. |
179 | 179 | if ( |
180 | - isset( $data['class'] ) |
|
180 | + isset($data['class']) |
|
181 | 181 | && 'Give_Batch_Donors_Export' === $data['class'] |
182 | - && ! empty( $data['forms'] ) |
|
183 | - && isset( $data['give_export_option']['query_id'] ) |
|
182 | + && ! empty($data['forms']) |
|
183 | + && isset($data['give_export_option']['query_id']) |
|
184 | 184 | ) { |
185 | - Give_Cache::delete( Give_Cache::get_key( $data['give_export_option']['query_id'] ) ); |
|
185 | + Give_Cache::delete(Give_Cache::get_key($data['give_export_option']['query_id'])); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | |
189 | -add_action( 'give_file_export_complete', 'give_donor_batch_export_complete' ); |
|
189 | +add_action('give_file_export_complete', 'give_donor_batch_export_complete'); |
|
190 | 190 | |
191 | 191 | /** |
192 | 192 | * Print css for wordpress setting pages. |
@@ -197,12 +197,12 @@ discard block |
||
197 | 197 | /* @var WP_Screen $screen */ |
198 | 198 | $screen = get_current_screen(); |
199 | 199 | |
200 | - if ( ! ( $screen instanceof WP_Screen ) ) { |
|
200 | + if ( ! ($screen instanceof WP_Screen)) { |
|
201 | 201 | return false; |
202 | 202 | } |
203 | 203 | |
204 | - switch ( true ) { |
|
205 | - case ( 'plugins' === $screen->base || 'plugins-network' === $screen->base ): |
|
204 | + switch (true) { |
|
205 | + case ('plugins' === $screen->base || 'plugins-network' === $screen->base): |
|
206 | 206 | ?> |
207 | 207 | <style> |
208 | 208 | tr.active.update + tr.give-addon-notice-tr td { |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | } |
240 | 240 | } |
241 | 241 | |
242 | -add_action( 'admin_head', 'give_admin_quick_css' ); |
|
242 | +add_action('admin_head', 'give_admin_quick_css'); |
|
243 | 243 | |
244 | 244 | |
245 | 245 | /** |
@@ -252,28 +252,28 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @return void |
254 | 254 | */ |
255 | -function give_set_donation_levels_max_min_amount( $form_id ) { |
|
255 | +function give_set_donation_levels_max_min_amount($form_id) { |
|
256 | 256 | if ( |
257 | - ( 'set' === $_POST['_give_price_option'] ) || |
|
258 | - ( in_array( '_give_donation_levels', $_POST ) && count( $_POST['_give_donation_levels'] ) <= 0 ) || |
|
259 | - ! ( $donation_levels_amounts = wp_list_pluck( $_POST['_give_donation_levels'], '_give_amount' ) ) |
|
257 | + ('set' === $_POST['_give_price_option']) || |
|
258 | + (in_array('_give_donation_levels', $_POST) && count($_POST['_give_donation_levels']) <= 0) || |
|
259 | + ! ($donation_levels_amounts = wp_list_pluck($_POST['_give_donation_levels'], '_give_amount')) |
|
260 | 260 | ) { |
261 | 261 | // Delete old meta. |
262 | - give_delete_meta( $form_id, '_give_levels_minimum_amount' ); |
|
263 | - give_delete_meta( $form_id, '_give_levels_maximum_amount' ); |
|
262 | + give_delete_meta($form_id, '_give_levels_minimum_amount'); |
|
263 | + give_delete_meta($form_id, '_give_levels_maximum_amount'); |
|
264 | 264 | |
265 | 265 | return; |
266 | 266 | } |
267 | 267 | |
268 | 268 | // Sanitize donation level amounts. |
269 | - $donation_levels_amounts = array_map( 'give_maybe_sanitize_amount', $donation_levels_amounts ); |
|
269 | + $donation_levels_amounts = array_map('give_maybe_sanitize_amount', $donation_levels_amounts); |
|
270 | 270 | |
271 | - $min_amount = min( $donation_levels_amounts ); |
|
272 | - $max_amount = max( $donation_levels_amounts ); |
|
271 | + $min_amount = min($donation_levels_amounts); |
|
272 | + $max_amount = max($donation_levels_amounts); |
|
273 | 273 | |
274 | 274 | // Set Minimum and Maximum amount for Multi Level Donation Forms |
275 | - give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount_for_db( $min_amount ) : 0 ); |
|
276 | - give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount_for_db( $max_amount ) : 0 ); |
|
275 | + give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount_for_db($min_amount) : 0); |
|
276 | + give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount_for_db($max_amount) : 0); |
|
277 | 277 | } |
278 | 278 | |
279 | -add_action( 'give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30 ); |
|
280 | 279 | \ No newline at end of file |
280 | +add_action('give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30); |
|
281 | 281 | \ No newline at end of file |