@@ -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 | |
@@ -28,94 +28,94 @@ discard block |
||
28 | 28 | |
29 | 29 | global $give_options; |
30 | 30 | |
31 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
32 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
33 | - $scripts_footer = ( give_get_option( 'scripts_footer' ) == 'on' ) ? true : false; |
|
31 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
32 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
33 | + $scripts_footer = (give_get_option('scripts_footer') == 'on') ? true : false; |
|
34 | 34 | |
35 | 35 | // Use minified libraries if SCRIPT_DEBUG is turned off |
36 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
36 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
37 | 37 | |
38 | 38 | //Localize / PHP to AJAX vars |
39 | - $localize_give_checkout = apply_filters( 'give_global_script_vars', array( |
|
39 | + $localize_give_checkout = apply_filters('give_global_script_vars', array( |
|
40 | 40 | 'ajaxurl' => give_get_ajax_url(), |
41 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
42 | - 'currency_sign' => give_currency_filter( '' ), |
|
41 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
42 | + 'currency_sign' => give_currency_filter(''), |
|
43 | 43 | 'currency_pos' => give_get_currency_position(), |
44 | - 'thousands_separator' => isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ',', |
|
45 | - 'decimal_separator' => isset( $give_options['decimal_separator'] ) ? $give_options['decimal_separator'] : '.', |
|
46 | - 'no_gateway' => esc_html__( 'Please select a payment method.', 'give' ), |
|
47 | - 'bad_minimum' => esc_html__( 'The minimum donation amount for this form is', 'give' ), |
|
48 | - 'general_loading' => esc_html__( 'Loading...', 'give' ), |
|
49 | - 'purchase_loading' => esc_html__( 'Please Wait...', 'give' ), |
|
50 | - 'number_decimals' => apply_filters( 'give_format_amount_decimals', 2 ), |
|
44 | + 'thousands_separator' => isset($give_options['thousands_separator']) ? $give_options['thousands_separator'] : ',', |
|
45 | + 'decimal_separator' => isset($give_options['decimal_separator']) ? $give_options['decimal_separator'] : '.', |
|
46 | + 'no_gateway' => esc_html__('Please select a payment method.', 'give'), |
|
47 | + 'bad_minimum' => esc_html__('The minimum donation amount for this form is', 'give'), |
|
48 | + 'general_loading' => esc_html__('Loading...', 'give'), |
|
49 | + 'purchase_loading' => esc_html__('Please Wait...', 'give'), |
|
50 | + 'number_decimals' => apply_filters('give_format_amount_decimals', 2), |
|
51 | 51 | 'give_version' => GIVE_VERSION |
52 | - ) ); |
|
53 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
52 | + )); |
|
53 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
54 | 54 | 'ajaxurl' => give_get_ajax_url(), |
55 | - 'loading' => esc_html__( 'Loading', 'give' ), |
|
55 | + 'loading' => esc_html__('Loading', 'give'), |
|
56 | 56 | // General loading message |
57 | - 'select_option' => esc_html__( 'Please select an option', 'give' ), |
|
57 | + 'select_option' => esc_html__('Please select an option', 'give'), |
|
58 | 58 | // Variable pricing error with multi-purchase option enabled |
59 | - 'default_gateway' => give_get_default_gateway( null ), |
|
60 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
61 | - 'number_decimals' => apply_filters( 'give_format_amount_decimals', 2 ) |
|
62 | - ) ); |
|
59 | + 'default_gateway' => give_get_default_gateway(null), |
|
60 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
61 | + 'number_decimals' => apply_filters('give_format_amount_decimals', 2) |
|
62 | + )); |
|
63 | 63 | |
64 | 64 | //DEBUG is On |
65 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
65 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
66 | 66 | |
67 | - if ( give_is_cc_verify_enabled() ) { |
|
68 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
69 | - wp_enqueue_script( 'give-cc-validator' ); |
|
67 | + if (give_is_cc_verify_enabled()) { |
|
68 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
69 | + wp_enqueue_script('give-cc-validator'); |
|
70 | 70 | } |
71 | 71 | |
72 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
73 | - wp_enqueue_script( 'give-float-labels' ); |
|
72 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
73 | + wp_enqueue_script('give-float-labels'); |
|
74 | 74 | |
75 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
76 | - wp_enqueue_script( 'give-blockui' ); |
|
75 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
76 | + wp_enqueue_script('give-blockui'); |
|
77 | 77 | |
78 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
79 | - wp_enqueue_script( 'give-qtip' ); |
|
78 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
79 | + wp_enqueue_script('give-qtip'); |
|
80 | 80 | |
81 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
82 | - wp_enqueue_script( 'give-accounting' ); |
|
81 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
82 | + wp_enqueue_script('give-accounting'); |
|
83 | 83 | |
84 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
85 | - wp_enqueue_script( 'give-magnific' ); |
|
84 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
85 | + wp_enqueue_script('give-magnific'); |
|
86 | 86 | |
87 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
88 | - wp_enqueue_script( 'give-checkout-global' ); |
|
87 | + wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
88 | + wp_enqueue_script('give-checkout-global'); |
|
89 | 89 | |
90 | 90 | //General scripts |
91 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
92 | - wp_enqueue_script( 'give-scripts' ); |
|
91 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
92 | + wp_enqueue_script('give-scripts'); |
|
93 | 93 | |
94 | 94 | // Load AJAX scripts, if enabled |
95 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
96 | - wp_enqueue_script( 'give-ajax' ); |
|
95 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
96 | + wp_enqueue_script('give-ajax'); |
|
97 | 97 | |
98 | 98 | //Localize / Pass AJAX vars from PHP |
99 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_checkout ); |
|
100 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
99 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_checkout); |
|
100 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
101 | 101 | |
102 | 102 | |
103 | 103 | } else { |
104 | 104 | |
105 | 105 | //DEBUG is OFF (one JS file to rule them all!) |
106 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
107 | - wp_enqueue_script( 'give' ); |
|
106 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
107 | + wp_enqueue_script('give'); |
|
108 | 108 | |
109 | 109 | //Localize / Pass AJAX vars from PHP |
110 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_checkout ); |
|
111 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
110 | + wp_localize_script('give', 'give_global_vars', $localize_give_checkout); |
|
111 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | 115 | |
116 | 116 | } |
117 | 117 | |
118 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
118 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Register Styles |
@@ -127,47 +127,47 @@ discard block |
||
127 | 127 | */ |
128 | 128 | function give_register_styles() { |
129 | 129 | |
130 | - if ( give_get_option( 'disable_css', false ) ) { |
|
130 | + if (give_get_option('disable_css', false)) { |
|
131 | 131 | return; |
132 | 132 | } |
133 | 133 | |
134 | 134 | // Use minified libraries if SCRIPT_DEBUG is turned off |
135 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
135 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
136 | 136 | |
137 | - $file = 'give' . $suffix . '.css'; |
|
137 | + $file = 'give'.$suffix.'.css'; |
|
138 | 138 | $templates_dir = give_get_theme_template_dir_name(); |
139 | 139 | |
140 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
141 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give.css'; |
|
142 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
143 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give.css'; |
|
144 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
140 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
141 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give.css'; |
|
142 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
143 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give.css'; |
|
144 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
145 | 145 | |
146 | 146 | // Look in the child theme directory first, followed by the parent theme, followed by the Give core templates directory |
147 | 147 | // Also look for the min version first, followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
148 | 148 | // This allows users to copy just give.css to their theme |
149 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
150 | - if ( ! empty( $nonmin ) ) { |
|
151 | - $url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give.css'; |
|
149 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
150 | + if ( ! empty($nonmin)) { |
|
151 | + $url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give.css'; |
|
152 | 152 | } else { |
153 | - $url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
153 | + $url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
154 | 154 | } |
155 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
156 | - if ( ! empty( $nonmin ) ) { |
|
157 | - $url = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give.css'; |
|
155 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
156 | + if ( ! empty($nonmin)) { |
|
157 | + $url = trailingslashit(get_template_directory_uri()).$templates_dir.'give.css'; |
|
158 | 158 | } else { |
159 | - $url = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
159 | + $url = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
160 | 160 | } |
161 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
162 | - $url = trailingslashit( give_get_templates_url() ) . $file; |
|
161 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
162 | + $url = trailingslashit(give_get_templates_url()).$file; |
|
163 | 163 | } |
164 | 164 | |
165 | - wp_register_style( 'give-styles', $url, array(), GIVE_VERSION, 'all' ); |
|
166 | - wp_enqueue_style( 'give-styles' ); |
|
165 | + wp_register_style('give-styles', $url, array(), GIVE_VERSION, 'all'); |
|
166 | + wp_enqueue_style('give-styles'); |
|
167 | 167 | |
168 | 168 | } |
169 | 169 | |
170 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
170 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
171 | 171 | |
172 | 172 | /** |
173 | 173 | * Load Admin Scripts |
@@ -181,107 +181,107 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @return void |
183 | 183 | */ |
184 | -function give_load_admin_scripts( $hook ) { |
|
184 | +function give_load_admin_scripts($hook) { |
|
185 | 185 | |
186 | 186 | global $wp_version, $post, $post_type; |
187 | 187 | |
188 | 188 | //Directories of assets |
189 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
190 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
191 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
189 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
190 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
191 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
192 | 192 | |
193 | 193 | // Use minified libraries if SCRIPT_DEBUG is turned off |
194 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
194 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
195 | 195 | |
196 | 196 | //Global Admin: |
197 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
198 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
197 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
198 | + wp_enqueue_style('give-admin-bar-notification'); |
|
199 | 199 | |
200 | 200 | //Give Admin Only: |
201 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
201 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
202 | 202 | return; |
203 | 203 | } |
204 | 204 | |
205 | 205 | //CSS |
206 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
207 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
208 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $suffix . '.css', GIVE_VERSION ); |
|
209 | - wp_enqueue_style( 'give-admin' ); |
|
210 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
211 | - wp_enqueue_style( 'jquery-chosen' ); |
|
212 | - wp_enqueue_style( 'thickbox' ); |
|
206 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
207 | + wp_enqueue_style('jquery-ui-css'); |
|
208 | + wp_register_style('give-admin', $css_dir.'give-admin'.$suffix.'.css', GIVE_VERSION); |
|
209 | + wp_enqueue_style('give-admin'); |
|
210 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
211 | + wp_enqueue_style('jquery-chosen'); |
|
212 | + wp_enqueue_style('thickbox'); |
|
213 | 213 | |
214 | 214 | //JS |
215 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
216 | - wp_enqueue_script( 'jquery-chosen' ); |
|
215 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
216 | + wp_enqueue_script('jquery-chosen'); |
|
217 | 217 | |
218 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
219 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
218 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
219 | + wp_enqueue_script('give-admin-scripts'); |
|
220 | 220 | |
221 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
222 | - wp_enqueue_script( 'jquery-flot' ); |
|
221 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
222 | + wp_enqueue_script('jquery-flot'); |
|
223 | 223 | |
224 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
225 | - wp_enqueue_script( 'give-qtip' ); |
|
224 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
225 | + wp_enqueue_script('give-qtip'); |
|
226 | 226 | |
227 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
228 | - wp_enqueue_script( 'thickbox' ); |
|
227 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
228 | + wp_enqueue_script('thickbox'); |
|
229 | 229 | |
230 | 230 | //Forms CPT Script |
231 | - if ( $post_type === 'give_forms' ) { |
|
232 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
233 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
231 | + if ($post_type === 'give_forms') { |
|
232 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
233 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | //Settings Scripts |
237 | - if (isset($_GET['page']) && $_GET['page'] == 'give-settings' ) { |
|
237 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
238 | 238 | wp_enqueue_script('jquery-ui-sortable'); |
239 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
240 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
239 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
240 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | //Localize strings & variables for JS |
244 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
245 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
244 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
245 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
246 | 246 | 'give_version' => GIVE_VERSION, |
247 | - 'quick_edit_warning' => esc_html__( 'Sorry, not available for variable priced forms.', 'give' ), |
|
248 | - 'delete_payment' => esc_html__( 'Are you sure you wish to delete this payment?', 'give' ), |
|
249 | - 'delete_payment_note' => esc_html__( 'Are you sure you wish to delete this note?', 'give' ), |
|
250 | - 'revoke_api_key' => esc_html__( 'Are you sure you wish to revoke this API key?', 'give' ), |
|
251 | - 'regenerate_api_key' => esc_html__( 'Are you sure you wish to regenerate this API key?', 'give' ), |
|
252 | - 'resend_receipt' => esc_html__( 'Are you sure you wish to resend the donation receipt?', 'give' ), |
|
253 | - 'copy_download_link_text' => esc_html__( 'Copy these links to your clipboard and give them to your donor.', 'give' ), |
|
247 | + 'quick_edit_warning' => esc_html__('Sorry, not available for variable priced forms.', 'give'), |
|
248 | + 'delete_payment' => esc_html__('Are you sure you wish to delete this payment?', 'give'), |
|
249 | + 'delete_payment_note' => esc_html__('Are you sure you wish to delete this note?', 'give'), |
|
250 | + 'revoke_api_key' => esc_html__('Are you sure you wish to revoke this API key?', 'give'), |
|
251 | + 'regenerate_api_key' => esc_html__('Are you sure you wish to regenerate this API key?', 'give'), |
|
252 | + 'resend_receipt' => esc_html__('Are you sure you wish to resend the donation receipt?', 'give'), |
|
253 | + 'copy_download_link_text' => esc_html__('Copy these links to your clipboard and give them to your donor.', 'give'), |
|
254 | 254 | /* translators: %s: form singular label */ |
255 | - 'delete_payment_download' => sprintf( esc_html__( 'Are you sure you wish to delete this %s?', 'give' ), give_get_forms_label_singular() ), |
|
256 | - 'one_price_min' => esc_html__( 'You must have at least one price.', 'give' ), |
|
257 | - 'one_file_min' => esc_html__( 'You must have at least one file.', 'give' ), |
|
258 | - 'one_field_min' => esc_html__( 'You must have at least one field.', 'give' ), |
|
255 | + 'delete_payment_download' => sprintf(esc_html__('Are you sure you wish to delete this %s?', 'give'), give_get_forms_label_singular()), |
|
256 | + 'one_price_min' => esc_html__('You must have at least one price.', 'give'), |
|
257 | + 'one_file_min' => esc_html__('You must have at least one file.', 'give'), |
|
258 | + 'one_field_min' => esc_html__('You must have at least one field.', 'give'), |
|
259 | 259 | /* translators: %s: form singular label */ |
260 | - 'one_option' => sprintf( esc_html__( 'Choose a %s', 'give' ), give_get_forms_label_singular() ), |
|
260 | + 'one_option' => sprintf(esc_html__('Choose a %s', 'give'), give_get_forms_label_singular()), |
|
261 | 261 | /* translators: %s: form plural label */ |
262 | - 'one_or_more_option' => sprintf( esc_html__( 'Choose one or more %s', 'give' ), give_get_forms_label_plural() ), |
|
263 | - 'numeric_item_price' => esc_html__( 'Item price must be numeric.', 'give' ), |
|
264 | - 'numeric_quantity' => esc_html__( 'Quantity must be numeric.', 'give' ), |
|
265 | - 'currency_sign' => give_currency_filter( '' ), |
|
266 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
262 | + 'one_or_more_option' => sprintf(esc_html__('Choose one or more %s', 'give'), give_get_forms_label_plural()), |
|
263 | + 'numeric_item_price' => esc_html__('Item price must be numeric.', 'give'), |
|
264 | + 'numeric_quantity' => esc_html__('Quantity must be numeric.', 'give'), |
|
265 | + 'currency_sign' => give_currency_filter(''), |
|
266 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
267 | 267 | 'currency_decimals' => give_currency_decimal_filter(), |
268 | - 'new_media_ui' => apply_filters( 'give_use_35_media_ui', 1 ), |
|
269 | - 'remove_text' => esc_html__( 'Remove', 'give' ), |
|
268 | + 'new_media_ui' => apply_filters('give_use_35_media_ui', 1), |
|
269 | + 'remove_text' => esc_html__('Remove', 'give'), |
|
270 | 270 | /* translators: %s: form plural label */ |
271 | - 'type_to_search' => sprintf( esc_html__( 'Type to search %s', 'give' ), give_get_forms_label_plural() ), |
|
272 | - 'batch_export_no_class' => esc_html__( 'You must choose a method.', 'give' ), |
|
273 | - 'batch_export_no_reqs' => esc_html__( 'Required fields not completed.', 'give' ), |
|
274 | - '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' ), |
|
275 | - ) ); |
|
271 | + 'type_to_search' => sprintf(esc_html__('Type to search %s', 'give'), give_get_forms_label_plural()), |
|
272 | + 'batch_export_no_class' => esc_html__('You must choose a method.', 'give'), |
|
273 | + 'batch_export_no_reqs' => esc_html__('Required fields not completed.', 'give'), |
|
274 | + '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'), |
|
275 | + )); |
|
276 | 276 | |
277 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( $wp_version, '3.5', '>=' ) ) { |
|
277 | + if (function_exists('wp_enqueue_media') && version_compare($wp_version, '3.5', '>=')) { |
|
278 | 278 | //call for new media manager |
279 | 279 | wp_enqueue_media(); |
280 | 280 | } |
281 | 281 | |
282 | 282 | } |
283 | 283 | |
284 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
284 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
285 | 285 | |
286 | 286 | /** |
287 | 287 | * Admin Give Icon |
@@ -298,14 +298,14 @@ discard block |
||
298 | 298 | ?> |
299 | 299 | <style type="text/css" media="screen"> |
300 | 300 | |
301 | - <?php if( version_compare( $wp_version, '3.8-RC', '>=' ) || version_compare( $wp_version, '3.8', '>=' ) ) { ?> |
|
301 | + <?php if (version_compare($wp_version, '3.8-RC', '>=') || version_compare($wp_version, '3.8', '>=')) { ?> |
|
302 | 302 | @font-face { |
303 | 303 | font-family: 'give-icomoon'; |
304 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
305 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
306 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
307 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'), |
|
308 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
304 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
305 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
306 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
307 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'), |
|
308 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
309 | 309 | font-weight: normal; |
310 | 310 | font-style: normal; |
311 | 311 | } |
@@ -324,4 +324,4 @@ discard block |
||
324 | 324 | <?php |
325 | 325 | } |
326 | 326 | |
327 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
327 | +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 | |
@@ -97,29 +97,29 @@ discard block |
||
97 | 97 | * @param bool $_id_or_email |
98 | 98 | * @param bool $by_user_id |
99 | 99 | */ |
100 | - public function __construct( $_id_or_email = false, $by_user_id = false ) { |
|
100 | + public function __construct($_id_or_email = false, $by_user_id = false) { |
|
101 | 101 | |
102 | 102 | $this->db = new Give_DB_Customers; |
103 | 103 | |
104 | - if ( false === $_id_or_email || ( is_numeric( $_id_or_email ) && (int) $_id_or_email !== absint( $_id_or_email ) ) ) { |
|
104 | + if (false === $_id_or_email || (is_numeric($_id_or_email) && (int) $_id_or_email !== absint($_id_or_email))) { |
|
105 | 105 | return false; |
106 | 106 | } |
107 | 107 | |
108 | - $by_user_id = is_bool( $by_user_id ) ? $by_user_id : false; |
|
108 | + $by_user_id = is_bool($by_user_id) ? $by_user_id : false; |
|
109 | 109 | |
110 | - if ( is_numeric( $_id_or_email ) ) { |
|
110 | + if (is_numeric($_id_or_email)) { |
|
111 | 111 | $field = $by_user_id ? 'user_id' : 'id'; |
112 | 112 | } else { |
113 | 113 | $field = 'email'; |
114 | 114 | } |
115 | 115 | |
116 | - $customer = $this->db->get_customer_by( $field, $_id_or_email ); |
|
116 | + $customer = $this->db->get_customer_by($field, $_id_or_email); |
|
117 | 117 | |
118 | - if ( empty( $customer ) || ! is_object( $customer ) ) { |
|
118 | + if (empty($customer) || ! is_object($customer)) { |
|
119 | 119 | return false; |
120 | 120 | } |
121 | 121 | |
122 | - $this->setup_customer( $customer ); |
|
122 | + $this->setup_customer($customer); |
|
123 | 123 | |
124 | 124 | } |
125 | 125 | |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @return bool If the setup was successful or not |
134 | 134 | */ |
135 | - private function setup_customer( $customer ) { |
|
135 | + private function setup_customer($customer) { |
|
136 | 136 | |
137 | - if ( ! is_object( $customer ) ) { |
|
137 | + if ( ! is_object($customer)) { |
|
138 | 138 | return false; |
139 | 139 | } |
140 | 140 | |
141 | - foreach ( $customer as $key => $value ) { |
|
141 | + foreach ($customer as $key => $value) { |
|
142 | 142 | |
143 | - switch ( $key ) { |
|
143 | + switch ($key) { |
|
144 | 144 | |
145 | 145 | case 'notes': |
146 | 146 | $this->$key = $this->get_notes(); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | // Customer ID and email are the only things that are necessary, make sure they exist |
158 | - if ( ! empty( $this->id ) && ! empty( $this->email ) ) { |
|
158 | + if ( ! empty($this->id) && ! empty($this->email)) { |
|
159 | 159 | return true; |
160 | 160 | } |
161 | 161 | |
@@ -168,16 +168,16 @@ discard block |
||
168 | 168 | * |
169 | 169 | * @since 1.0 |
170 | 170 | */ |
171 | - public function __get( $key ) { |
|
171 | + public function __get($key) { |
|
172 | 172 | |
173 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
173 | + if (method_exists($this, 'get_'.$key)) { |
|
174 | 174 | |
175 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
175 | + return call_user_func(array($this, 'get_'.$key)); |
|
176 | 176 | |
177 | 177 | } else { |
178 | 178 | |
179 | 179 | /* translators: %s: property key */ |
180 | - return new WP_Error( 'give-customer-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
180 | + return new WP_Error('give-customer-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
181 | 181 | |
182 | 182 | } |
183 | 183 | |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @return mixed False if not a valid creation, Customer ID if user is found or valid creation |
194 | 194 | */ |
195 | - public function create( $data = array() ) { |
|
195 | + public function create($data = array()) { |
|
196 | 196 | |
197 | - if ( $this->id != 0 || empty( $data ) ) { |
|
197 | + if ($this->id != 0 || empty($data)) { |
|
198 | 198 | return false; |
199 | 199 | } |
200 | 200 | |
@@ -202,34 +202,34 @@ discard block |
||
202 | 202 | 'payment_ids' => '' |
203 | 203 | ); |
204 | 204 | |
205 | - $args = wp_parse_args( $data, $defaults ); |
|
206 | - $args = $this->sanitize_columns( $args ); |
|
205 | + $args = wp_parse_args($data, $defaults); |
|
206 | + $args = $this->sanitize_columns($args); |
|
207 | 207 | |
208 | - if ( empty( $args['email'] ) || ! is_email( $args['email'] ) ) { |
|
208 | + if (empty($args['email']) || ! is_email($args['email'])) { |
|
209 | 209 | return false; |
210 | 210 | } |
211 | 211 | |
212 | - if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) { |
|
213 | - $args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) ); |
|
212 | + if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) { |
|
213 | + $args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids']))); |
|
214 | 214 | } |
215 | 215 | |
216 | - do_action( 'give_customer_pre_create', $args ); |
|
216 | + do_action('give_customer_pre_create', $args); |
|
217 | 217 | |
218 | 218 | $created = false; |
219 | 219 | |
220 | 220 | // The DB class 'add' implies an update if the customer being asked to be created already exists |
221 | - if ( $this->db->add( $data ) ) { |
|
221 | + if ($this->db->add($data)) { |
|
222 | 222 | |
223 | 223 | // We've successfully added/updated the customer, reset the class vars with the new data |
224 | - $customer = $this->db->get_customer_by( 'email', $args['email'] ); |
|
224 | + $customer = $this->db->get_customer_by('email', $args['email']); |
|
225 | 225 | |
226 | 226 | // Setup the customer data with the values from DB |
227 | - $this->setup_customer( $customer ); |
|
227 | + $this->setup_customer($customer); |
|
228 | 228 | |
229 | 229 | $created = $this->id; |
230 | 230 | } |
231 | 231 | |
232 | - do_action( 'give_customer_post_create', $created, $args ); |
|
232 | + do_action('give_customer_post_create', $created, $args); |
|
233 | 233 | |
234 | 234 | return $created; |
235 | 235 | |
@@ -244,27 +244,27 @@ discard block |
||
244 | 244 | * |
245 | 245 | * @return bool If the update was successful or not |
246 | 246 | */ |
247 | - public function update( $data = array() ) { |
|
247 | + public function update($data = array()) { |
|
248 | 248 | |
249 | - if ( empty( $data ) ) { |
|
249 | + if (empty($data)) { |
|
250 | 250 | return false; |
251 | 251 | } |
252 | 252 | |
253 | - $data = $this->sanitize_columns( $data ); |
|
253 | + $data = $this->sanitize_columns($data); |
|
254 | 254 | |
255 | - do_action( 'give_customer_pre_update', $this->id, $data ); |
|
255 | + do_action('give_customer_pre_update', $this->id, $data); |
|
256 | 256 | |
257 | 257 | $updated = false; |
258 | 258 | |
259 | - if ( $this->db->update( $this->id, $data ) ) { |
|
259 | + if ($this->db->update($this->id, $data)) { |
|
260 | 260 | |
261 | - $customer = $this->db->get_customer_by( 'id', $this->id ); |
|
262 | - $this->setup_customer( $customer ); |
|
261 | + $customer = $this->db->get_customer_by('id', $this->id); |
|
262 | + $this->setup_customer($customer); |
|
263 | 263 | |
264 | 264 | $updated = true; |
265 | 265 | } |
266 | 266 | |
267 | - do_action( 'give_customer_post_update', $updated, $this->id, $data ); |
|
267 | + do_action('give_customer_post_update', $updated, $this->id, $data); |
|
268 | 268 | |
269 | 269 | return $updated; |
270 | 270 | } |
@@ -280,44 +280,44 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @return bool If the attachment was successfuly |
282 | 282 | */ |
283 | - public function attach_payment( $payment_id = 0, $update_stats = true ) { |
|
283 | + public function attach_payment($payment_id = 0, $update_stats = true) { |
|
284 | 284 | |
285 | - if ( empty( $payment_id ) ) { |
|
285 | + if (empty($payment_id)) { |
|
286 | 286 | return false; |
287 | 287 | } |
288 | 288 | |
289 | - if ( empty( $this->payment_ids ) ) { |
|
289 | + if (empty($this->payment_ids)) { |
|
290 | 290 | |
291 | 291 | $new_payment_ids = $payment_id; |
292 | 292 | |
293 | 293 | } else { |
294 | 294 | |
295 | - $payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) ); |
|
295 | + $payment_ids = array_map('absint', explode(',', $this->payment_ids)); |
|
296 | 296 | |
297 | - if ( in_array( $payment_id, $payment_ids ) ) { |
|
297 | + if (in_array($payment_id, $payment_ids)) { |
|
298 | 298 | $update_stats = false; |
299 | 299 | } |
300 | 300 | |
301 | 301 | $payment_ids[] = $payment_id; |
302 | 302 | |
303 | - $new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) ); |
|
303 | + $new_payment_ids = implode(',', array_unique(array_values($payment_ids))); |
|
304 | 304 | |
305 | 305 | } |
306 | 306 | |
307 | - do_action( 'give_customer_pre_attach_payment', $payment_id, $this->id ); |
|
307 | + do_action('give_customer_pre_attach_payment', $payment_id, $this->id); |
|
308 | 308 | |
309 | - $payment_added = $this->update( array( 'payment_ids' => $new_payment_ids ) ); |
|
309 | + $payment_added = $this->update(array('payment_ids' => $new_payment_ids)); |
|
310 | 310 | |
311 | - if ( $payment_added ) { |
|
311 | + if ($payment_added) { |
|
312 | 312 | |
313 | 313 | $this->payment_ids = $new_payment_ids; |
314 | 314 | |
315 | 315 | // We added this payment successfully, increment the stats |
316 | - if ( $update_stats ) { |
|
317 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
316 | + if ($update_stats) { |
|
317 | + $payment_amount = give_get_payment_amount($payment_id); |
|
318 | 318 | |
319 | - if ( ! empty( $payment_amount ) ) { |
|
320 | - $this->increase_value( $payment_amount ); |
|
319 | + if ( ! empty($payment_amount)) { |
|
320 | + $this->increase_value($payment_amount); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | $this->increase_purchase_count(); |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | |
326 | 326 | } |
327 | 327 | |
328 | - do_action( 'give_customer_post_attach_payment', $payment_added, $payment_id, $this->id ); |
|
328 | + do_action('give_customer_post_attach_payment', $payment_added, $payment_id, $this->id); |
|
329 | 329 | |
330 | 330 | return $payment_added; |
331 | 331 | } |
@@ -341,50 +341,50 @@ discard block |
||
341 | 341 | * |
342 | 342 | * @return boolean If the removal was successful |
343 | 343 | */ |
344 | - public function remove_payment( $payment_id = 0, $update_stats = true ) { |
|
344 | + public function remove_payment($payment_id = 0, $update_stats = true) { |
|
345 | 345 | |
346 | - if ( empty( $payment_id ) ) { |
|
346 | + if (empty($payment_id)) { |
|
347 | 347 | return false; |
348 | 348 | } |
349 | 349 | |
350 | - $payment = new Give_Payment( $payment_id ); |
|
350 | + $payment = new Give_Payment($payment_id); |
|
351 | 351 | |
352 | - if ( 'publish' !== $payment->status && 'revoked' !== $payment->status ) { |
|
352 | + if ('publish' !== $payment->status && 'revoked' !== $payment->status) { |
|
353 | 353 | $update_stats = false; |
354 | 354 | } |
355 | 355 | |
356 | 356 | $new_payment_ids = ''; |
357 | 357 | |
358 | - if ( ! empty( $this->payment_ids ) ) { |
|
358 | + if ( ! empty($this->payment_ids)) { |
|
359 | 359 | |
360 | - $payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) ); |
|
360 | + $payment_ids = array_map('absint', explode(',', $this->payment_ids)); |
|
361 | 361 | |
362 | - $pos = array_search( $payment_id, $payment_ids ); |
|
363 | - if ( false === $pos ) { |
|
362 | + $pos = array_search($payment_id, $payment_ids); |
|
363 | + if (false === $pos) { |
|
364 | 364 | return false; |
365 | 365 | } |
366 | 366 | |
367 | - unset( $payment_ids[ $pos ] ); |
|
368 | - $payment_ids = array_filter( $payment_ids ); |
|
367 | + unset($payment_ids[$pos]); |
|
368 | + $payment_ids = array_filter($payment_ids); |
|
369 | 369 | |
370 | - $new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) ); |
|
370 | + $new_payment_ids = implode(',', array_unique(array_values($payment_ids))); |
|
371 | 371 | |
372 | 372 | } |
373 | 373 | |
374 | - do_action( 'give_customer_pre_remove_payment', $payment_id, $this->id ); |
|
374 | + do_action('give_customer_pre_remove_payment', $payment_id, $this->id); |
|
375 | 375 | |
376 | - $payment_removed = $this->update( array( 'payment_ids' => $new_payment_ids ) ); |
|
376 | + $payment_removed = $this->update(array('payment_ids' => $new_payment_ids)); |
|
377 | 377 | |
378 | - if ( $payment_removed ) { |
|
378 | + if ($payment_removed) { |
|
379 | 379 | |
380 | 380 | $this->payment_ids = $new_payment_ids; |
381 | 381 | |
382 | - if ( $update_stats ) { |
|
382 | + if ($update_stats) { |
|
383 | 383 | // We removed this payment successfully, decrement the stats |
384 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
384 | + $payment_amount = give_get_payment_amount($payment_id); |
|
385 | 385 | |
386 | - if ( ! empty( $payment_amount ) ) { |
|
387 | - $this->decrease_value( $payment_amount ); |
|
386 | + if ( ! empty($payment_amount)) { |
|
387 | + $this->decrease_value($payment_amount); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | $this->decrease_purchase_count(); |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | |
393 | 393 | } |
394 | 394 | |
395 | - do_action( 'give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id ); |
|
395 | + do_action('give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id); |
|
396 | 396 | |
397 | 397 | return $payment_removed; |
398 | 398 | |
@@ -407,22 +407,22 @@ discard block |
||
407 | 407 | * |
408 | 408 | * @return int The purchase count |
409 | 409 | */ |
410 | - public function increase_purchase_count( $count = 1 ) { |
|
410 | + public function increase_purchase_count($count = 1) { |
|
411 | 411 | |
412 | 412 | // Make sure it's numeric and not negative |
413 | - if ( ! is_numeric( $count ) || $count != absint( $count ) ) { |
|
413 | + if ( ! is_numeric($count) || $count != absint($count)) { |
|
414 | 414 | return false; |
415 | 415 | } |
416 | 416 | |
417 | 417 | $new_total = (int) $this->purchase_count + (int) $count; |
418 | 418 | |
419 | - do_action( 'give_customer_pre_increase_purchase_count', $count, $this->id ); |
|
419 | + do_action('give_customer_pre_increase_purchase_count', $count, $this->id); |
|
420 | 420 | |
421 | - if ( $this->update( array( 'purchase_count' => $new_total ) ) ) { |
|
421 | + if ($this->update(array('purchase_count' => $new_total))) { |
|
422 | 422 | $this->purchase_count = $new_total; |
423 | 423 | } |
424 | 424 | |
425 | - do_action( 'give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id ); |
|
425 | + do_action('give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id); |
|
426 | 426 | |
427 | 427 | return $this->purchase_count; |
428 | 428 | } |
@@ -436,26 +436,26 @@ discard block |
||
436 | 436 | * |
437 | 437 | * @return mixed If successful, the new count, otherwise false |
438 | 438 | */ |
439 | - public function decrease_purchase_count( $count = 1 ) { |
|
439 | + public function decrease_purchase_count($count = 1) { |
|
440 | 440 | |
441 | 441 | // Make sure it's numeric and not negative |
442 | - if ( ! is_numeric( $count ) || $count != absint( $count ) ) { |
|
442 | + if ( ! is_numeric($count) || $count != absint($count)) { |
|
443 | 443 | return false; |
444 | 444 | } |
445 | 445 | |
446 | 446 | $new_total = (int) $this->purchase_count - (int) $count; |
447 | 447 | |
448 | - if ( $new_total < 0 ) { |
|
448 | + if ($new_total < 0) { |
|
449 | 449 | $new_total = 0; |
450 | 450 | } |
451 | 451 | |
452 | - do_action( 'give_customer_pre_decrease_purchase_count', $count, $this->id ); |
|
452 | + do_action('give_customer_pre_decrease_purchase_count', $count, $this->id); |
|
453 | 453 | |
454 | - if ( $this->update( array( 'purchase_count' => $new_total ) ) ) { |
|
454 | + if ($this->update(array('purchase_count' => $new_total))) { |
|
455 | 455 | $this->purchase_count = $new_total; |
456 | 456 | } |
457 | 457 | |
458 | - do_action( 'give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id ); |
|
458 | + do_action('give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id); |
|
459 | 459 | |
460 | 460 | return $this->purchase_count; |
461 | 461 | } |
@@ -469,17 +469,17 @@ discard block |
||
469 | 469 | * |
470 | 470 | * @return mixed If successful, the new value, otherwise false |
471 | 471 | */ |
472 | - public function increase_value( $value = 0.00 ) { |
|
472 | + public function increase_value($value = 0.00) { |
|
473 | 473 | |
474 | - $new_value = floatval( $this->purchase_value ) + $value; |
|
474 | + $new_value = floatval($this->purchase_value) + $value; |
|
475 | 475 | |
476 | - do_action( 'give_customer_pre_increase_value', $value, $this->id ); |
|
476 | + do_action('give_customer_pre_increase_value', $value, $this->id); |
|
477 | 477 | |
478 | - if ( $this->update( array( 'purchase_value' => $new_value ) ) ) { |
|
478 | + if ($this->update(array('purchase_value' => $new_value))) { |
|
479 | 479 | $this->purchase_value = $new_value; |
480 | 480 | } |
481 | 481 | |
482 | - do_action( 'give_customer_post_increase_value', $this->purchase_value, $value, $this->id ); |
|
482 | + do_action('give_customer_post_increase_value', $this->purchase_value, $value, $this->id); |
|
483 | 483 | |
484 | 484 | return $this->purchase_value; |
485 | 485 | } |
@@ -493,21 +493,21 @@ discard block |
||
493 | 493 | * |
494 | 494 | * @return mixed If successful, the new value, otherwise false |
495 | 495 | */ |
496 | - public function decrease_value( $value = 0.00 ) { |
|
496 | + public function decrease_value($value = 0.00) { |
|
497 | 497 | |
498 | - $new_value = floatval( $this->purchase_value ) - $value; |
|
498 | + $new_value = floatval($this->purchase_value) - $value; |
|
499 | 499 | |
500 | - if ( $new_value < 0 ) { |
|
500 | + if ($new_value < 0) { |
|
501 | 501 | $new_value = 0.00; |
502 | 502 | } |
503 | 503 | |
504 | - do_action( 'give_customer_pre_decrease_value', $value, $this->id ); |
|
504 | + do_action('give_customer_pre_decrease_value', $value, $this->id); |
|
505 | 505 | |
506 | - if ( $this->update( array( 'purchase_value' => $new_value ) ) ) { |
|
506 | + if ($this->update(array('purchase_value' => $new_value))) { |
|
507 | 507 | $this->purchase_value = $new_value; |
508 | 508 | } |
509 | 509 | |
510 | - do_action( 'give_customer_post_decrease_value', $this->purchase_value, $value, $this->id ); |
|
510 | + do_action('give_customer_post_decrease_value', $this->purchase_value, $value, $this->id); |
|
511 | 511 | |
512 | 512 | return $this->purchase_value; |
513 | 513 | } |
@@ -522,15 +522,15 @@ discard block |
||
522 | 522 | * |
523 | 523 | * @return array The notes requsted |
524 | 524 | */ |
525 | - public function get_notes( $length = 20, $paged = 1 ) { |
|
525 | + public function get_notes($length = 20, $paged = 1) { |
|
526 | 526 | |
527 | - $length = is_numeric( $length ) ? $length : 20; |
|
528 | - $offset = is_numeric( $paged ) && $paged != 1 ? ( ( absint( $paged ) - 1 ) * $length ) : 0; |
|
527 | + $length = is_numeric($length) ? $length : 20; |
|
528 | + $offset = is_numeric($paged) && $paged != 1 ? ((absint($paged) - 1) * $length) : 0; |
|
529 | 529 | |
530 | 530 | $all_notes = $this->get_raw_notes(); |
531 | - $notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) ); |
|
531 | + $notes_array = array_reverse(array_filter(explode("\n\n", $all_notes))); |
|
532 | 532 | |
533 | - $desired_notes = array_slice( $notes_array, $offset, $length ); |
|
533 | + $desired_notes = array_slice($notes_array, $offset, $length); |
|
534 | 534 | |
535 | 535 | return $desired_notes; |
536 | 536 | |
@@ -545,9 +545,9 @@ discard block |
||
545 | 545 | public function get_notes_count() { |
546 | 546 | |
547 | 547 | $all_notes = $this->get_raw_notes(); |
548 | - $notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) ); |
|
548 | + $notes_array = array_reverse(array_filter(explode("\n\n", $all_notes))); |
|
549 | 549 | |
550 | - return count( $notes_array ); |
|
550 | + return count($notes_array); |
|
551 | 551 | |
552 | 552 | } |
553 | 553 | |
@@ -560,32 +560,32 @@ discard block |
||
560 | 560 | * |
561 | 561 | * @return string|boolean The new note if added succesfully, false otherwise |
562 | 562 | */ |
563 | - public function add_note( $note = '' ) { |
|
563 | + public function add_note($note = '') { |
|
564 | 564 | |
565 | - $note = trim( $note ); |
|
566 | - if ( empty( $note ) ) { |
|
565 | + $note = trim($note); |
|
566 | + if (empty($note)) { |
|
567 | 567 | return false; |
568 | 568 | } |
569 | 569 | |
570 | 570 | $notes = $this->get_raw_notes(); |
571 | 571 | |
572 | - if ( empty( $notes ) ) { |
|
572 | + if (empty($notes)) { |
|
573 | 573 | $notes = ''; |
574 | 574 | } |
575 | 575 | |
576 | - $note_string = date_i18n( 'F j, Y H:i:s', current_time( 'timestamp' ) ) . ' - ' . $note; |
|
577 | - $new_note = apply_filters( 'give_customer_add_note_string', $note_string ); |
|
578 | - $notes .= "\n\n" . $new_note; |
|
576 | + $note_string = date_i18n('F j, Y H:i:s', current_time('timestamp')).' - '.$note; |
|
577 | + $new_note = apply_filters('give_customer_add_note_string', $note_string); |
|
578 | + $notes .= "\n\n".$new_note; |
|
579 | 579 | |
580 | - do_action( 'give_customer_pre_add_note', $new_note, $this->id ); |
|
580 | + do_action('give_customer_pre_add_note', $new_note, $this->id); |
|
581 | 581 | |
582 | - $updated = $this->update( array( 'notes' => $notes ) ); |
|
582 | + $updated = $this->update(array('notes' => $notes)); |
|
583 | 583 | |
584 | - if ( $updated ) { |
|
584 | + if ($updated) { |
|
585 | 585 | $this->notes = $this->get_notes(); |
586 | 586 | } |
587 | 587 | |
588 | - do_action( 'give_customer_post_add_note', $this->notes, $new_note, $this->id ); |
|
588 | + do_action('give_customer_post_add_note', $this->notes, $new_note, $this->id); |
|
589 | 589 | |
590 | 590 | // Return the formatted note, so we can test, as well as update any displays |
591 | 591 | return $new_note; |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | */ |
601 | 601 | private function get_raw_notes() { |
602 | 602 | |
603 | - $all_notes = $this->db->get_column( 'notes', $this->id ); |
|
603 | + $all_notes = $this->db->get_column('notes', $this->id); |
|
604 | 604 | |
605 | 605 | return $all_notes; |
606 | 606 | |
@@ -615,51 +615,51 @@ discard block |
||
615 | 615 | * |
616 | 616 | * @return array The sanitized data, based off column defaults |
617 | 617 | */ |
618 | - private function sanitize_columns( $data ) { |
|
618 | + private function sanitize_columns($data) { |
|
619 | 619 | |
620 | 620 | $columns = $this->db->get_columns(); |
621 | 621 | $default_values = $this->db->get_column_defaults(); |
622 | 622 | |
623 | - foreach ( $columns as $key => $type ) { |
|
623 | + foreach ($columns as $key => $type) { |
|
624 | 624 | |
625 | 625 | // Only sanitize data that we were provided |
626 | - if ( ! array_key_exists( $key, $data ) ) { |
|
626 | + if ( ! array_key_exists($key, $data)) { |
|
627 | 627 | continue; |
628 | 628 | } |
629 | 629 | |
630 | - switch ( $type ) { |
|
630 | + switch ($type) { |
|
631 | 631 | |
632 | 632 | case '%s': |
633 | - if ( 'email' == $key ) { |
|
634 | - $data[ $key ] = sanitize_email( $data[ $key ] ); |
|
635 | - } elseif ( 'notes' == $key ) { |
|
636 | - $data[ $key ] = strip_tags( $data[ $key ] ); |
|
633 | + if ('email' == $key) { |
|
634 | + $data[$key] = sanitize_email($data[$key]); |
|
635 | + } elseif ('notes' == $key) { |
|
636 | + $data[$key] = strip_tags($data[$key]); |
|
637 | 637 | } else { |
638 | - $data[ $key ] = sanitize_text_field( $data[ $key ] ); |
|
638 | + $data[$key] = sanitize_text_field($data[$key]); |
|
639 | 639 | } |
640 | 640 | break; |
641 | 641 | |
642 | 642 | case '%d': |
643 | - if ( ! is_numeric( $data[ $key ] ) || (int) $data[ $key ] !== absint( $data[ $key ] ) ) { |
|
644 | - $data[ $key ] = $default_values[ $key ]; |
|
643 | + if ( ! is_numeric($data[$key]) || (int) $data[$key] !== absint($data[$key])) { |
|
644 | + $data[$key] = $default_values[$key]; |
|
645 | 645 | } else { |
646 | - $data[ $key ] = absint( $data[ $key ] ); |
|
646 | + $data[$key] = absint($data[$key]); |
|
647 | 647 | } |
648 | 648 | break; |
649 | 649 | |
650 | 650 | case '%f': |
651 | 651 | // Convert what was given to a float |
652 | - $value = floatval( $data[ $key ] ); |
|
652 | + $value = floatval($data[$key]); |
|
653 | 653 | |
654 | - if ( ! is_float( $value ) ) { |
|
655 | - $data[ $key ] = $default_values[ $key ]; |
|
654 | + if ( ! is_float($value)) { |
|
655 | + $data[$key] = $default_values[$key]; |
|
656 | 656 | } else { |
657 | - $data[ $key ] = $value; |
|
657 | + $data[$key] = $value; |
|
658 | 658 | } |
659 | 659 | break; |
660 | 660 | |
661 | 661 | default: |
662 | - $data[ $key ] = sanitize_text_field( $data[ $key ] ); |
|
662 | + $data[$key] = sanitize_text_field($data[$key]); |
|
663 | 663 | break; |
664 | 664 | |
665 | 665 | } |
@@ -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 | |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | function give_is_test_mode() { |
25 | 25 | global $give_options; |
26 | 26 | |
27 | - $ret = ! empty( $give_options['test_mode'] ); |
|
27 | + $ret = ! empty($give_options['test_mode']); |
|
28 | 28 | |
29 | - return (bool) apply_filters( 'give_is_test_mode', $ret ); |
|
29 | + return (bool) apply_filters('give_is_test_mode', $ret); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function give_get_currency() { |
39 | 39 | global $give_options; |
40 | - $currency = isset( $give_options['currency'] ) ? $give_options['currency'] : 'USD'; |
|
40 | + $currency = isset($give_options['currency']) ? $give_options['currency'] : 'USD'; |
|
41 | 41 | |
42 | - return apply_filters( 'give_currency', $currency ); |
|
42 | + return apply_filters('give_currency', $currency); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | */ |
52 | 52 | function give_get_currency_position() { |
53 | 53 | global $give_options; |
54 | - $currency_pos = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
54 | + $currency_pos = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
55 | 55 | |
56 | - return apply_filters( 'give_currency_position', $currency_pos ); |
|
56 | + return apply_filters('give_currency_position', $currency_pos); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -66,39 +66,39 @@ discard block |
||
66 | 66 | |
67 | 67 | function give_get_currencies() { |
68 | 68 | $currencies = array( |
69 | - 'USD' => esc_html__( 'US Dollars ($)', 'give' ), |
|
70 | - 'EUR' => esc_html__( 'Euros (€)', 'give' ), |
|
71 | - 'GBP' => esc_html__( 'Pounds Sterling (£)', 'give' ), |
|
72 | - 'AUD' => esc_html__( 'Australian Dollars ($)', 'give' ), |
|
73 | - 'BRL' => esc_html__( 'Brazilian Real (R$)', 'give' ), |
|
74 | - 'CAD' => esc_html__( 'Canadian Dollars ($)', 'give' ), |
|
75 | - 'CZK' => esc_html__( 'Czech Koruna (Kč)', 'give' ), |
|
76 | - 'DKK' => esc_html__( 'Danish Krone (kr)', 'give' ), |
|
77 | - 'HKD' => esc_html__( 'Hong Kong Dollar ($)', 'give' ), |
|
78 | - 'HUF' => esc_html__( 'Hungarian Forint (Ft)', 'give' ), |
|
79 | - 'ILS' => esc_html__( 'Israeli Shekel (₪)', 'give' ), |
|
80 | - 'JPY' => esc_html__( 'Japanese Yen (¥)', 'give' ), |
|
81 | - 'MYR' => esc_html__( 'Malaysian Ringgits (RM)', 'give' ), |
|
82 | - 'MXN' => esc_html__( 'Mexican Peso ($)', 'give' ), |
|
83 | - 'MAD' => esc_html__( 'Moroccan Dirham (.د.م)', 'give' ), |
|
84 | - 'NZD' => esc_html__( 'New Zealand Dollar ($)', 'give' ), |
|
85 | - 'NOK' => esc_html__( 'Norwegian Krone (Kr.)', 'give' ), |
|
86 | - 'PHP' => esc_html__( 'Philippine Pesos (₱)', 'give' ), |
|
87 | - 'PLN' => esc_html__( 'Polish Zloty (zł)', 'give' ), |
|
88 | - 'SGD' => esc_html__( 'Singapore Dollar ($)', 'give' ), |
|
89 | - 'KRW' => esc_html__( 'South Korean Won (₩)', 'give' ), |
|
90 | - 'ZAR' => esc_html__( 'South African Rand (R)', 'give' ), |
|
91 | - 'SEK' => esc_html__( 'Swedish Krona (kr)', 'give' ), |
|
92 | - 'CHF' => esc_html__( 'Swiss Franc (CHF)', 'give' ), |
|
93 | - 'TWD' => esc_html__( 'Taiwan New Dollars (NT$)', 'give' ), |
|
94 | - 'THB' => esc_html__( 'Thai Baht (฿)', 'give' ), |
|
95 | - 'INR' => esc_html__( 'Indian Rupee (₹)', 'give' ), |
|
96 | - 'TRY' => esc_html__( 'Turkish Lira (₺)', 'give' ), |
|
97 | - 'RIAL' => esc_html__( 'Iranian Rial (﷼)', 'give' ), |
|
98 | - 'RUB' => esc_html__( 'Russian Rubles (руб)', 'give' ) |
|
69 | + 'USD' => esc_html__('US Dollars ($)', 'give'), |
|
70 | + 'EUR' => esc_html__('Euros (€)', 'give'), |
|
71 | + 'GBP' => esc_html__('Pounds Sterling (£)', 'give'), |
|
72 | + 'AUD' => esc_html__('Australian Dollars ($)', 'give'), |
|
73 | + 'BRL' => esc_html__('Brazilian Real (R$)', 'give'), |
|
74 | + 'CAD' => esc_html__('Canadian Dollars ($)', 'give'), |
|
75 | + 'CZK' => esc_html__('Czech Koruna (Kč)', 'give'), |
|
76 | + 'DKK' => esc_html__('Danish Krone (kr)', 'give'), |
|
77 | + 'HKD' => esc_html__('Hong Kong Dollar ($)', 'give'), |
|
78 | + 'HUF' => esc_html__('Hungarian Forint (Ft)', 'give'), |
|
79 | + 'ILS' => esc_html__('Israeli Shekel (₪)', 'give'), |
|
80 | + 'JPY' => esc_html__('Japanese Yen (¥)', 'give'), |
|
81 | + 'MYR' => esc_html__('Malaysian Ringgits (RM)', 'give'), |
|
82 | + 'MXN' => esc_html__('Mexican Peso ($)', 'give'), |
|
83 | + 'MAD' => esc_html__('Moroccan Dirham (.د.م)', 'give'), |
|
84 | + 'NZD' => esc_html__('New Zealand Dollar ($)', 'give'), |
|
85 | + 'NOK' => esc_html__('Norwegian Krone (Kr.)', 'give'), |
|
86 | + 'PHP' => esc_html__('Philippine Pesos (₱)', 'give'), |
|
87 | + 'PLN' => esc_html__('Polish Zloty (zł)', 'give'), |
|
88 | + 'SGD' => esc_html__('Singapore Dollar ($)', 'give'), |
|
89 | + 'KRW' => esc_html__('South Korean Won (₩)', 'give'), |
|
90 | + 'ZAR' => esc_html__('South African Rand (R)', 'give'), |
|
91 | + 'SEK' => esc_html__('Swedish Krona (kr)', 'give'), |
|
92 | + 'CHF' => esc_html__('Swiss Franc (CHF)', 'give'), |
|
93 | + 'TWD' => esc_html__('Taiwan New Dollars (NT$)', 'give'), |
|
94 | + 'THB' => esc_html__('Thai Baht (฿)', 'give'), |
|
95 | + 'INR' => esc_html__('Indian Rupee (₹)', 'give'), |
|
96 | + 'TRY' => esc_html__('Turkish Lira (₺)', 'give'), |
|
97 | + 'RIAL' => esc_html__('Iranian Rial (﷼)', 'give'), |
|
98 | + 'RUB' => esc_html__('Russian Rubles (руб)', 'give') |
|
99 | 99 | ); |
100 | 100 | |
101 | - return apply_filters( 'give_currencies', $currencies ); |
|
101 | + return apply_filters('give_currencies', $currencies); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return string The symbol to use for the currency |
115 | 115 | */ |
116 | -function give_currency_symbol( $currency = '' ) { |
|
116 | +function give_currency_symbol($currency = '') { |
|
117 | 117 | |
118 | - if ( empty( $currency ) ) { |
|
118 | + if (empty($currency)) { |
|
119 | 119 | $currency = give_get_currency(); |
120 | 120 | } |
121 | - switch ( $currency ) : |
|
121 | + switch ($currency) : |
|
122 | 122 | case 'GBP' : |
123 | 123 | $symbol = '£'; |
124 | 124 | break; |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | endswitch; |
198 | 198 | |
199 | 199 | |
200 | - return apply_filters( 'give_currency_symbol', $symbol, $currency ); |
|
200 | + return apply_filters('give_currency_symbol', $symbol, $currency); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
@@ -209,13 +209,13 @@ discard block |
||
209 | 209 | */ |
210 | 210 | function give_get_current_page_url() { |
211 | 211 | |
212 | - if ( is_front_page() ) { |
|
213 | - $current_url = home_url( '/' ); |
|
212 | + if (is_front_page()) { |
|
213 | + $current_url = home_url('/'); |
|
214 | 214 | } else { |
215 | - $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . untrailingslashit( $_SERVER['REQUEST_URI'] ) ); |
|
215 | + $current_url = set_url_scheme('http://'.$_SERVER['HTTP_HOST'].untrailingslashit($_SERVER['REQUEST_URI'])); |
|
216 | 216 | } |
217 | 217 | |
218 | - return apply_filters( 'give_get_current_page_url', esc_url( $current_url ) ); |
|
218 | + return apply_filters('give_get_current_page_url', esc_url($current_url)); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -236,15 +236,15 @@ discard block |
||
236 | 236 | */ |
237 | 237 | $gateways = give_get_enabled_payment_gateways(); |
238 | 238 | |
239 | - if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) { |
|
239 | + if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) { |
|
240 | 240 | $ret = true; |
241 | - } else if ( count( $gateways ) == 1 ) { |
|
241 | + } else if (count($gateways) == 1) { |
|
242 | 242 | $ret = false; |
243 | - } else if ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) { |
|
243 | + } else if (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) { |
|
244 | 244 | $ret = false; |
245 | 245 | } |
246 | 246 | |
247 | - return (bool) apply_filters( 'give_verify_credit_cards', $ret ); |
|
247 | + return (bool) apply_filters('give_verify_credit_cards', $ret); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
@@ -256,26 +256,26 @@ discard block |
||
256 | 256 | function give_get_timezone_id() { |
257 | 257 | |
258 | 258 | // if site timezone string exists, return it |
259 | - if ( $timezone = get_option( 'timezone_string' ) ) { |
|
259 | + if ($timezone = get_option('timezone_string')) { |
|
260 | 260 | return $timezone; |
261 | 261 | } |
262 | 262 | |
263 | 263 | // get UTC offset, if it isn't set return UTC |
264 | - if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) { |
|
264 | + if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) { |
|
265 | 265 | return 'UTC'; |
266 | 266 | } |
267 | 267 | |
268 | 268 | // attempt to guess the timezone string from the UTC offset |
269 | - $timezone = timezone_name_from_abbr( '', $utc_offset ); |
|
269 | + $timezone = timezone_name_from_abbr('', $utc_offset); |
|
270 | 270 | |
271 | 271 | // last try, guess timezone string manually |
272 | - if ( $timezone === false ) { |
|
272 | + if ($timezone === false) { |
|
273 | 273 | |
274 | - $is_dst = date( 'I' ); |
|
274 | + $is_dst = date('I'); |
|
275 | 275 | |
276 | - foreach ( timezone_abbreviations_list() as $abbr ) { |
|
277 | - foreach ( $abbr as $city ) { |
|
278 | - if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) { |
|
276 | + foreach (timezone_abbreviations_list() as $abbr) { |
|
277 | + foreach ($abbr as $city) { |
|
278 | + if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { |
|
279 | 279 | return $city['timezone_id']; |
280 | 280 | } |
281 | 281 | } |
@@ -299,17 +299,17 @@ discard block |
||
299 | 299 | |
300 | 300 | $ip = '127.0.0.1'; |
301 | 301 | |
302 | - if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { |
|
302 | + if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
303 | 303 | //check ip from share internet |
304 | 304 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
305 | - } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { |
|
305 | + } elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
306 | 306 | //to check ip is pass from proxy |
307 | 307 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
308 | - } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { |
|
308 | + } elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { |
|
309 | 309 | $ip = $_SERVER['REMOTE_ADDR']; |
310 | 310 | } |
311 | 311 | |
312 | - return apply_filters( 'give_get_ip', $ip ); |
|
312 | + return apply_filters('give_get_ip', $ip); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | * |
325 | 325 | * @uses Give()->session->set() |
326 | 326 | */ |
327 | -function give_set_purchase_session( $purchase_data = array() ) { |
|
328 | - Give()->session->set( 'give_purchase', $purchase_data ); |
|
329 | - Give()->session->set( 'give_email', $purchase_data['user_email'] ); |
|
327 | +function give_set_purchase_session($purchase_data = array()) { |
|
328 | + Give()->session->set('give_purchase', $purchase_data); |
|
329 | + Give()->session->set('give_email', $purchase_data['user_email']); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | /** |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | * @return mixed array | false |
341 | 341 | */ |
342 | 342 | function give_get_purchase_session() { |
343 | - return Give()->session->get( 'give_purchase' ); |
|
343 | + return Give()->session->get('give_purchase'); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -355,14 +355,14 @@ discard block |
||
355 | 355 | * |
356 | 356 | * @return string |
357 | 357 | */ |
358 | -function give_get_purchase_summary( $purchase_data, $email = true ) { |
|
358 | +function give_get_purchase_summary($purchase_data, $email = true) { |
|
359 | 359 | $summary = ''; |
360 | 360 | |
361 | - if ( $email ) { |
|
362 | - $summary .= $purchase_data['user_email'] . ' - '; |
|
361 | + if ($email) { |
|
362 | + $summary .= $purchase_data['user_email'].' - '; |
|
363 | 363 | } |
364 | 364 | |
365 | - $summary .= get_the_title( $purchase_data['post_data']['give-form-id'] ); |
|
365 | + $summary .= get_the_title($purchase_data['post_data']['give-form-id']); |
|
366 | 366 | |
367 | 367 | return $summary; |
368 | 368 | } |
@@ -379,31 +379,31 @@ discard block |
||
379 | 379 | function give_get_host() { |
380 | 380 | $host = false; |
381 | 381 | |
382 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
382 | + if (defined('WPE_APIKEY')) { |
|
383 | 383 | $host = 'WP Engine'; |
384 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
384 | + } elseif (defined('PAGELYBIN')) { |
|
385 | 385 | $host = 'Pagely'; |
386 | - } elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
386 | + } elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
387 | 387 | $host = 'ICDSoft'; |
388 | - } elseif ( DB_HOST == 'mysqlv5' ) { |
|
388 | + } elseif (DB_HOST == 'mysqlv5') { |
|
389 | 389 | $host = 'NetworkSolutions'; |
390 | - } elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
390 | + } elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
391 | 391 | $host = 'iPage'; |
392 | - } elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
392 | + } elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
393 | 393 | $host = 'IPower'; |
394 | - } elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
394 | + } elseif (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
395 | 395 | $host = 'MediaTemple Grid'; |
396 | - } elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
396 | + } elseif (strpos(DB_HOST, '.pair.com') !== false) { |
|
397 | 397 | $host = 'pair Networks'; |
398 | - } elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
398 | + } elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
399 | 399 | $host = 'Rackspace Cloud'; |
400 | - } elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
400 | + } elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
401 | 401 | $host = 'SysFix.eu Power Hosting'; |
402 | - } elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
402 | + } elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
403 | 403 | $host = 'Flywheel'; |
404 | 404 | } else { |
405 | 405 | // Adding a general fallback for data gathering |
406 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME']; |
|
406 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME']; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | return $host; |
@@ -419,67 +419,67 @@ discard block |
||
419 | 419 | * |
420 | 420 | * @return bool true if host matches, false if not |
421 | 421 | */ |
422 | -function give_is_host( $host = false ) { |
|
422 | +function give_is_host($host = false) { |
|
423 | 423 | |
424 | 424 | $return = false; |
425 | 425 | |
426 | - if ( $host ) { |
|
427 | - $host = str_replace( ' ', '', strtolower( $host ) ); |
|
426 | + if ($host) { |
|
427 | + $host = str_replace(' ', '', strtolower($host)); |
|
428 | 428 | |
429 | - switch ( $host ) { |
|
429 | + switch ($host) { |
|
430 | 430 | case 'wpengine': |
431 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
431 | + if (defined('WPE_APIKEY')) { |
|
432 | 432 | $return = true; |
433 | 433 | } |
434 | 434 | break; |
435 | 435 | case 'pagely': |
436 | - if ( defined( 'PAGELYBIN' ) ) { |
|
436 | + if (defined('PAGELYBIN')) { |
|
437 | 437 | $return = true; |
438 | 438 | } |
439 | 439 | break; |
440 | 440 | case 'icdsoft': |
441 | - if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
441 | + if (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
442 | 442 | $return = true; |
443 | 443 | } |
444 | 444 | break; |
445 | 445 | case 'networksolutions': |
446 | - if ( DB_HOST == 'mysqlv5' ) { |
|
446 | + if (DB_HOST == 'mysqlv5') { |
|
447 | 447 | $return = true; |
448 | 448 | } |
449 | 449 | break; |
450 | 450 | case 'ipage': |
451 | - if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
451 | + if (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
452 | 452 | $return = true; |
453 | 453 | } |
454 | 454 | break; |
455 | 455 | case 'ipower': |
456 | - if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
456 | + if (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
457 | 457 | $return = true; |
458 | 458 | } |
459 | 459 | break; |
460 | 460 | case 'mediatemplegrid': |
461 | - if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
461 | + if (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
462 | 462 | $return = true; |
463 | 463 | } |
464 | 464 | break; |
465 | 465 | case 'pairnetworks': |
466 | - if ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
466 | + if (strpos(DB_HOST, '.pair.com') !== false) { |
|
467 | 467 | $return = true; |
468 | 468 | } |
469 | 469 | break; |
470 | 470 | case 'rackspacecloud': |
471 | - if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
471 | + if (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
472 | 472 | $return = true; |
473 | 473 | } |
474 | 474 | break; |
475 | 475 | case 'sysfix.eu': |
476 | 476 | case 'sysfix.eupowerhosting': |
477 | - if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
477 | + if (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
478 | 478 | $return = true; |
479 | 479 | } |
480 | 480 | break; |
481 | 481 | case 'flywheel': |
482 | - if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
482 | + if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
483 | 483 | $return = true; |
484 | 484 | } |
485 | 485 | break; |
@@ -512,20 +512,20 @@ discard block |
||
512 | 512 | * @param string $replacement Optional. The function that should have been called |
513 | 513 | * @param array $backtrace Optional. Contains stack backtrace of deprecated function |
514 | 514 | */ |
515 | -function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) { |
|
516 | - do_action( 'give_deprecated_function_run', $function, $replacement, $version ); |
|
515 | +function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) { |
|
516 | + do_action('give_deprecated_function_run', $function, $replacement, $version); |
|
517 | 517 | |
518 | - $show_errors = current_user_can( 'manage_options' ); |
|
518 | + $show_errors = current_user_can('manage_options'); |
|
519 | 519 | |
520 | 520 | // Allow plugin to filter the output error trigger |
521 | - if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) { |
|
522 | - if ( ! is_null( $replacement ) ) { |
|
523 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) ); |
|
524 | - trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
521 | + if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) { |
|
522 | + if ( ! is_null($replacement)) { |
|
523 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement)); |
|
524 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
525 | 525 | // Alternatively we could dump this to a file. |
526 | 526 | } else { |
527 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) ); |
|
528 | - trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
527 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version)); |
|
528 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
529 | 529 | // Alternatively we could dump this to a file. |
530 | 530 | } |
531 | 531 | } |
@@ -539,8 +539,8 @@ discard block |
||
539 | 539 | * @return string $post_id |
540 | 540 | */ |
541 | 541 | function give_get_admin_post_id() { |
542 | - $post_id = isset( $_GET['post'] ) ? $_GET['post'] : null; |
|
543 | - if ( ! $post_id && isset( $_POST['post_id'] ) ) { |
|
542 | + $post_id = isset($_GET['post']) ? $_GET['post'] : null; |
|
543 | + if ( ! $post_id && isset($_POST['post_id'])) { |
|
544 | 544 | $post_id = $_POST['post_id']; |
545 | 545 | } |
546 | 546 | |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | * @return string Arg separator output |
555 | 555 | */ |
556 | 556 | function give_get_php_arg_separator_output() { |
557 | - return ini_get( 'arg_separator.output' ); |
|
557 | + return ini_get('arg_separator.output'); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | |
@@ -569,10 +569,10 @@ discard block |
||
569 | 569 | * |
570 | 570 | * @return string Short month name |
571 | 571 | */ |
572 | -function give_month_num_to_name( $n ) { |
|
573 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 ); |
|
572 | +function give_month_num_to_name($n) { |
|
573 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005); |
|
574 | 574 | |
575 | - return date_i18n( "M", $timestamp ); |
|
575 | + return date_i18n("M", $timestamp); |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | |
@@ -585,10 +585,10 @@ discard block |
||
585 | 585 | * |
586 | 586 | * @return bool Whether or not function is disabled. |
587 | 587 | */ |
588 | -function give_is_func_disabled( $function ) { |
|
589 | - $disabled = explode( ',', ini_get( 'disable_functions' ) ); |
|
588 | +function give_is_func_disabled($function) { |
|
589 | + $disabled = explode(',', ini_get('disable_functions')); |
|
590 | 590 | |
591 | - return in_array( $function, $disabled ); |
|
591 | + return in_array($function, $disabled); |
|
592 | 592 | } |
593 | 593 | |
594 | 594 | |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | |
604 | 604 | <form action="//givewp.us3.list-manage.com/subscribe/post?u=3ccb75d68bda4381e2f45794c&id=12a081aa13" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate> |
605 | 605 | <div class="give-newsletter-confirmation"> |
606 | - <p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p> |
|
606 | + <p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p> |
|
607 | 607 | </div> |
608 | 608 | |
609 | 609 | <table class="form-table give-newsletter-form"> |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | * |
700 | 700 | * @return mixed |
701 | 701 | */ |
702 | -function give_svg_icons( $icon ) { |
|
702 | +function give_svg_icons($icon) { |
|
703 | 703 | |
704 | 704 | // Store your SVGs in an associative array |
705 | 705 | $svgs = array( |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | ); |
712 | 712 | |
713 | 713 | // Return the chosen icon's SVG string |
714 | - return $svgs[ $icon ]; |
|
714 | + return $svgs[$icon]; |
|
715 | 715 | } |
716 | 716 | |
717 | 717 | /** |
@@ -723,15 +723,15 @@ discard block |
||
723 | 723 | * |
724 | 724 | * @return mixed |
725 | 725 | */ |
726 | -function modify_nav_menu_meta_box_object( $post_type ) { |
|
727 | - if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { |
|
726 | +function modify_nav_menu_meta_box_object($post_type) { |
|
727 | + if (isset($post_type->name) && $post_type->name == 'give_forms') { |
|
728 | 728 | $post_type->labels->name = 'Donation Forms'; |
729 | 729 | } |
730 | 730 | |
731 | 731 | return $post_type; |
732 | 732 | } |
733 | 733 | |
734 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' ); |
|
734 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); |
|
735 | 735 | |
736 | 736 | |
737 | 737 | /** |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | * @license http://opensource.org/licenses/MIT MIT |
745 | 745 | */ |
746 | 746 | |
747 | -if ( ! function_exists( 'array_column' ) ) { |
|
747 | +if ( ! function_exists('array_column')) { |
|
748 | 748 | /** |
749 | 749 | * Returns the values from a single column of the input array, identified by |
750 | 750 | * the $columnKey. |
@@ -763,56 +763,56 @@ discard block |
||
763 | 763 | * |
764 | 764 | * @return array |
765 | 765 | */ |
766 | - function array_column( $input = null, $columnKey = null, $indexKey = null ) { |
|
766 | + function array_column($input = null, $columnKey = null, $indexKey = null) { |
|
767 | 767 | // Using func_get_args() in order to check for proper number of |
768 | 768 | // parameters and trigger errors exactly as the built-in array_column() |
769 | 769 | // does in PHP 5.5. |
770 | 770 | $argc = func_num_args(); |
771 | 771 | $params = func_get_args(); |
772 | 772 | |
773 | - if ( $argc < 2 ) { |
|
774 | - trigger_error( "array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING ); |
|
773 | + if ($argc < 2) { |
|
774 | + trigger_error("array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING); |
|
775 | 775 | |
776 | 776 | return null; |
777 | 777 | } |
778 | 778 | |
779 | - if ( ! is_array( $params[0] ) ) { |
|
779 | + if ( ! is_array($params[0])) { |
|
780 | 780 | trigger_error( |
781 | - 'array_column() expects parameter 1 to be array, ' . gettype( $params[0] ) . ' given', |
|
781 | + 'array_column() expects parameter 1 to be array, '.gettype($params[0]).' given', |
|
782 | 782 | E_USER_WARNING |
783 | 783 | ); |
784 | 784 | |
785 | 785 | return null; |
786 | 786 | } |
787 | 787 | |
788 | - if ( ! is_int( $params[1] ) |
|
789 | - && ! is_float( $params[1] ) |
|
790 | - && ! is_string( $params[1] ) |
|
788 | + if ( ! is_int($params[1]) |
|
789 | + && ! is_float($params[1]) |
|
790 | + && ! is_string($params[1]) |
|
791 | 791 | && $params[1] !== null |
792 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
792 | + && ! (is_object($params[1]) && method_exists($params[1], '__toString')) |
|
793 | 793 | ) { |
794 | - trigger_error( 'array_column(): The column key should be either a string or an integer', E_USER_WARNING ); |
|
794 | + trigger_error('array_column(): The column key should be either a string or an integer', E_USER_WARNING); |
|
795 | 795 | |
796 | 796 | return false; |
797 | 797 | } |
798 | 798 | |
799 | - if ( isset( $params[2] ) |
|
800 | - && ! is_int( $params[2] ) |
|
801 | - && ! is_float( $params[2] ) |
|
802 | - && ! is_string( $params[2] ) |
|
803 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
799 | + if (isset($params[2]) |
|
800 | + && ! is_int($params[2]) |
|
801 | + && ! is_float($params[2]) |
|
802 | + && ! is_string($params[2]) |
|
803 | + && ! (is_object($params[2]) && method_exists($params[2], '__toString')) |
|
804 | 804 | ) { |
805 | - trigger_error( 'array_column(): The index key should be either a string or an integer', E_USER_WARNING ); |
|
805 | + trigger_error('array_column(): The index key should be either a string or an integer', E_USER_WARNING); |
|
806 | 806 | |
807 | 807 | return false; |
808 | 808 | } |
809 | 809 | |
810 | 810 | $paramsInput = $params[0]; |
811 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null; |
|
811 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null; |
|
812 | 812 | |
813 | 813 | $paramsIndexKey = null; |
814 | - if ( isset( $params[2] ) ) { |
|
815 | - if ( is_float( $params[2] ) || is_int( $params[2] ) ) { |
|
814 | + if (isset($params[2])) { |
|
815 | + if (is_float($params[2]) || is_int($params[2])) { |
|
816 | 816 | $paramsIndexKey = (int) $params[2]; |
817 | 817 | } else { |
818 | 818 | $paramsIndexKey = (string) $params[2]; |
@@ -821,26 +821,26 @@ discard block |
||
821 | 821 | |
822 | 822 | $resultArray = array(); |
823 | 823 | |
824 | - foreach ( $paramsInput as $row ) { |
|
824 | + foreach ($paramsInput as $row) { |
|
825 | 825 | $key = $value = null; |
826 | 826 | $keySet = $valueSet = false; |
827 | 827 | |
828 | - if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { |
|
828 | + if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { |
|
829 | 829 | $keySet = true; |
830 | - $key = (string) $row[ $paramsIndexKey ]; |
|
830 | + $key = (string) $row[$paramsIndexKey]; |
|
831 | 831 | } |
832 | 832 | |
833 | - if ( $paramsColumnKey === null ) { |
|
833 | + if ($paramsColumnKey === null) { |
|
834 | 834 | $valueSet = true; |
835 | 835 | $value = $row; |
836 | - } elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { |
|
836 | + } elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { |
|
837 | 837 | $valueSet = true; |
838 | - $value = $row[ $paramsColumnKey ]; |
|
838 | + $value = $row[$paramsColumnKey]; |
|
839 | 839 | } |
840 | 840 | |
841 | - if ( $valueSet ) { |
|
842 | - if ( $keySet ) { |
|
843 | - $resultArray[ $key ] = $value; |
|
841 | + if ($valueSet) { |
|
842 | + if ($keySet) { |
|
843 | + $resultArray[$key] = $value; |
|
844 | 844 | } else { |
845 | 845 | $resultArray[] = $value; |
846 | 846 | } |
@@ -862,40 +862,40 @@ discard block |
||
862 | 862 | * |
863 | 863 | * @return bool Whether the receipt is visible or not. |
864 | 864 | */ |
865 | -function give_can_view_receipt( $payment_key = '' ) { |
|
865 | +function give_can_view_receipt($payment_key = '') { |
|
866 | 866 | |
867 | 867 | $return = false; |
868 | 868 | |
869 | - if ( empty( $payment_key ) ) { |
|
869 | + if (empty($payment_key)) { |
|
870 | 870 | return $return; |
871 | 871 | } |
872 | 872 | |
873 | 873 | global $give_receipt_args; |
874 | 874 | |
875 | - $give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key ); |
|
875 | + $give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key); |
|
876 | 876 | |
877 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] ); |
|
877 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']); |
|
878 | 878 | |
879 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] ); |
|
879 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']); |
|
880 | 880 | |
881 | - if ( is_user_logged_in() ) { |
|
882 | - if ( $user_id === (int) get_current_user_id() ) { |
|
881 | + if (is_user_logged_in()) { |
|
882 | + if ($user_id === (int) get_current_user_id()) { |
|
883 | 883 | $return = true; |
884 | - } elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { |
|
884 | + } elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { |
|
885 | 885 | $return = true; |
886 | - } elseif ( current_user_can( 'view_give_sensitive_data' ) ) { |
|
886 | + } elseif (current_user_can('view_give_sensitive_data')) { |
|
887 | 887 | $return = true; |
888 | 888 | } |
889 | 889 | } |
890 | 890 | |
891 | 891 | $session = give_get_purchase_session(); |
892 | - if ( ! empty( $session ) && ! is_user_logged_in() ) { |
|
893 | - if ( $session['purchase_key'] === $payment_meta['key'] ) { |
|
892 | + if ( ! empty($session) && ! is_user_logged_in()) { |
|
893 | + if ($session['purchase_key'] === $payment_meta['key']) { |
|
894 | 894 | $return = true; |
895 | 895 | } |
896 | 896 | } |
897 | 897 | |
898 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key ); |
|
898 | + return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); |
|
899 | 899 | |
900 | 900 | } |
901 | 901 | |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | * |
905 | 905 | * @description: Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar |
906 | 906 | */ |
907 | -if ( ! function_exists( 'cal_days_in_month' ) ) { |
|
907 | +if ( ! function_exists('cal_days_in_month')) { |
|
908 | 908 | /** |
909 | 909 | * cal_days_in_month |
910 | 910 | * |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | * |
915 | 915 | * @return bool|string |
916 | 916 | */ |
917 | - function cal_days_in_month( $calendar, $month, $year ) { |
|
918 | - return date( 't', mktime( 0, 0, 0, $month, 1, $year ) ); |
|
917 | + function cal_days_in_month($calendar, $month, $year) { |
|
918 | + return date('t', mktime(0, 0, 0, $month, 1, $year)); |
|
919 | 919 | } |
920 | 920 | } |
@@ -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,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function give_get_country() { |
25 | 25 | global $give_options; |
26 | - $country = isset( $give_options['base_country'] ) ? $give_options['base_country'] : 'US'; |
|
26 | + $country = isset($give_options['base_country']) ? $give_options['base_country'] : 'US'; |
|
27 | 27 | |
28 | - return apply_filters( 'give_give_country', $country ); |
|
28 | + return apply_filters('give_give_country', $country); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | function give_get_state() { |
38 | 38 | global $give_options; |
39 | - $state = isset( $give_options['base_state'] ) ? $give_options['base_state'] : false; |
|
39 | + $state = isset($give_options['base_state']) ? $give_options['base_state'] : false; |
|
40 | 40 | |
41 | - return apply_filters( 'give_give_state', $state ); |
|
41 | + return apply_filters('give_give_state', $state); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return mixed|void A list of states for the shop's base country |
52 | 52 | */ |
53 | -function give_get_states( $country = null ) { |
|
53 | +function give_get_states($country = null) { |
|
54 | 54 | global $give_options; |
55 | 55 | |
56 | - if ( empty( $country ) ) { |
|
56 | + if (empty($country)) { |
|
57 | 57 | $country = give_get_country(); |
58 | 58 | } |
59 | 59 | |
60 | - switch ( $country ) : |
|
60 | + switch ($country) : |
|
61 | 61 | |
62 | 62 | case 'US' : |
63 | 63 | $states = give_get_states_list(); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | endswitch; |
109 | 109 | |
110 | - return apply_filters( 'give_give_states', $states ); |
|
110 | + return apply_filters('give_give_states', $states); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | 'ZW' => 'Zimbabwe' |
372 | 372 | ); |
373 | 373 | |
374 | - return apply_filters( 'give_countries', $countries ); |
|
374 | + return apply_filters('give_countries', $countries); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | 'AP' => 'Armed Forces - Pacific' |
453 | 453 | ); |
454 | 454 | |
455 | - return apply_filters( 'give_us_states', $states ); |
|
455 | + return apply_filters('give_us_states', $states); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | /** |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | 'YT' => 'Yukon' |
481 | 481 | ); |
482 | 482 | |
483 | - return apply_filters( 'give_canada_provinces', $provinces ); |
|
483 | + return apply_filters('give_canada_provinces', $provinces); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | /** |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | 'WA' => 'Western Australia' |
503 | 503 | ); |
504 | 504 | |
505 | - return apply_filters( 'give_australian_states', $states ); |
|
505 | + return apply_filters('give_australian_states', $states); |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | /** |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | 'TO' => 'Tocantins' |
544 | 544 | ); |
545 | 545 | |
546 | - return apply_filters( 'give_brazil_states', $states ); |
|
546 | + return apply_filters('give_brazil_states', $states); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | /** |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | 'NEW TERRITORIES' => 'New Territories' |
561 | 561 | ); |
562 | 562 | |
563 | - return apply_filters( 'give_hong_kong_states', $states ); |
|
563 | + return apply_filters('give_hong_kong_states', $states); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | /** |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | 'ZA' => 'Zala' |
595 | 595 | ); |
596 | 596 | |
597 | - return apply_filters( 'give_hungary_states', $states ); |
|
597 | + return apply_filters('give_hungary_states', $states); |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | /** |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | 'CN32' => 'Xinjiang / 新疆' |
641 | 641 | ); |
642 | 642 | |
643 | - return apply_filters( 'give_chinese_states', $states ); |
|
643 | + return apply_filters('give_chinese_states', $states); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | /** |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | 'WC' => 'West Coast' |
670 | 670 | ); |
671 | 671 | |
672 | - return apply_filters( 'give_new_zealand_states', $states ); |
|
672 | + return apply_filters('give_new_zealand_states', $states); |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | /** |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | 'PB' => 'Papua Barat' |
718 | 718 | ); |
719 | 719 | |
720 | - return apply_filters( 'give_indonesia_states', $states ); |
|
720 | + return apply_filters('give_indonesia_states', $states); |
|
721 | 721 | } |
722 | 722 | |
723 | 723 | /** |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | 'PY' => 'Pondicherry (Puducherry)' |
768 | 768 | ); |
769 | 769 | |
770 | - return apply_filters( 'give_indian_states', $states ); |
|
770 | + return apply_filters('give_indian_states', $states); |
|
771 | 771 | } |
772 | 772 | |
773 | 773 | /** |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | 'PJY' => 'W.P. Putrajaya' |
798 | 798 | ); |
799 | 799 | |
800 | - return apply_filters( 'give_malaysian_states', $states ); |
|
800 | + return apply_filters('give_malaysian_states', $states); |
|
801 | 801 | } |
802 | 802 | |
803 | 803 | /** |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | 'WC' => 'Western Cape' |
821 | 821 | ); |
822 | 822 | |
823 | - return apply_filters( 'give_south_african_states', $states ); |
|
823 | + return apply_filters('give_south_african_states', $states); |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | /** |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | 'TH-35' => 'Yasothon (ยโสธร)' |
912 | 912 | ); |
913 | 913 | |
914 | - return apply_filters( 'give_thailand_states', $states ); |
|
914 | + return apply_filters('give_thailand_states', $states); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | /** |
@@ -923,59 +923,59 @@ discard block |
||
923 | 923 | function give_get_spain_states_list() { |
924 | 924 | $states = array( |
925 | 925 | '' => '', |
926 | - 'C' => esc_html__( 'A Coruña', 'give' ), |
|
927 | - 'VI' => esc_html__( 'Araba', 'give' ), |
|
928 | - 'AB' => esc_html__( 'Albacete', 'give' ), |
|
929 | - 'A' => esc_html__( 'Alicante', 'give' ), |
|
930 | - 'AL' => esc_html__( 'Almería', 'give' ), |
|
931 | - 'O' => esc_html__( 'Asturias', 'give' ), |
|
932 | - 'AV' => esc_html__( 'Ávila', 'give' ), |
|
933 | - 'BA' => esc_html__( 'Badajoz', 'give' ), |
|
934 | - 'PM' => esc_html__( 'Baleares', 'give' ), |
|
935 | - 'B' => esc_html__( 'Barcelona', 'give' ), |
|
936 | - 'BU' => esc_html__( 'Burgos', 'give' ), |
|
937 | - 'CC' => esc_html__( 'Cáceres', 'give' ), |
|
938 | - 'CA' => esc_html__( 'Cádiz', 'give' ), |
|
939 | - 'S' => esc_html__( 'Cantabria', 'give' ), |
|
940 | - 'CS' => esc_html__( 'Castellón', 'give' ), |
|
941 | - 'CE' => esc_html__( 'Ceuta', 'give' ), |
|
942 | - 'CR' => esc_html__( 'Ciudad Real', 'give' ), |
|
943 | - 'CO' => esc_html__( 'Córdoba', 'give' ), |
|
944 | - 'CU' => esc_html__( 'Cuenca', 'give' ), |
|
945 | - 'GI' => esc_html__( 'Girona', 'give' ), |
|
946 | - 'GR' => esc_html__( 'Granada', 'give' ), |
|
947 | - 'GU' => esc_html__( 'Guadalajara', 'give' ), |
|
948 | - 'SS' => esc_html__( 'Gipuzkoa', 'give' ), |
|
949 | - 'H' => esc_html__( 'Huelva', 'give' ), |
|
950 | - 'HU' => esc_html__( 'Huesca', 'give' ), |
|
951 | - 'J' => esc_html__( 'Jaén', 'give' ), |
|
952 | - 'LO' => esc_html__( 'La Rioja', 'give' ), |
|
953 | - 'GC' => esc_html__( 'Las Palmas', 'give' ), |
|
954 | - 'LE' => esc_html__( 'León', 'give' ), |
|
955 | - 'L' => esc_html__( 'Lleida', 'give' ), |
|
956 | - 'LU' => esc_html__( 'Lugo', 'give' ), |
|
957 | - 'M' => esc_html__( 'Madrid', 'give' ), |
|
958 | - 'MA' => esc_html__( 'Málaga', 'give' ), |
|
959 | - 'ML' => esc_html__( 'Melilla', 'give' ), |
|
960 | - 'MU' => esc_html__( 'Murcia', 'give' ), |
|
961 | - 'NA' => esc_html__( 'Navarra', 'give' ), |
|
962 | - 'OR' => esc_html__( 'Ourense', 'give' ), |
|
963 | - 'P' => esc_html__( 'Palencia', 'give' ), |
|
964 | - 'PO' => esc_html__( 'Pontevedra', 'give' ), |
|
965 | - 'SA' => esc_html__( 'Salamanca', 'give' ), |
|
966 | - 'TF' => esc_html__( 'Santa Cruz de Tenerife', 'give' ), |
|
967 | - 'SG' => esc_html__( 'Segovia', 'give' ), |
|
968 | - 'SE' => esc_html__( 'Sevilla', 'give' ), |
|
969 | - 'SO' => esc_html__( 'Soria', 'give' ), |
|
970 | - 'T' => esc_html__( 'Tarragona', 'give' ), |
|
971 | - 'TE' => esc_html__( 'Teruel', 'give' ), |
|
972 | - 'TO' => esc_html__( 'Toledo', 'give' ), |
|
973 | - 'V' => esc_html__( 'Valencia', 'give' ), |
|
974 | - 'VA' => esc_html__( 'Valladolid', 'give' ), |
|
975 | - 'BI' => esc_html__( 'Bizkaia', 'give' ), |
|
976 | - 'ZA' => esc_html__( 'Zamora', 'give' ), |
|
977 | - 'Z' => esc_html__( 'Zaragoza', 'give' ) |
|
926 | + 'C' => esc_html__('A Coruña', 'give'), |
|
927 | + 'VI' => esc_html__('Araba', 'give'), |
|
928 | + 'AB' => esc_html__('Albacete', 'give'), |
|
929 | + 'A' => esc_html__('Alicante', 'give'), |
|
930 | + 'AL' => esc_html__('Almería', 'give'), |
|
931 | + 'O' => esc_html__('Asturias', 'give'), |
|
932 | + 'AV' => esc_html__('Ávila', 'give'), |
|
933 | + 'BA' => esc_html__('Badajoz', 'give'), |
|
934 | + 'PM' => esc_html__('Baleares', 'give'), |
|
935 | + 'B' => esc_html__('Barcelona', 'give'), |
|
936 | + 'BU' => esc_html__('Burgos', 'give'), |
|
937 | + 'CC' => esc_html__('Cáceres', 'give'), |
|
938 | + 'CA' => esc_html__('Cádiz', 'give'), |
|
939 | + 'S' => esc_html__('Cantabria', 'give'), |
|
940 | + 'CS' => esc_html__('Castellón', 'give'), |
|
941 | + 'CE' => esc_html__('Ceuta', 'give'), |
|
942 | + 'CR' => esc_html__('Ciudad Real', 'give'), |
|
943 | + 'CO' => esc_html__('Córdoba', 'give'), |
|
944 | + 'CU' => esc_html__('Cuenca', 'give'), |
|
945 | + 'GI' => esc_html__('Girona', 'give'), |
|
946 | + 'GR' => esc_html__('Granada', 'give'), |
|
947 | + 'GU' => esc_html__('Guadalajara', 'give'), |
|
948 | + 'SS' => esc_html__('Gipuzkoa', 'give'), |
|
949 | + 'H' => esc_html__('Huelva', 'give'), |
|
950 | + 'HU' => esc_html__('Huesca', 'give'), |
|
951 | + 'J' => esc_html__('Jaén', 'give'), |
|
952 | + 'LO' => esc_html__('La Rioja', 'give'), |
|
953 | + 'GC' => esc_html__('Las Palmas', 'give'), |
|
954 | + 'LE' => esc_html__('León', 'give'), |
|
955 | + 'L' => esc_html__('Lleida', 'give'), |
|
956 | + 'LU' => esc_html__('Lugo', 'give'), |
|
957 | + 'M' => esc_html__('Madrid', 'give'), |
|
958 | + 'MA' => esc_html__('Málaga', 'give'), |
|
959 | + 'ML' => esc_html__('Melilla', 'give'), |
|
960 | + 'MU' => esc_html__('Murcia', 'give'), |
|
961 | + 'NA' => esc_html__('Navarra', 'give'), |
|
962 | + 'OR' => esc_html__('Ourense', 'give'), |
|
963 | + 'P' => esc_html__('Palencia', 'give'), |
|
964 | + 'PO' => esc_html__('Pontevedra', 'give'), |
|
965 | + 'SA' => esc_html__('Salamanca', 'give'), |
|
966 | + 'TF' => esc_html__('Santa Cruz de Tenerife', 'give'), |
|
967 | + 'SG' => esc_html__('Segovia', 'give'), |
|
968 | + 'SE' => esc_html__('Sevilla', 'give'), |
|
969 | + 'SO' => esc_html__('Soria', 'give'), |
|
970 | + 'T' => esc_html__('Tarragona', 'give'), |
|
971 | + 'TE' => esc_html__('Teruel', 'give'), |
|
972 | + 'TO' => esc_html__('Toledo', 'give'), |
|
973 | + 'V' => esc_html__('Valencia', 'give'), |
|
974 | + 'VA' => esc_html__('Valladolid', 'give'), |
|
975 | + 'BI' => esc_html__('Bizkaia', 'give'), |
|
976 | + 'ZA' => esc_html__('Zamora', 'give'), |
|
977 | + 'Z' => esc_html__('Zaragoza', 'give') |
|
978 | 978 | ); |
979 | 979 | |
980 | - return apply_filters( 'give_spain_states', $states ); |
|
980 | + return apply_filters('give_spain_states', $states); |
|
981 | 981 | } |
@@ -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 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return string $output Give forms dropdown |
35 | 35 | */ |
36 | - public function forms_dropdown( $args = array() ) { |
|
36 | + public function forms_dropdown($args = array()) { |
|
37 | 37 | |
38 | 38 | $defaults = array( |
39 | 39 | 'name' => 'forms', |
@@ -44,47 +44,47 @@ discard block |
||
44 | 44 | 'chosen' => false, |
45 | 45 | 'number' => 30, |
46 | 46 | /* translators: %s: form singular label */ |
47 | - 'placeholder' => sprintf( esc_attr__( 'Select a %s', 'give' ), give_get_forms_label_singular() ) |
|
47 | + 'placeholder' => sprintf(esc_attr__('Select a %s', 'give'), give_get_forms_label_singular()) |
|
48 | 48 | ); |
49 | 49 | |
50 | - $args = wp_parse_args( $args, $defaults ); |
|
50 | + $args = wp_parse_args($args, $defaults); |
|
51 | 51 | |
52 | - $forms = get_posts( array( |
|
52 | + $forms = get_posts(array( |
|
53 | 53 | 'post_type' => 'give_forms', |
54 | 54 | 'orderby' => 'title', |
55 | 55 | 'order' => 'ASC', |
56 | 56 | 'posts_per_page' => $args['number'] |
57 | - ) ); |
|
57 | + )); |
|
58 | 58 | |
59 | 59 | $options = array(); |
60 | 60 | |
61 | - if ( $forms ) { |
|
61 | + if ($forms) { |
|
62 | 62 | $options[0] = sprintf( |
63 | 63 | /* translators: %s: form singular label */ |
64 | - esc_html__( 'Select a %s', 'give' ), |
|
64 | + esc_html__('Select a %s', 'give'), |
|
65 | 65 | give_get_forms_label_singular() |
66 | 66 | ); |
67 | - foreach ( $forms as $form ) { |
|
68 | - $options[ absint( $form->ID ) ] = esc_html__( $form->post_title ); |
|
67 | + foreach ($forms as $form) { |
|
68 | + $options[absint($form->ID)] = esc_html__($form->post_title); |
|
69 | 69 | } |
70 | 70 | } else { |
71 | - $options[0] = esc_html__( 'No Give Forms Found', 'give' ); |
|
71 | + $options[0] = esc_html__('No Give Forms Found', 'give'); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | // This ensures that any selected forms are included in the drop down |
75 | - if ( is_array( $args['selected'] ) ) { |
|
76 | - foreach ( $args['selected'] as $item ) { |
|
77 | - if ( ! in_array( $item, $options ) ) { |
|
78 | - $options[ $item ] = get_the_title( $item ); |
|
75 | + if (is_array($args['selected'])) { |
|
76 | + foreach ($args['selected'] as $item) { |
|
77 | + if ( ! in_array($item, $options)) { |
|
78 | + $options[$item] = get_the_title($item); |
|
79 | 79 | } |
80 | 80 | } |
81 | - } elseif ( is_numeric( $args['selected'] ) && $args['selected'] !== 0 ) { |
|
82 | - if ( ! in_array( $args['selected'], $options ) ) { |
|
83 | - $options[ $args['selected'] ] = get_the_title( $args['selected'] ); |
|
81 | + } elseif (is_numeric($args['selected']) && $args['selected'] !== 0) { |
|
82 | + if ( ! in_array($args['selected'], $options)) { |
|
83 | + $options[$args['selected']] = get_the_title($args['selected']); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | - $output = $this->select( array( |
|
87 | + $output = $this->select(array( |
|
88 | 88 | 'name' => $args['name'], |
89 | 89 | 'selected' => $args['selected'], |
90 | 90 | 'id' => $args['id'], |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'placeholder' => $args['placeholder'], |
96 | 96 | 'show_option_all' => false, |
97 | 97 | 'show_option_none' => false |
98 | - ) ); |
|
98 | + )); |
|
99 | 99 | |
100 | 100 | return $output; |
101 | 101 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string $output Donor dropdown |
112 | 112 | */ |
113 | - public function donor_dropdown( $args = array() ) { |
|
113 | + public function donor_dropdown($args = array()) { |
|
114 | 114 | |
115 | 115 | $defaults = array( |
116 | 116 | 'name' => 'customers', |
@@ -119,38 +119,38 @@ discard block |
||
119 | 119 | 'multiple' => false, |
120 | 120 | 'selected' => 0, |
121 | 121 | 'chosen' => true, |
122 | - 'placeholder' => esc_attr__( 'Select a Donor', 'give' ), |
|
122 | + 'placeholder' => esc_attr__('Select a Donor', 'give'), |
|
123 | 123 | 'number' => 30 |
124 | 124 | ); |
125 | 125 | |
126 | - $args = wp_parse_args( $args, $defaults ); |
|
126 | + $args = wp_parse_args($args, $defaults); |
|
127 | 127 | |
128 | - $customers = Give()->customers->get_customers( array( |
|
128 | + $customers = Give()->customers->get_customers(array( |
|
129 | 129 | 'number' => $args['number'] |
130 | - ) ); |
|
130 | + )); |
|
131 | 131 | |
132 | 132 | $options = array(); |
133 | 133 | |
134 | - if ( $customers ) { |
|
135 | - $options[0] = esc_html__( 'No donor attached', 'give' ); |
|
136 | - foreach ( $customers as $customer ) { |
|
137 | - $options[ absint( $customer->id ) ] = esc_html__( $customer->name . ' (' . $customer->email . ')' ); |
|
134 | + if ($customers) { |
|
135 | + $options[0] = esc_html__('No donor attached', 'give'); |
|
136 | + foreach ($customers as $customer) { |
|
137 | + $options[absint($customer->id)] = esc_html__($customer->name.' ('.$customer->email.')'); |
|
138 | 138 | } |
139 | 139 | } else { |
140 | - $options[0] = esc_html__( 'No donors found', 'give' ); |
|
140 | + $options[0] = esc_html__('No donors found', 'give'); |
|
141 | 141 | } |
142 | 142 | |
143 | - if ( ! empty( $args['selected'] ) ) { |
|
143 | + if ( ! empty($args['selected'])) { |
|
144 | 144 | |
145 | 145 | // If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed |
146 | 146 | |
147 | - if ( ! array_key_exists( $args['selected'], $options ) ) { |
|
147 | + if ( ! array_key_exists($args['selected'], $options)) { |
|
148 | 148 | |
149 | - $customer = new Give_Customer( $args['selected'] ); |
|
149 | + $customer = new Give_Customer($args['selected']); |
|
150 | 150 | |
151 | - if ( $customer ) { |
|
151 | + if ($customer) { |
|
152 | 152 | |
153 | - $options[ absint( $args['selected'] ) ] = esc_html__( $customer->name . ' (' . $customer->email . ')' ); |
|
153 | + $options[absint($args['selected'])] = esc_html__($customer->name.' ('.$customer->email.')'); |
|
154 | 154 | |
155 | 155 | } |
156 | 156 | |
@@ -158,17 +158,17 @@ discard block |
||
158 | 158 | |
159 | 159 | } |
160 | 160 | |
161 | - $output = $this->select( array( |
|
161 | + $output = $this->select(array( |
|
162 | 162 | 'name' => $args['name'], |
163 | 163 | 'selected' => $args['selected'], |
164 | 164 | 'id' => $args['id'], |
165 | - 'class' => $args['class'] . ' give-customer-select', |
|
165 | + 'class' => $args['class'].' give-customer-select', |
|
166 | 166 | 'options' => $options, |
167 | 167 | 'multiple' => $args['multiple'], |
168 | 168 | 'chosen' => $args['chosen'], |
169 | 169 | 'show_option_all' => false, |
170 | 170 | 'show_option_none' => false |
171 | - ) ); |
|
171 | + )); |
|
172 | 172 | |
173 | 173 | return $output; |
174 | 174 | } |
@@ -185,21 +185,21 @@ discard block |
||
185 | 185 | * |
186 | 186 | * @return string $output Category dropdown |
187 | 187 | */ |
188 | - public function category_dropdown( $name = 'give_forms_categories', $selected = 0 ) { |
|
189 | - $categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) ); |
|
188 | + public function category_dropdown($name = 'give_forms_categories', $selected = 0) { |
|
189 | + $categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array())); |
|
190 | 190 | $options = array(); |
191 | 191 | |
192 | - foreach ( $categories as $category ) { |
|
193 | - $options[ absint( $category->term_id ) ] = esc_html__( $category->name ); |
|
192 | + foreach ($categories as $category) { |
|
193 | + $options[absint($category->term_id)] = esc_html__($category->name); |
|
194 | 194 | } |
195 | 195 | |
196 | - $output = $this->select( array( |
|
196 | + $output = $this->select(array( |
|
197 | 197 | 'name' => $name, |
198 | 198 | 'selected' => $selected, |
199 | 199 | 'options' => $options, |
200 | - 'show_option_all' => esc_html__( 'All Categories', 'give' ), |
|
200 | + 'show_option_all' => esc_html__('All Categories', 'give'), |
|
201 | 201 | 'show_option_none' => false |
202 | - ) ); |
|
202 | + )); |
|
203 | 203 | |
204 | 204 | return $output; |
205 | 205 | } |
@@ -217,25 +217,25 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @return string $output Year dropdown |
219 | 219 | */ |
220 | - public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) { |
|
221 | - $current = date( 'Y' ); |
|
222 | - $start_year = $current - absint( $years_before ); |
|
223 | - $end_year = $current + absint( $years_after ); |
|
224 | - $selected = empty( $selected ) ? date( 'Y' ) : $selected; |
|
220 | + public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) { |
|
221 | + $current = date('Y'); |
|
222 | + $start_year = $current - absint($years_before); |
|
223 | + $end_year = $current + absint($years_after); |
|
224 | + $selected = empty($selected) ? date('Y') : $selected; |
|
225 | 225 | $options = array(); |
226 | 226 | |
227 | - while ( $start_year <= $end_year ) { |
|
228 | - $options[ absint( $start_year ) ] = $start_year; |
|
229 | - $start_year ++; |
|
227 | + while ($start_year <= $end_year) { |
|
228 | + $options[absint($start_year)] = $start_year; |
|
229 | + $start_year++; |
|
230 | 230 | } |
231 | 231 | |
232 | - $output = $this->select( array( |
|
232 | + $output = $this->select(array( |
|
233 | 233 | 'name' => $name, |
234 | 234 | 'selected' => $selected, |
235 | 235 | 'options' => $options, |
236 | 236 | 'show_option_all' => false, |
237 | 237 | 'show_option_none' => false |
238 | - ) ); |
|
238 | + )); |
|
239 | 239 | |
240 | 240 | return $output; |
241 | 241 | } |
@@ -252,23 +252,23 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @return string $output Month dropdown |
254 | 254 | */ |
255 | - public function month_dropdown( $name = 'month', $selected = 0 ) { |
|
255 | + public function month_dropdown($name = 'month', $selected = 0) { |
|
256 | 256 | $month = 1; |
257 | 257 | $options = array(); |
258 | - $selected = empty( $selected ) ? date( 'n' ) : $selected; |
|
258 | + $selected = empty($selected) ? date('n') : $selected; |
|
259 | 259 | |
260 | - while ( $month <= 12 ) { |
|
261 | - $options[ absint( $month ) ] = give_month_num_to_name( $month ); |
|
262 | - $month ++; |
|
260 | + while ($month <= 12) { |
|
261 | + $options[absint($month)] = give_month_num_to_name($month); |
|
262 | + $month++; |
|
263 | 263 | } |
264 | 264 | |
265 | - $output = $this->select( array( |
|
265 | + $output = $this->select(array( |
|
266 | 266 | 'name' => $name, |
267 | 267 | 'selected' => $selected, |
268 | 268 | 'options' => $options, |
269 | 269 | 'show_option_all' => false, |
270 | 270 | 'show_option_none' => false |
271 | - ) ); |
|
271 | + )); |
|
272 | 272 | |
273 | 273 | return $output; |
274 | 274 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * |
283 | 283 | * @return string |
284 | 284 | */ |
285 | - public function select( $args = array() ) { |
|
285 | + public function select($args = array()) { |
|
286 | 286 | $defaults = array( |
287 | 287 | 'options' => array(), |
288 | 288 | 'name' => null, |
@@ -292,60 +292,60 @@ discard block |
||
292 | 292 | 'chosen' => false, |
293 | 293 | 'placeholder' => null, |
294 | 294 | 'multiple' => false, |
295 | - 'show_option_all' => esc_html__( 'All', 'give' ), |
|
296 | - 'show_option_none' => esc_html__( 'None', 'give' ) |
|
295 | + 'show_option_all' => esc_html__('All', 'give'), |
|
296 | + 'show_option_none' => esc_html__('None', 'give') |
|
297 | 297 | ); |
298 | 298 | |
299 | - $args = wp_parse_args( $args, $defaults ); |
|
299 | + $args = wp_parse_args($args, $defaults); |
|
300 | 300 | |
301 | 301 | |
302 | - if ( $args['multiple'] ) { |
|
302 | + if ($args['multiple']) { |
|
303 | 303 | $multiple = ' MULTIPLE'; |
304 | 304 | } else { |
305 | 305 | $multiple = ''; |
306 | 306 | } |
307 | 307 | |
308 | - if ( $args['chosen'] ) { |
|
308 | + if ($args['chosen']) { |
|
309 | 309 | $args['class'] .= ' give-select-chosen'; |
310 | 310 | } |
311 | 311 | |
312 | - if ( $args['placeholder'] ) { |
|
312 | + if ($args['placeholder']) { |
|
313 | 313 | $placeholder = $args['placeholder']; |
314 | 314 | } else { |
315 | 315 | $placeholder = ''; |
316 | 316 | } |
317 | 317 | |
318 | - $output = '<select name="' . esc_attr__( $args['name'] ) . '" id="' . esc_attr__( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr__( $args['class'] ) . '"' . $multiple . ' data-placeholder="' . $placeholder . '">'; |
|
318 | + $output = '<select name="'.esc_attr__($args['name']).'" id="'.esc_attr__(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr__($args['class']).'"'.$multiple.' data-placeholder="'.$placeholder.'">'; |
|
319 | 319 | |
320 | - if ( $args['show_option_all'] ) { |
|
321 | - if ( $args['multiple'] ) { |
|
322 | - $selected = selected( true, in_array( 0, $args['selected'] ), false ); |
|
320 | + if ($args['show_option_all']) { |
|
321 | + if ($args['multiple']) { |
|
322 | + $selected = selected(true, in_array(0, $args['selected']), false); |
|
323 | 323 | } else { |
324 | - $selected = selected( $args['selected'], 0, false ); |
|
324 | + $selected = selected($args['selected'], 0, false); |
|
325 | 325 | } |
326 | - $output .= '<option value="all"' . $selected . '>' . esc_html__( $args['show_option_all'] ) . '</option>'; |
|
326 | + $output .= '<option value="all"'.$selected.'>'.esc_html__($args['show_option_all']).'</option>'; |
|
327 | 327 | } |
328 | 328 | |
329 | - if ( ! empty( $args['options'] ) ) { |
|
329 | + if ( ! empty($args['options'])) { |
|
330 | 330 | |
331 | - if ( $args['show_option_none'] ) { |
|
332 | - if ( $args['multiple'] ) { |
|
333 | - $selected = selected( true, in_array( - 1, $args['selected'] ), false ); |
|
331 | + if ($args['show_option_none']) { |
|
332 | + if ($args['multiple']) { |
|
333 | + $selected = selected(true, in_array( -1, $args['selected'] ), false); |
|
334 | 334 | } else { |
335 | - $selected = selected( $args['selected'], - 1, false ); |
|
335 | + $selected = selected($args['selected'], - 1, false); |
|
336 | 336 | } |
337 | - $output .= '<option value="-1"' . $selected . '>' . esc_html__( $args['show_option_none'] ) . '</option>'; |
|
337 | + $output .= '<option value="-1"'.$selected.'>'.esc_html__($args['show_option_none']).'</option>'; |
|
338 | 338 | } |
339 | 339 | |
340 | - foreach ( $args['options'] as $key => $option ) { |
|
340 | + foreach ($args['options'] as $key => $option) { |
|
341 | 341 | |
342 | - if ( $args['multiple'] && is_array( $args['selected'] ) ) { |
|
343 | - $selected = selected( true, in_array( $key, $args['selected'] ), false ); |
|
342 | + if ($args['multiple'] && is_array($args['selected'])) { |
|
343 | + $selected = selected(true, in_array($key, $args['selected']), false); |
|
344 | 344 | } else { |
345 | - $selected = selected( $args['selected'], $key, false ); |
|
345 | + $selected = selected($args['selected'], $key, false); |
|
346 | 346 | } |
347 | 347 | |
348 | - $output .= '<option value="' . esc_attr__( $key ) . '"' . $selected . '>' . esc_html__( $option ) . '</option>'; |
|
348 | + $output .= '<option value="'.esc_attr__($key).'"'.$selected.'>'.esc_html__($option).'</option>'; |
|
349 | 349 | } |
350 | 350 | } |
351 | 351 | |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | * |
364 | 364 | * @return string |
365 | 365 | */ |
366 | - public function checkbox( $args = array() ) { |
|
366 | + public function checkbox($args = array()) { |
|
367 | 367 | $defaults = array( |
368 | 368 | 'name' => null, |
369 | 369 | 'current' => null, |
@@ -374,16 +374,16 @@ discard block |
||
374 | 374 | ) |
375 | 375 | ); |
376 | 376 | |
377 | - $args = wp_parse_args( $args, $defaults ); |
|
377 | + $args = wp_parse_args($args, $defaults); |
|
378 | 378 | |
379 | 379 | $options = ''; |
380 | - if ( ! empty( $args['options']['disabled'] ) ) { |
|
380 | + if ( ! empty($args['options']['disabled'])) { |
|
381 | 381 | $options .= ' disabled="disabled"'; |
382 | - } elseif ( ! empty( $args['options']['readonly'] ) ) { |
|
382 | + } elseif ( ! empty($args['options']['readonly'])) { |
|
383 | 383 | $options .= ' readonly'; |
384 | 384 | } |
385 | 385 | |
386 | - $output = '<input type="checkbox"' . $options . ' name="' . esc_attr__( $args['name'] ) . '" id="' . esc_attr__( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr__( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />'; |
|
386 | + $output = '<input type="checkbox"'.$options.' name="'.esc_attr__($args['name']).'" id="'.esc_attr__($args['name']).'" class="'.$args['class'].' '.esc_attr__($args['name']).'" '.checked(1, $args['current'], false).' />'; |
|
387 | 387 | |
388 | 388 | return $output; |
389 | 389 | } |
@@ -397,22 +397,22 @@ discard block |
||
397 | 397 | * |
398 | 398 | * @return string Text field |
399 | 399 | */ |
400 | - public function text( $args = array() ) { |
|
400 | + public function text($args = array()) { |
|
401 | 401 | // Backwards compatabliity |
402 | - if ( func_num_args() > 1 ) { |
|
402 | + if (func_num_args() > 1) { |
|
403 | 403 | $args = func_get_args(); |
404 | 404 | |
405 | 405 | $name = $args[0]; |
406 | - $value = isset( $args[1] ) ? $args[1] : ''; |
|
407 | - $label = isset( $args[2] ) ? $args[2] : ''; |
|
408 | - $desc = isset( $args[3] ) ? $args[3] : ''; |
|
406 | + $value = isset($args[1]) ? $args[1] : ''; |
|
407 | + $label = isset($args[2]) ? $args[2] : ''; |
|
408 | + $desc = isset($args[3]) ? $args[3] : ''; |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | $defaults = array( |
412 | - 'name' => isset( $name ) ? $name : 'text', |
|
413 | - 'value' => isset( $value ) ? $value : null, |
|
414 | - 'label' => isset( $label ) ? $label : null, |
|
415 | - 'desc' => isset( $desc ) ? $desc : null, |
|
412 | + 'name' => isset($name) ? $name : 'text', |
|
413 | + 'value' => isset($value) ? $value : null, |
|
414 | + 'label' => isset($label) ? $label : null, |
|
415 | + 'desc' => isset($desc) ? $desc : null, |
|
416 | 416 | 'placeholder' => '', |
417 | 417 | 'class' => 'regular-text', |
418 | 418 | 'disabled' => false, |
@@ -420,29 +420,29 @@ discard block |
||
420 | 420 | 'data' => false |
421 | 421 | ); |
422 | 422 | |
423 | - $args = wp_parse_args( $args, $defaults ); |
|
423 | + $args = wp_parse_args($args, $defaults); |
|
424 | 424 | |
425 | 425 | $disabled = ''; |
426 | - if ( $args['disabled'] ) { |
|
426 | + if ($args['disabled']) { |
|
427 | 427 | $disabled = ' disabled="disabled"'; |
428 | 428 | } |
429 | 429 | |
430 | 430 | $data = ''; |
431 | - if ( ! empty( $args['data'] ) ) { |
|
432 | - foreach ( $args['data'] as $key => $value ) { |
|
433 | - $data .= 'data-' . $key . '="' . $value . '" '; |
|
431 | + if ( ! empty($args['data'])) { |
|
432 | + foreach ($args['data'] as $key => $value) { |
|
433 | + $data .= 'data-'.$key.'="'.$value.'" '; |
|
434 | 434 | } |
435 | 435 | } |
436 | 436 | |
437 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
437 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
438 | 438 | |
439 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html__( $args['label'] ) . '</label>'; |
|
439 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html__($args['label']).'</label>'; |
|
440 | 440 | |
441 | - if ( ! empty( $args['desc'] ) ) { |
|
442 | - $output .= '<span class="give-description">' . esc_html__( $args['desc'] ) . '</span>'; |
|
441 | + if ( ! empty($args['desc'])) { |
|
442 | + $output .= '<span class="give-description">'.esc_html__($args['desc']).'</span>'; |
|
443 | 443 | } |
444 | 444 | |
445 | - $output .= '<input type="text" name="' . esc_attr__( $args['name'] ) . '" id="' . esc_attr__( $args['name'] ) . '" autocomplete="' . esc_attr__( $args['autocomplete'] ) . '" value="' . esc_attr__( $args['value'] ) . '" placeholder="' . esc_attr__( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>'; |
|
445 | + $output .= '<input type="text" name="'.esc_attr__($args['name']).'" id="'.esc_attr__($args['name']).'" autocomplete="'.esc_attr__($args['autocomplete']).'" value="'.esc_attr__($args['value']).'" placeholder="'.esc_attr__($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>'; |
|
446 | 446 | |
447 | 447 | $output .= '</span>'; |
448 | 448 | |
@@ -458,15 +458,15 @@ discard block |
||
458 | 458 | * |
459 | 459 | * @return string Datepicker field |
460 | 460 | */ |
461 | - public function date_field( $args = array() ) { |
|
461 | + public function date_field($args = array()) { |
|
462 | 462 | |
463 | - if ( empty( $args['class'] ) ) { |
|
463 | + if (empty($args['class'])) { |
|
464 | 464 | $args['class'] = 'give_datepicker'; |
465 | - } elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) { |
|
465 | + } elseif ( ! strpos($args['class'], 'give_datepicker')) { |
|
466 | 466 | $args['class'] .= ' give_datepicker'; |
467 | 467 | } |
468 | 468 | |
469 | - return $this->text( $args ); |
|
469 | + return $this->text($args); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @return string textarea |
481 | 481 | */ |
482 | - public function textarea( $args = array() ) { |
|
482 | + public function textarea($args = array()) { |
|
483 | 483 | $defaults = array( |
484 | 484 | 'name' => 'textarea', |
485 | 485 | 'value' => null, |
@@ -489,21 +489,21 @@ discard block |
||
489 | 489 | 'disabled' => false |
490 | 490 | ); |
491 | 491 | |
492 | - $args = wp_parse_args( $args, $defaults ); |
|
492 | + $args = wp_parse_args($args, $defaults); |
|
493 | 493 | |
494 | 494 | $disabled = ''; |
495 | - if ( $args['disabled'] ) { |
|
495 | + if ($args['disabled']) { |
|
496 | 496 | $disabled = ' disabled="disabled"'; |
497 | 497 | } |
498 | 498 | |
499 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
499 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
500 | 500 | |
501 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html__( $args['label'] ) . '</label>'; |
|
501 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html__($args['label']).'</label>'; |
|
502 | 502 | |
503 | - $output .= '<textarea name="' . esc_attr__( $args['name'] ) . '" id="' . esc_attr__( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_html__( $args['value'] ) . '</textarea>'; |
|
503 | + $output .= '<textarea name="'.esc_attr__($args['name']).'" id="'.esc_attr__($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_html__($args['value']).'</textarea>'; |
|
504 | 504 | |
505 | - if ( ! empty( $args['desc'] ) ) { |
|
506 | - $output .= '<span class="give-description">' . esc_html__( $args['desc'] ) . '</span>'; |
|
505 | + if ( ! empty($args['desc'])) { |
|
506 | + $output .= '<span class="give-description">'.esc_html__($args['desc']).'</span>'; |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | $output .= '</span>'; |
@@ -520,12 +520,12 @@ discard block |
||
520 | 520 | * |
521 | 521 | * @return string text field with ajax search |
522 | 522 | */ |
523 | - public function ajax_user_search( $args = array() ) { |
|
523 | + public function ajax_user_search($args = array()) { |
|
524 | 524 | |
525 | 525 | $defaults = array( |
526 | 526 | 'name' => 'user_id', |
527 | 527 | 'value' => null, |
528 | - 'placeholder' => esc_attr__( 'Enter username', 'give' ), |
|
528 | + 'placeholder' => esc_attr__('Enter username', 'give'), |
|
529 | 529 | 'label' => null, |
530 | 530 | 'desc' => null, |
531 | 531 | 'class' => '', |
@@ -534,13 +534,13 @@ discard block |
||
534 | 534 | 'data' => false |
535 | 535 | ); |
536 | 536 | |
537 | - $args = wp_parse_args( $args, $defaults ); |
|
537 | + $args = wp_parse_args($args, $defaults); |
|
538 | 538 | |
539 | - $args['class'] = 'give-ajax-user-search ' . $args['class']; |
|
539 | + $args['class'] = 'give-ajax-user-search '.$args['class']; |
|
540 | 540 | |
541 | 541 | $output = '<span class="give_user_search_wrap">'; |
542 | - $output .= $this->text( $args ); |
|
543 | - $output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" title="' . esc_attr__( 'Cancel', 'give' ) . '" aria-label="' . esc_attr__( 'Cancel', 'give' ) . '" href="#">x</a><span></span></span>'; |
|
542 | + $output .= $this->text($args); |
|
543 | + $output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" title="'.esc_attr__('Cancel', 'give').'" aria-label="'.esc_attr__('Cancel', 'give').'" href="#">x</a><span></span></span>'; |
|
544 | 544 | $output .= '</span>'; |
545 | 545 | |
546 | 546 | return $output; |
@@ -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 | |
@@ -24,15 +24,15 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return string |
26 | 26 | */ |
27 | -function give_admin_rate_us( $footer_text ) { |
|
27 | +function give_admin_rate_us($footer_text) { |
|
28 | 28 | global $typenow; |
29 | 29 | |
30 | - if ( $typenow == 'give_forms' ) { |
|
30 | + if ($typenow == 'give_forms') { |
|
31 | 31 | $rate_text = sprintf( |
32 | 32 | /* translators: 1: plugin name - "Give". 2: Link to 5 star rating */ |
33 | - esc_html__( 'If you like %1$s please leave us a %2$s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ), |
|
34 | - sprintf( '<strong>%s</strong>', esc_html__( 'Give', 'give' ) ), |
|
35 | - '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'give' ) . '">★★★★★</a>' |
|
33 | + esc_html__('If you like %1$s please leave us a %2$s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'), |
|
34 | + sprintf('<strong>%s</strong>', esc_html__('Give', 'give')), |
|
35 | + '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="'.esc_attr__('Thanks :)', 'give').'">★★★★★</a>' |
|
36 | 36 | ); |
37 | 37 | |
38 | 38 | return $rate_text; |
@@ -41,4 +41,4 @@ discard block |
||
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | -add_filter( 'admin_footer_text', 'give_admin_rate_us' ); |
|
44 | +add_filter('admin_footer_text', 'give_admin_rate_us'); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Class Give_Shortcode_Donation_Form |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['title'] = esc_html__( 'Donation Form', 'give' ); |
|
25 | - $this->shortcode['label'] = esc_html__( 'Donation Form', 'give' ); |
|
24 | + $this->shortcode['title'] = esc_html__('Donation Form', 'give'); |
|
25 | + $this->shortcode['label'] = esc_html__('Donation Form', 'give'); |
|
26 | 26 | |
27 | - parent::__construct( 'give_form' ); |
|
27 | + parent::__construct('give_form'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | |
37 | 37 | $create_form_link = sprintf( |
38 | 38 | /* translators: %s: create new form URL */ |
39 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
40 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
39 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
40 | + admin_url('post-new.php?post_type=give_forms') |
|
41 | 41 | ); |
42 | 42 | |
43 | 43 | return array( |
@@ -47,68 +47,68 @@ discard block |
||
47 | 47 | 'post_type' => 'give_forms', |
48 | 48 | ), |
49 | 49 | 'name' => 'id', |
50 | - 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
51 | - 'placeholder' => esc_attr__( '- Select a Form -', 'give' ), |
|
50 | + 'tooltip' => esc_attr__('Select a Donation Form', 'give'), |
|
51 | + 'placeholder' => esc_attr__('- Select a Form -', 'give'), |
|
52 | 52 | 'required' => array( |
53 | - 'alert' => esc_html__( 'You must first select a Form!', 'give' ), |
|
54 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
53 | + 'alert' => esc_html__('You must first select a Form!', 'give'), |
|
54 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No donation forms were found!', 'give'), $create_form_link), |
|
55 | 55 | ), |
56 | 56 | ), |
57 | 57 | array( |
58 | 58 | 'type' => 'container', |
59 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional form settings', 'give' ) ), |
|
59 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional form settings', 'give')), |
|
60 | 60 | ), |
61 | 61 | array( |
62 | 62 | 'type' => 'listbox', |
63 | 63 | 'name' => 'show_title', |
64 | - 'label' => esc_html__( 'Show Title:', 'give' ), |
|
65 | - 'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ), |
|
64 | + 'label' => esc_html__('Show Title:', 'give'), |
|
65 | + 'tooltip' => esc_attr__('Do you want to display the form title?', 'give'), |
|
66 | 66 | 'options' => array( |
67 | - 'true' => esc_html__( 'Show', 'give' ), |
|
68 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
67 | + 'true' => esc_html__('Show', 'give'), |
|
68 | + 'false' => esc_html__('Hide', 'give'), |
|
69 | 69 | ), |
70 | 70 | ), |
71 | 71 | array( |
72 | 72 | 'type' => 'listbox', |
73 | 73 | 'name' => 'show_goal', |
74 | - 'label' => esc_html__( 'Show Goal:', 'give' ), |
|
75 | - 'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ), |
|
74 | + 'label' => esc_html__('Show Goal:', 'give'), |
|
75 | + 'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'), |
|
76 | 76 | 'options' => array( |
77 | - 'true' => esc_html__( 'Show', 'give' ), |
|
78 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
77 | + 'true' => esc_html__('Show', 'give'), |
|
78 | + 'false' => esc_html__('Hide', 'give'), |
|
79 | 79 | ), |
80 | 80 | ), |
81 | 81 | array( |
82 | 82 | 'type' => 'listbox', |
83 | 83 | 'name' => 'show_content', |
84 | 84 | 'minWidth' => 240, |
85 | - 'label' => esc_html__( 'Display Content:', 'give' ), |
|
86 | - 'tooltip' => esc_attr__( 'Do you want to display the form content?', 'give' ), |
|
85 | + 'label' => esc_html__('Display Content:', 'give'), |
|
86 | + 'tooltip' => esc_attr__('Do you want to display the form content?', 'give'), |
|
87 | 87 | 'options' => array( |
88 | - 'none' => esc_html__( 'No Content', 'give' ), |
|
89 | - 'above' => esc_html__( 'Display above the form fields', 'give' ), |
|
90 | - 'below' => esc_html__( 'Display below the form fields', 'give' ), |
|
88 | + 'none' => esc_html__('No Content', 'give'), |
|
89 | + 'above' => esc_html__('Display above the form fields', 'give'), |
|
90 | + 'below' => esc_html__('Display below the form fields', 'give'), |
|
91 | 91 | ), |
92 | 92 | ), |
93 | 93 | array( |
94 | 94 | 'type' => 'listbox', |
95 | 95 | 'name' => 'display_style', |
96 | - 'label' => esc_html__( 'Payment Fields:', 'give' ), |
|
97 | - 'tooltip' => esc_attr__( 'How would you like to display payment information?', 'give' ), |
|
96 | + 'label' => esc_html__('Payment Fields:', 'give'), |
|
97 | + 'tooltip' => esc_attr__('How would you like to display payment information?', 'give'), |
|
98 | 98 | 'options' => array( |
99 | - 'onpage' => esc_html__( 'Show on Page', 'give' ), |
|
100 | - 'reveal' => esc_html__( 'Reveal Upon Click', 'give' ), |
|
101 | - 'modal' => esc_html__( 'Modal Window Upon Click', 'give' ), |
|
99 | + 'onpage' => esc_html__('Show on Page', 'give'), |
|
100 | + 'reveal' => esc_html__('Reveal Upon Click', 'give'), |
|
101 | + 'modal' => esc_html__('Modal Window Upon Click', 'give'), |
|
102 | 102 | ), |
103 | 103 | ), |
104 | 104 | array( |
105 | 105 | 'type' => 'listbox', |
106 | 106 | 'name' => 'float_labels', |
107 | - 'label' => esc_html__( 'Floating Labels:', 'give' ), |
|
108 | - 'tooltip' => esc_attr__( 'Override the default floating labels setting for this form?', 'give' ), |
|
107 | + 'label' => esc_html__('Floating Labels:', 'give'), |
|
108 | + 'tooltip' => esc_attr__('Override the default floating labels setting for this form?', 'give'), |
|
109 | 109 | 'options' => array( |
110 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
111 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
110 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
111 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
112 | 112 | ), |
113 | 113 | ), |
114 | 114 | ); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @since 1.3.0 |
12 | 12 | */ |
13 | 13 | |
14 | -defined( 'ABSPATH' ) or exit; |
|
14 | +defined('ABSPATH') or exit; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * Class Give_Shortcode_Button |
@@ -30,16 +30,16 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function __construct() { |
32 | 32 | |
33 | - if ( is_admin() ) { |
|
34 | - add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 ); |
|
33 | + if (is_admin()) { |
|
34 | + add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15); |
|
35 | 35 | |
36 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) ); |
|
37 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 ); |
|
38 | - add_action( 'media_buttons', array( $this, 'shortcode_button' ) ); |
|
36 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets')); |
|
37 | + add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13); |
|
38 | + add_action('media_buttons', array($this, 'shortcode_button')); |
|
39 | 39 | } |
40 | 40 | |
41 | - add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
42 | - add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
41 | + add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax')); |
|
42 | + add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax')); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @since 1.0 |
53 | 53 | */ |
54 | - public function mce_external_plugins( $plugin_array ) { |
|
54 | + public function mce_external_plugins($plugin_array) { |
|
55 | 55 | |
56 | - if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) { |
|
56 | + if (current_user_can('edit_posts') && current_user_can('edit_pages')) { |
|
57 | 57 | |
58 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
58 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
59 | 59 | |
60 | - $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'assets/js/admin/tinymce/mce-plugin' . $suffix . '.js'; |
|
60 | + $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'assets/js/admin/tinymce/mce-plugin'.$suffix.'.js'; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $plugin_array; |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function admin_enqueue_assets() { |
74 | 74 | |
75 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
75 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
76 | 76 | |
77 | 77 | wp_enqueue_script( |
78 | 78 | 'give_shortcode', |
79 | - GIVE_PLUGIN_URL . 'assets/js/admin/admin-shortcodes' . $suffix . '.js', |
|
80 | - array( 'jquery' ), |
|
79 | + GIVE_PLUGIN_URL.'assets/js/admin/admin-shortcodes'.$suffix.'.js', |
|
80 | + array('jquery'), |
|
81 | 81 | GIVE_VERSION, |
82 | 82 | true |
83 | 83 | ); |
@@ -92,17 +92,17 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function admin_localize_scripts() { |
94 | 94 | |
95 | - if ( ! empty( self::$shortcodes ) ) { |
|
95 | + if ( ! empty(self::$shortcodes)) { |
|
96 | 96 | |
97 | 97 | $variables = array(); |
98 | 98 | |
99 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
100 | - if ( ! empty( $values['required'] ) ) { |
|
101 | - $variables[ $shortcode ] = $values['required']; |
|
99 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
100 | + if ( ! empty($values['required'])) { |
|
101 | + $variables[$shortcode] = $values['required']; |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
105 | - wp_localize_script( 'give_shortcode', 'scShortcodes', $variables ); |
|
105 | + wp_localize_script('give_shortcode', 'scShortcodes', $variables); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
@@ -117,24 +117,24 @@ discard block |
||
117 | 117 | |
118 | 118 | global $pagenow, $wp_version; |
119 | 119 | |
120 | - $shortcode_button_pages = array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ); |
|
120 | + $shortcode_button_pages = array('post.php', 'page.php', 'post-new.php', 'post-edit.php'); |
|
121 | 121 | // Only run in admin post/page creation and edit screens |
122 | - if ( in_array( $pagenow, $shortcode_button_pages ) |
|
123 | - && apply_filters( 'give_shortcode_button_condition', true ) |
|
124 | - && ! empty( self::$shortcodes ) |
|
122 | + if (in_array($pagenow, $shortcode_button_pages) |
|
123 | + && apply_filters('give_shortcode_button_condition', true) |
|
124 | + && ! empty(self::$shortcodes) |
|
125 | 125 | ) { |
126 | 126 | |
127 | 127 | $shortcodes = array(); |
128 | 128 | |
129 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
129 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
130 | 130 | /** |
131 | 131 | * Filters the condition for including the current shortcode |
132 | 132 | * |
133 | 133 | * @since 1.0 |
134 | 134 | */ |
135 | - if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) { |
|
135 | + if (apply_filters(sanitize_title($shortcode).'_condition', true)) { |
|
136 | 136 | |
137 | - $shortcodes[ $shortcode ] = sprintf( |
|
137 | + $shortcodes[$shortcode] = sprintf( |
|
138 | 138 | '<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%s">%s</div>', |
139 | 139 | $shortcode, |
140 | 140 | $values['label'], |
@@ -143,37 +143,37 @@ discard block |
||
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | - if ( ! empty( $shortcodes ) ) { |
|
146 | + if ( ! empty($shortcodes)) { |
|
147 | 147 | |
148 | 148 | // check current WP version |
149 | - $img = ( version_compare( $wp_version, '3.5', '<' ) ) |
|
150 | - ? '<img src="' . GIVE_PLUGIN_URL . 'assets/images/give-media.png" />' |
|
151 | - : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>'; |
|
149 | + $img = (version_compare($wp_version, '3.5', '<')) |
|
150 | + ? '<img src="'.GIVE_PLUGIN_URL.'assets/images/give-media.png" />' |
|
151 | + : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>'; |
|
152 | 152 | |
153 | - reset( $shortcodes ); |
|
153 | + reset($shortcodes); |
|
154 | 154 | |
155 | - if ( count( $shortcodes ) == 1 ) { |
|
155 | + if (count($shortcodes) == 1) { |
|
156 | 156 | |
157 | - $shortcode = key( $shortcodes ); |
|
157 | + $shortcode = key($shortcodes); |
|
158 | 158 | |
159 | 159 | printf( |
160 | 160 | '<button class="button sc-shortcode" data-shortcode="%s">%s</button>', |
161 | 161 | $shortcode, |
162 | - sprintf( '%s %s %s', |
|
162 | + sprintf('%s %s %s', |
|
163 | 163 | $img, |
164 | - esc_html__( 'Insert', 'give' ), |
|
165 | - self::$shortcodes[ $shortcode ]['label'] |
|
164 | + esc_html__('Insert', 'give'), |
|
165 | + self::$shortcodes[$shortcode]['label'] |
|
166 | 166 | ) |
167 | 167 | ); |
168 | 168 | } else { |
169 | 169 | printf( |
170 | - '<div class="sc-wrap">' . |
|
171 | - '<button class="button sc-button">%s %s</button>' . |
|
172 | - '<div class="sc-menu mce-menu">%s</div>' . |
|
170 | + '<div class="sc-wrap">'. |
|
171 | + '<button class="button sc-button">%s %s</button>'. |
|
172 | + '<div class="sc-menu mce-menu">%s</div>'. |
|
173 | 173 | '</div>', |
174 | 174 | $img, |
175 | - esc_html__( 'Give Shortcodes', 'give' ), |
|
176 | - implode( '', array_values( $shortcodes ) ) |
|
175 | + esc_html__('Give Shortcodes', 'give'), |
|
176 | + implode('', array_values($shortcodes)) |
|
177 | 177 | ); |
178 | 178 | } |
179 | 179 | } |
@@ -189,15 +189,15 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function shortcode_ajax() { |
191 | 191 | |
192 | - $shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false; |
|
192 | + $shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false; |
|
193 | 193 | $response = false; |
194 | 194 | |
195 | - if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) { |
|
195 | + if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) { |
|
196 | 196 | |
197 | - $data = self::$shortcodes[ $shortcode ]; |
|
197 | + $data = self::$shortcodes[$shortcode]; |
|
198 | 198 | |
199 | - if ( ! empty( $data['errors'] ) ) { |
|
200 | - $data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) ); |
|
199 | + if ( ! empty($data['errors'])) { |
|
200 | + $data['btn_okay'] = array(esc_html__('Okay', 'give')); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | $response = array( |
@@ -209,10 +209,10 @@ discard block |
||
209 | 209 | ); |
210 | 210 | } else { |
211 | 211 | // todo: handle error |
212 | - error_log( print_r( 'AJAX error!', 1 ) ); |
|
212 | + error_log(print_r('AJAX error!', 1)); |
|
213 | 213 | } |
214 | 214 | |
215 | - wp_send_json( $response ); |
|
215 | + wp_send_json($response); |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Profile_Editor extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['label'] = esc_html__( 'Profile Editor', 'give' ); |
|
21 | + $this->shortcode['label'] = esc_html__('Profile Editor', 'give'); |
|
22 | 22 | |
23 | - parent::__construct( 'give_profile_editor' ); |
|
23 | + parent::__construct('give_profile_editor'); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 |