@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | */ |
41 | 41 | |
42 | 42 | // Exit if accessed directly |
43 | -if ( ! defined( 'ABSPATH' ) ) { |
|
43 | +if ( ! defined('ABSPATH')) { |
|
44 | 44 | exit; |
45 | 45 | } |
46 | 46 | |
47 | -if ( ! class_exists( 'Give' ) ) : |
|
47 | +if ( ! class_exists('Give')) : |
|
48 | 48 | /** |
49 | 49 | * Main Give Class |
50 | 50 | * |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | * @return Give |
160 | 160 | */ |
161 | 161 | public static function instance() { |
162 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) { |
|
162 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) { |
|
163 | 163 | self::$instance = new Give; |
164 | 164 | self::$instance->setup_constants(); |
165 | 165 | |
166 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
166 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain')); |
|
167 | 167 | |
168 | 168 | self::$instance->includes(); |
169 | 169 | self::$instance->roles = new Give_Roles(); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function __clone() { |
198 | 198 | // Cloning instances of the class is forbidden |
199 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
199 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function __wakeup() { |
210 | 210 | // Unserializing instances of the class is forbidden |
211 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
211 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -221,33 +221,33 @@ discard block |
||
221 | 221 | private function setup_constants() { |
222 | 222 | |
223 | 223 | // Plugin version |
224 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
225 | - define( 'GIVE_VERSION', '1.4.1' ); |
|
224 | + if ( ! defined('GIVE_VERSION')) { |
|
225 | + define('GIVE_VERSION', '1.4.1'); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | // Plugin Folder Path |
229 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
230 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
229 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
230 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | // Plugin Folder URL |
234 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
235 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
234 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
235 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | // Plugin Basename aka: "give/give.php" |
239 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
240 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
239 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
240 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | // Plugin Root File |
244 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
245 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
244 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
245 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | // Make sure CAL_GREGORIAN is defined |
249 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
250 | - define( 'CAL_GREGORIAN', 1 ); |
|
249 | + if ( ! defined('CAL_GREGORIAN')) { |
|
250 | + define('CAL_GREGORIAN', 1); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
@@ -261,107 +261,107 @@ discard block |
||
261 | 261 | private function includes() { |
262 | 262 | global $give_options; |
263 | 263 | |
264 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/register-settings.php'; |
|
264 | + require_once GIVE_PLUGIN_DIR.'includes/admin/register-settings.php'; |
|
265 | 265 | $give_options = give_get_settings(); |
266 | 266 | |
267 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
268 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
269 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
270 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
271 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
272 | - |
|
273 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
274 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
275 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
276 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
277 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
278 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
279 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
280 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
281 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
282 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
283 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
284 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
285 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
286 | - |
|
287 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
288 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
289 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
290 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
291 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
292 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
293 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
294 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
295 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
296 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
297 | - require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php'; |
|
298 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
299 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
300 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
301 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated-functions.php'; |
|
302 | - |
|
303 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
304 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
305 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
306 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
307 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-donators-gravatars.php'; |
|
308 | - |
|
309 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
310 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
311 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
312 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
313 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
314 | - |
|
315 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
316 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
317 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
318 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
319 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
320 | - |
|
321 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
322 | - |
|
323 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
324 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
325 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
326 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
327 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
328 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
329 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
330 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/export-functions.php'; |
|
331 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
332 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
333 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
334 | - |
|
335 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
336 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
337 | - |
|
338 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
339 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
340 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
341 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
342 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
343 | - |
|
344 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
345 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
346 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
347 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
348 | - |
|
349 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
350 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
351 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
352 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
353 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
354 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
355 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
356 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
357 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
358 | - |
|
359 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
360 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
267 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
268 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
269 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
270 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
271 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
272 | + |
|
273 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
274 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
275 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
276 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
277 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
278 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
279 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
280 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
281 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
282 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
283 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
284 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
285 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
286 | + |
|
287 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
288 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
289 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
290 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
291 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
292 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
293 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
294 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
295 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
296 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
297 | + require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php'; |
|
298 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
299 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
300 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
301 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated-functions.php'; |
|
302 | + |
|
303 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
304 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
305 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
306 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
307 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-donators-gravatars.php'; |
|
308 | + |
|
309 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
310 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
311 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
312 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
313 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
314 | + |
|
315 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
316 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
317 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
318 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
319 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
320 | + |
|
321 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
322 | + |
|
323 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
324 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
325 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
326 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
327 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
328 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
329 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
330 | + require_once GIVE_PLUGIN_DIR.'includes/admin/export-functions.php'; |
|
331 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
332 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
333 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
334 | + |
|
335 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
336 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
337 | + |
|
338 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
339 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
340 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
341 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
342 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
343 | + |
|
344 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
345 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
346 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
347 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
348 | + |
|
349 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
350 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
351 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
352 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
353 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
354 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
355 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
356 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
357 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
358 | + |
|
359 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
360 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
361 | 361 | |
362 | 362 | } |
363 | 363 | |
364 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
364 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
365 | 365 | |
366 | 366 | } |
367 | 367 | |
@@ -374,26 +374,26 @@ discard block |
||
374 | 374 | */ |
375 | 375 | public function load_textdomain() { |
376 | 376 | // Set filter for Give's languages directory |
377 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
378 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
377 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
378 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
379 | 379 | |
380 | 380 | // Traditional WordPress plugin locale filter |
381 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
382 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
381 | + $locale = apply_filters('plugin_locale', get_locale(), 'give'); |
|
382 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale); |
|
383 | 383 | |
384 | 384 | // Setup paths to current locale file |
385 | - $mofile_local = $give_lang_dir . $mofile; |
|
386 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
385 | + $mofile_local = $give_lang_dir.$mofile; |
|
386 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
387 | 387 | |
388 | - if ( file_exists( $mofile_global ) ) { |
|
388 | + if (file_exists($mofile_global)) { |
|
389 | 389 | // Look in global /wp-content/languages/give folder |
390 | - load_textdomain( 'give', $mofile_global ); |
|
391 | - } elseif ( file_exists( $mofile_local ) ) { |
|
390 | + load_textdomain('give', $mofile_global); |
|
391 | + } elseif (file_exists($mofile_local)) { |
|
392 | 392 | // Look in local location from filter `give_languages_directory` |
393 | - load_textdomain( 'give', $mofile_local ); |
|
393 | + load_textdomain('give', $mofile_local); |
|
394 | 394 | } else { |
395 | 395 | // Load the default language files packaged up w/ Give |
396 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
396 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
397 | 397 | } |
398 | 398 | } |
399 | 399 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -25,27 +25,27 @@ discard block |
||
25 | 25 | function give_test_ajax_works() { |
26 | 26 | |
27 | 27 | // Check if the Airplane Mode plugin is installed |
28 | - if ( class_exists( 'Airplane_Mode_Core' ) ) { |
|
28 | + if (class_exists('Airplane_Mode_Core')) { |
|
29 | 29 | |
30 | 30 | $airplane = Airplane_Mode_Core::getInstance(); |
31 | 31 | |
32 | - if ( method_exists( $airplane, 'enabled' ) ) { |
|
32 | + if (method_exists($airplane, 'enabled')) { |
|
33 | 33 | |
34 | - if ( $airplane->enabled() ) { |
|
34 | + if ($airplane->enabled()) { |
|
35 | 35 | return true; |
36 | 36 | } |
37 | 37 | |
38 | 38 | } else { |
39 | 39 | |
40 | - if ( $airplane->check_status() == 'on' ) { |
|
40 | + if ($airplane->check_status() == 'on') { |
|
41 | 41 | return true; |
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | - add_filter( 'block_local_requests', '__return_false' ); |
|
46 | + add_filter('block_local_requests', '__return_false'); |
|
47 | 47 | |
48 | - if ( get_transient( '_give_ajax_works' ) ) { |
|
48 | + if (get_transient('_give_ajax_works')) { |
|
49 | 49 | return true; |
50 | 50 | } |
51 | 51 | |
@@ -57,35 +57,35 @@ discard block |
||
57 | 57 | ) |
58 | 58 | ); |
59 | 59 | |
60 | - $ajax = wp_remote_post( give_get_ajax_url(), $params ); |
|
60 | + $ajax = wp_remote_post(give_get_ajax_url(), $params); |
|
61 | 61 | $works = true; |
62 | 62 | |
63 | - if ( is_wp_error( $ajax ) ) { |
|
63 | + if (is_wp_error($ajax)) { |
|
64 | 64 | |
65 | 65 | $works = false; |
66 | 66 | |
67 | 67 | } else { |
68 | 68 | |
69 | - if ( empty( $ajax['response'] ) ) { |
|
69 | + if (empty($ajax['response'])) { |
|
70 | 70 | $works = false; |
71 | 71 | } |
72 | 72 | |
73 | - if ( empty( $ajax['response']['code'] ) || 200 !== (int) $ajax['response']['code'] ) { |
|
73 | + if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) { |
|
74 | 74 | $works = false; |
75 | 75 | } |
76 | 76 | |
77 | - if ( empty( $ajax['response']['message'] ) || 'OK' !== $ajax['response']['message'] ) { |
|
77 | + if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) { |
|
78 | 78 | $works = false; |
79 | 79 | } |
80 | 80 | |
81 | - if ( ! isset( $ajax['body'] ) || 0 !== (int) $ajax['body'] ) { |
|
81 | + if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) { |
|
82 | 82 | $works = false; |
83 | 83 | } |
84 | 84 | |
85 | 85 | } |
86 | 86 | |
87 | - if ( $works ) { |
|
88 | - set_transient( '_give_ajax_works', '1', DAY_IN_SECONDS ); |
|
87 | + if ($works) { |
|
88 | + set_transient('_give_ajax_works', '1', DAY_IN_SECONDS); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return $works; |
@@ -99,16 +99,16 @@ discard block |
||
99 | 99 | * @return string |
100 | 100 | */ |
101 | 101 | function give_get_ajax_url() { |
102 | - $scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin'; |
|
102 | + $scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin'; |
|
103 | 103 | |
104 | 104 | $current_url = give_get_current_page_url(); |
105 | - $ajax_url = admin_url( 'admin-ajax.php', $scheme ); |
|
105 | + $ajax_url = admin_url('admin-ajax.php', $scheme); |
|
106 | 106 | |
107 | - if ( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) { |
|
108 | - $ajax_url = preg_replace( '/^http/', 'https', $ajax_url ); |
|
107 | + if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) { |
|
108 | + $ajax_url = preg_replace('/^http/', 'https', $ajax_url); |
|
109 | 109 | } |
110 | 110 | |
111 | - return apply_filters( 'give_ajax_url', $ajax_url ); |
|
111 | + return apply_filters('give_ajax_url', $ajax_url); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | * @return void |
119 | 119 | */ |
120 | 120 | function give_load_checkout_login_fields() { |
121 | - do_action( 'give_purchase_form_login_fields' ); |
|
121 | + do_action('give_purchase_form_login_fields'); |
|
122 | 122 | give_die(); |
123 | 123 | } |
124 | 124 | |
125 | -add_action( 'wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields' ); |
|
125 | +add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields'); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Load Checkout Fields |
@@ -131,22 +131,22 @@ discard block |
||
131 | 131 | * @return void |
132 | 132 | */ |
133 | 133 | function give_load_checkout_fields() { |
134 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : ''; |
|
134 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : ''; |
|
135 | 135 | |
136 | 136 | ob_start(); |
137 | 137 | |
138 | - do_action( 'give_purchase_form_register_login_fields', $form_id ); |
|
138 | + do_action('give_purchase_form_register_login_fields', $form_id); |
|
139 | 139 | |
140 | 140 | $fields = ob_get_clean(); |
141 | 141 | |
142 | - wp_send_json( array( |
|
143 | - 'fields' => wp_json_encode( $fields ), |
|
144 | - 'submit' => wp_json_encode( give_checkout_button_purchase( $form_id ) ), |
|
145 | - ) ); |
|
142 | + wp_send_json(array( |
|
143 | + 'fields' => wp_json_encode($fields), |
|
144 | + 'submit' => wp_json_encode(give_checkout_button_purchase($form_id)), |
|
145 | + )); |
|
146 | 146 | } |
147 | 147 | |
148 | -add_action( 'wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields' ); |
|
149 | -add_action( 'wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields' ); |
|
148 | +add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields'); |
|
149 | +add_action('wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields'); |
|
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Get Form Title via AJAX (used only in WordPress Admin) |
@@ -155,9 +155,9 @@ discard block |
||
155 | 155 | * @return void |
156 | 156 | */ |
157 | 157 | function give_ajax_get_form_title() { |
158 | - if ( isset( $_POST['form_id'] ) ) { |
|
159 | - $title = get_the_title( $_POST['form_id'] ); |
|
160 | - if ( $title ) { |
|
158 | + if (isset($_POST['form_id'])) { |
|
159 | + $title = get_the_title($_POST['form_id']); |
|
160 | + if ($title) { |
|
161 | 161 | echo $title; |
162 | 162 | } else { |
163 | 163 | echo 'fail'; |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | give_die(); |
167 | 167 | } |
168 | 168 | |
169 | -add_action( 'wp_ajax_give_get_form_title', 'give_ajax_get_form_title' ); |
|
170 | -add_action( 'wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title' ); |
|
169 | +add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title'); |
|
170 | +add_action('wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title'); |
|
171 | 171 | |
172 | 172 | /** |
173 | 173 | * Retrieve a states drop down |
@@ -177,23 +177,23 @@ discard block |
||
177 | 177 | */ |
178 | 178 | function give_ajax_get_states_field() { |
179 | 179 | |
180 | - if ( empty( $_POST['country'] ) ) { |
|
180 | + if (empty($_POST['country'])) { |
|
181 | 181 | $_POST['country'] = give_get_country(); |
182 | 182 | } |
183 | - $states = give_get_states( $_POST['country'] ); |
|
183 | + $states = give_get_states($_POST['country']); |
|
184 | 184 | |
185 | - if ( ! empty( $states ) ) { |
|
185 | + if ( ! empty($states)) { |
|
186 | 186 | |
187 | 187 | $args = array( |
188 | 188 | 'name' => $_POST['field_name'], |
189 | 189 | 'id' => $_POST['field_name'], |
190 | - 'class' => $_POST['field_name'] . ' give-select', |
|
191 | - 'options' => give_get_states( $_POST['country'] ), |
|
190 | + 'class' => $_POST['field_name'].' give-select', |
|
191 | + 'options' => give_get_states($_POST['country']), |
|
192 | 192 | 'show_option_all' => false, |
193 | 193 | 'show_option_none' => false |
194 | 194 | ); |
195 | 195 | |
196 | - $response = Give()->html->select( $args ); |
|
196 | + $response = Give()->html->select($args); |
|
197 | 197 | |
198 | 198 | } else { |
199 | 199 | |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | give_die(); |
206 | 206 | } |
207 | 207 | |
208 | -add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' ); |
|
209 | -add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' ); |
|
208 | +add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field'); |
|
209 | +add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field'); |
|
210 | 210 | |
211 | 211 | /** |
212 | 212 | * Retrieve a states drop down |
@@ -217,17 +217,17 @@ discard block |
||
217 | 217 | function give_ajax_form_search() { |
218 | 218 | global $wpdb; |
219 | 219 | |
220 | - $search = esc_sql( sanitize_text_field( $_GET['s'] ) ); |
|
220 | + $search = esc_sql(sanitize_text_field($_GET['s'])); |
|
221 | 221 | $results = array(); |
222 | - if ( current_user_can( 'edit_give_forms' ) ) { |
|
223 | - $items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50" ); |
|
222 | + if (current_user_can('edit_give_forms')) { |
|
223 | + $items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50"); |
|
224 | 224 | } else { |
225 | - $items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50" ); |
|
225 | + $items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50"); |
|
226 | 226 | } |
227 | 227 | |
228 | - if ( $items ) { |
|
228 | + if ($items) { |
|
229 | 229 | |
230 | - foreach ( $items as $item ) { |
|
230 | + foreach ($items as $item) { |
|
231 | 231 | |
232 | 232 | $results[] = array( |
233 | 233 | 'id' => $item->ID, |
@@ -239,18 +239,18 @@ discard block |
||
239 | 239 | |
240 | 240 | $items[] = array( |
241 | 241 | 'id' => 0, |
242 | - 'name' => __( 'No results found', 'give' ) |
|
242 | + 'name' => __('No results found', 'give') |
|
243 | 243 | ); |
244 | 244 | |
245 | 245 | } |
246 | 246 | |
247 | - echo json_encode( $results ); |
|
247 | + echo json_encode($results); |
|
248 | 248 | |
249 | 249 | give_die(); |
250 | 250 | } |
251 | 251 | |
252 | -add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' ); |
|
253 | -add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' ); |
|
252 | +add_action('wp_ajax_give_form_search', 'give_ajax_form_search'); |
|
253 | +add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search'); |
|
254 | 254 | |
255 | 255 | /** |
256 | 256 | * Search the donors database via Ajax |
@@ -261,21 +261,21 @@ discard block |
||
261 | 261 | function give_ajax_donor_search() { |
262 | 262 | global $wpdb; |
263 | 263 | |
264 | - $search = esc_sql( sanitize_text_field( $_GET['s'] ) ); |
|
264 | + $search = esc_sql(sanitize_text_field($_GET['s'])); |
|
265 | 265 | $results = array(); |
266 | - if ( ! current_user_can( 'view_give_reports' ) ) { |
|
266 | + if ( ! current_user_can('view_give_reports')) { |
|
267 | 267 | $donors = array(); |
268 | 268 | } else { |
269 | - $donors = $wpdb->get_results( "SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" ); |
|
269 | + $donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50"); |
|
270 | 270 | } |
271 | 271 | |
272 | - if ( $donors ) { |
|
272 | + if ($donors) { |
|
273 | 273 | |
274 | - foreach ( $donors as $donor ) { |
|
274 | + foreach ($donors as $donor) { |
|
275 | 275 | |
276 | 276 | $results[] = array( |
277 | 277 | 'id' => $donor->id, |
278 | - 'name' => $donor->name . '(' . $donor->email . ')' |
|
278 | + 'name' => $donor->name.'('.$donor->email.')' |
|
279 | 279 | ); |
280 | 280 | } |
281 | 281 | |
@@ -283,17 +283,17 @@ discard block |
||
283 | 283 | |
284 | 284 | $donors[] = array( |
285 | 285 | 'id' => 0, |
286 | - 'name' => __( 'No results found', 'give' ) |
|
286 | + 'name' => __('No results found', 'give') |
|
287 | 287 | ); |
288 | 288 | |
289 | 289 | } |
290 | 290 | |
291 | - echo json_encode( $results ); |
|
291 | + echo json_encode($results); |
|
292 | 292 | |
293 | 293 | give_die(); |
294 | 294 | } |
295 | 295 | |
296 | -add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' ); |
|
296 | +add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search'); |
|
297 | 297 | |
298 | 298 | |
299 | 299 | /** |
@@ -304,30 +304,30 @@ discard block |
||
304 | 304 | */ |
305 | 305 | function give_ajax_search_users() { |
306 | 306 | |
307 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
307 | + if (current_user_can('manage_give_settings')) { |
|
308 | 308 | |
309 | - $search_query = trim( $_POST['user_name'] ); |
|
309 | + $search_query = trim($_POST['user_name']); |
|
310 | 310 | |
311 | - $found_users = get_users( array( |
|
311 | + $found_users = get_users(array( |
|
312 | 312 | 'number' => 9999, |
313 | - 'search' => $search_query . '*' |
|
313 | + 'search' => $search_query.'*' |
|
314 | 314 | ) |
315 | 315 | ); |
316 | 316 | |
317 | 317 | $user_list = '<ul>'; |
318 | - if ( $found_users ) { |
|
319 | - foreach ( $found_users as $user ) { |
|
320 | - $user_list .= '<li><a href="#" data-login="' . esc_attr( $user->user_login ) . '">' . esc_html( $user->user_login ) . '</a></li>'; |
|
318 | + if ($found_users) { |
|
319 | + foreach ($found_users as $user) { |
|
320 | + $user_list .= '<li><a href="#" data-login="'.esc_attr($user->user_login).'">'.esc_html($user->user_login).'</a></li>'; |
|
321 | 321 | } |
322 | 322 | } else { |
323 | - $user_list .= '<li>' . __( 'No users found', 'give' ) . '</li>'; |
|
323 | + $user_list .= '<li>'.__('No users found', 'give').'</li>'; |
|
324 | 324 | } |
325 | 325 | $user_list .= '</ul>'; |
326 | 326 | |
327 | - echo json_encode( array( 'results' => $user_list ) ); |
|
327 | + echo json_encode(array('results' => $user_list)); |
|
328 | 328 | |
329 | 329 | } |
330 | 330 | die(); |
331 | 331 | } |
332 | 332 | |
333 | -add_action( 'wp_ajax_give_search_users', 'give_ajax_search_users' ); |
|
334 | 333 | \ No newline at end of file |
334 | +add_action('wp_ajax_give_search_users', 'give_ajax_search_users'); |
|
335 | 335 | \ No newline at end of file |