@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | -if ( ! class_exists( 'Give_License' ) ) : |
|
17 | +if ( ! class_exists('Give_License')) : |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Give_License Class |
@@ -143,27 +143,27 @@ discard block |
||
143 | 143 | * @param string $_checkout_url |
144 | 144 | * @param string $_account_url |
145 | 145 | */ |
146 | - public function __construct( $_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null, $_checkout_url = null, $_account_url = null ) { |
|
146 | + public function __construct($_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null, $_checkout_url = null, $_account_url = null) { |
|
147 | 147 | |
148 | 148 | $give_options = give_get_settings(); |
149 | 149 | |
150 | 150 | $this->file = $_file; |
151 | 151 | $this->item_name = $_item_name; |
152 | - $this->item_shortname = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $this->item_name ) ) ); |
|
152 | + $this->item_shortname = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($this->item_name))); |
|
153 | 153 | $this->version = $_version; |
154 | - $this->license = isset( $give_options[ $this->item_shortname . '_license_key' ] ) ? trim( $give_options[ $this->item_shortname . '_license_key' ] ) : ''; |
|
155 | - $this->license_data = get_option( $this->item_shortname . '_license_active' ); |
|
154 | + $this->license = isset($give_options[$this->item_shortname.'_license_key']) ? trim($give_options[$this->item_shortname.'_license_key']) : ''; |
|
155 | + $this->license_data = get_option($this->item_shortname.'_license_active'); |
|
156 | 156 | $this->author = $_author; |
157 | - $this->api_url = is_null( $_api_url ) ? $this->api_url : $_api_url; |
|
158 | - $this->checkout_url = is_null( $_checkout_url ) ? $this->checkout_url : $_checkout_url; |
|
159 | - $this->account_url = is_null( $_account_url ) ? $this->account_url : $_account_url; |
|
157 | + $this->api_url = is_null($_api_url) ? $this->api_url : $_api_url; |
|
158 | + $this->checkout_url = is_null($_checkout_url) ? $this->checkout_url : $_checkout_url; |
|
159 | + $this->account_url = is_null($_account_url) ? $this->account_url : $_account_url; |
|
160 | 160 | $this->auto_updater_obj = null; |
161 | 161 | |
162 | 162 | // Add Setting for Give Add-on activation status. |
163 | - $is_addon_activated = get_option( 'give_is_addon_activated' ); |
|
164 | - if( ! $is_addon_activated && is_object( $this ) && sizeof( $this ) > 0 ) { |
|
165 | - update_option( 'give_is_addon_activated', true ); |
|
166 | - Give_Cache::set( 'give_cache_hide_license_notice_after_activation', true, DAY_IN_SECONDS ); |
|
163 | + $is_addon_activated = get_option('give_is_addon_activated'); |
|
164 | + if ( ! $is_addon_activated && is_object($this) && sizeof($this) > 0) { |
|
165 | + update_option('give_is_addon_activated', true); |
|
166 | + Give_Cache::set('give_cache_hide_license_notice_after_activation', true, DAY_IN_SECONDS); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | // Setup hooks |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | private function includes() { |
186 | 186 | |
187 | - if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
187 | + if ( ! class_exists('EDD_SL_Plugin_Updater')) { |
|
188 | 188 | require_once 'admin/EDD_SL_Plugin_Updater.php'; |
189 | 189 | } |
190 | 190 | } |
@@ -202,30 +202,30 @@ discard block |
||
202 | 202 | private function hooks() { |
203 | 203 | |
204 | 204 | // Register settings. |
205 | - add_filter( 'give_settings_licenses', array( $this, 'settings' ), 1 ); |
|
205 | + add_filter('give_settings_licenses', array($this, 'settings'), 1); |
|
206 | 206 | |
207 | 207 | // Activate license key on settings save. |
208 | - add_action( 'admin_init', array( $this, 'activate_license' ) ); |
|
208 | + add_action('admin_init', array($this, 'activate_license')); |
|
209 | 209 | |
210 | 210 | // Deactivate license key. |
211 | - add_action( 'admin_init', array( $this, 'deactivate_license' ) ); |
|
211 | + add_action('admin_init', array($this, 'deactivate_license')); |
|
212 | 212 | |
213 | 213 | // Updater. |
214 | - add_action( 'admin_init', array( $this, 'auto_updater' ), 0 ); |
|
215 | - add_action( 'admin_notices', array( $this, 'notices' ) ); |
|
214 | + add_action('admin_init', array($this, 'auto_updater'), 0); |
|
215 | + add_action('admin_notices', array($this, 'notices')); |
|
216 | 216 | |
217 | 217 | // Check license weekly. |
218 | - Give_Cron::add_weekly_event( array( $this, 'weekly_license_check' ) ); |
|
219 | - add_action( 'give_validate_license_when_site_migrated', array( $this, 'weekly_license_check' ) ); |
|
218 | + Give_Cron::add_weekly_event(array($this, 'weekly_license_check')); |
|
219 | + add_action('give_validate_license_when_site_migrated', array($this, 'weekly_license_check')); |
|
220 | 220 | |
221 | 221 | // Check subscription weekly. |
222 | - Give_Cron::add_weekly_event( array( $this, 'weekly_subscription_check' ) ); |
|
223 | - add_action( 'give_validate_license_when_site_migrated', array( $this, 'weekly_subscription_check' ) ); |
|
222 | + Give_Cron::add_weekly_event(array($this, 'weekly_subscription_check')); |
|
223 | + add_action('give_validate_license_when_site_migrated', array($this, 'weekly_subscription_check')); |
|
224 | 224 | |
225 | 225 | // Show addon notice on plugin page. |
226 | - $plugin_name = explode( 'plugins/', $this->file ); |
|
227 | - $plugin_name = end( $plugin_name ); |
|
228 | - add_action( "after_plugin_row_{$plugin_name}", array( $this, 'plugin_page_notices' ), 10, 3 ); |
|
226 | + $plugin_name = explode('plugins/', $this->file); |
|
227 | + $plugin_name = end($plugin_name); |
|
228 | + add_action("after_plugin_row_{$plugin_name}", array($this, 'plugin_page_notices'), 10, 3); |
|
229 | 229 | |
230 | 230 | } |
231 | 231 | |
@@ -265,16 +265,16 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @return array License settings. |
267 | 267 | */ |
268 | - public function settings( $settings ) { |
|
268 | + public function settings($settings) { |
|
269 | 269 | |
270 | 270 | $give_license_settings = array( |
271 | 271 | array( |
272 | 272 | 'name' => $this->item_name, |
273 | - 'id' => $this->item_shortname . '_license_key', |
|
273 | + 'id' => $this->item_shortname.'_license_key', |
|
274 | 274 | 'desc' => '', |
275 | 275 | 'type' => 'license_key', |
276 | 276 | 'options' => array( |
277 | - 'license' => get_option( $this->item_shortname . '_license_active' ), |
|
277 | + 'license' => get_option($this->item_shortname.'_license_active'), |
|
278 | 278 | 'shortname' => $this->item_shortname, |
279 | 279 | 'item_name' => $this->item_name, |
280 | 280 | 'api_url' => $this->api_url, |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | ), |
286 | 286 | ); |
287 | 287 | |
288 | - return array_merge( $settings, $give_license_settings ); |
|
288 | + return array_merge($settings, $give_license_settings); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
@@ -300,18 +300,18 @@ discard block |
||
300 | 300 | * |
301 | 301 | * @return array License settings content. |
302 | 302 | */ |
303 | - public function license_settings_content( $settings ) { |
|
303 | + public function license_settings_content($settings) { |
|
304 | 304 | |
305 | 305 | $give_license_settings = array( |
306 | 306 | array( |
307 | - 'name' => __( 'Add-on Licenses', 'give' ), |
|
307 | + 'name' => __('Add-on Licenses', 'give'), |
|
308 | 308 | 'desc' => '<hr>', |
309 | 309 | 'type' => 'give_title', |
310 | 310 | 'id' => 'give_title', |
311 | 311 | ), |
312 | 312 | ); |
313 | 313 | |
314 | - return array_merge( $settings, $give_license_settings ); |
|
314 | + return array_merge($settings, $give_license_settings); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -326,65 +326,65 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public function activate_license() { |
328 | 328 | // Bailout. |
329 | - if( ! $this->__is_user_can_edit_license() ) { |
|
329 | + if ( ! $this->__is_user_can_edit_license()) { |
|
330 | 330 | return; |
331 | 331 | } |
332 | 332 | |
333 | 333 | // Allow third party addon developers to handle license activation. |
334 | - if ( $this->__is_third_party_addon() ) { |
|
335 | - do_action( 'give_activate_license', $this ); |
|
334 | + if ($this->__is_third_party_addon()) { |
|
335 | + do_action('give_activate_license', $this); |
|
336 | 336 | |
337 | 337 | return; |
338 | 338 | } |
339 | 339 | |
340 | 340 | // Do not simultaneously activate add-ons if the user want to deactivate a specific add-on. |
341 | - foreach ( $_POST as $key => $value ) { |
|
342 | - if ( false !== strpos( $key, 'license_key_deactivate' ) ) { |
|
341 | + foreach ($_POST as $key => $value) { |
|
342 | + if (false !== strpos($key, 'license_key_deactivate')) { |
|
343 | 343 | // Don't activate a key when deactivating a different key |
344 | 344 | return; |
345 | 345 | } |
346 | 346 | } |
347 | 347 | |
348 | 348 | // Delete previous license setting if a empty license key submitted. |
349 | - if ( empty( $_POST["{$this->item_shortname}_license_key"] ) ) { |
|
349 | + if (empty($_POST["{$this->item_shortname}_license_key"])) { |
|
350 | 350 | $this->unset_license(); |
351 | 351 | |
352 | 352 | return; |
353 | 353 | } |
354 | 354 | |
355 | 355 | // Check if plugin previously installed. |
356 | - if ( $this->is_valid_license() ) { |
|
356 | + if ($this->is_valid_license()) { |
|
357 | 357 | return; |
358 | 358 | } |
359 | 359 | |
360 | 360 | // Get license key. |
361 | - $this->license = sanitize_text_field( $_POST[ $this->item_shortname . '_license_key' ] ); |
|
361 | + $this->license = sanitize_text_field($_POST[$this->item_shortname.'_license_key']); |
|
362 | 362 | |
363 | 363 | // Delete previous license key from subscription if previously added. |
364 | 364 | $this->__remove_license_key_from_subscriptions(); |
365 | 365 | |
366 | 366 | // Make sure there are no api errors. |
367 | - if ( ! ( $license_data = $this->get_license_info( 'activate_license' ) ) ) { |
|
367 | + if ( ! ($license_data = $this->get_license_info('activate_license'))) { |
|
368 | 368 | return; |
369 | 369 | } |
370 | 370 | |
371 | 371 | // Make sure license is valid. |
372 | 372 | // return because admin will want to activate license again. |
373 | - if ( ! $this->is_license( $license_data ) ) { |
|
373 | + if ( ! $this->is_license($license_data)) { |
|
374 | 374 | // Add license key. |
375 | - give_update_option( "{$this->item_shortname}_license_key", $this->license ); |
|
375 | + give_update_option("{$this->item_shortname}_license_key", $this->license); |
|
376 | 376 | |
377 | 377 | return; |
378 | 378 | } |
379 | 379 | |
380 | 380 | // Tell WordPress to look for updates. |
381 | - set_site_transient( 'update_plugins', null ); |
|
381 | + set_site_transient('update_plugins', null); |
|
382 | 382 | |
383 | 383 | // Add license data. |
384 | - update_option( "{$this->item_shortname}_license_active", $license_data ); |
|
384 | + update_option("{$this->item_shortname}_license_active", $license_data); |
|
385 | 385 | |
386 | 386 | // Add license key. |
387 | - give_update_option( "{$this->item_shortname}_license_key", $this->license ); |
|
387 | + give_update_option("{$this->item_shortname}_license_key", $this->license); |
|
388 | 388 | |
389 | 389 | // Check subscription for license key and store this to db (if any). |
390 | 390 | $this->__single_subscription_check(); |
@@ -402,27 +402,27 @@ discard block |
||
402 | 402 | */ |
403 | 403 | public function deactivate_license() { |
404 | 404 | // Bailout. |
405 | - if( ! $this->__is_user_can_edit_license() ) { |
|
405 | + if ( ! $this->__is_user_can_edit_license()) { |
|
406 | 406 | return; |
407 | 407 | } |
408 | 408 | |
409 | 409 | // Allow third party add-on developers to handle license deactivation. |
410 | - if ( $this->__is_third_party_addon() ) { |
|
411 | - do_action( 'give_deactivate_license', $this ); |
|
410 | + if ($this->__is_third_party_addon()) { |
|
411 | + do_action('give_deactivate_license', $this); |
|
412 | 412 | |
413 | 413 | return; |
414 | 414 | } |
415 | 415 | |
416 | 416 | // Run on deactivate button press. |
417 | - if ( isset( $_POST[ $this->item_shortname . '_license_key_deactivate' ] ) ) { |
|
417 | + if (isset($_POST[$this->item_shortname.'_license_key_deactivate'])) { |
|
418 | 418 | |
419 | 419 | // Make sure there are no api errors. |
420 | - if ( ! ( $license_data = $this->get_license_info( 'deactivate_license' ) ) ) { |
|
420 | + if ( ! ($license_data = $this->get_license_info('deactivate_license'))) { |
|
421 | 421 | return; |
422 | 422 | } |
423 | 423 | |
424 | 424 | // Ensure deactivated successfully. |
425 | - if ( isset( $license_data->success ) ) { |
|
425 | + if (isset($license_data->success)) { |
|
426 | 426 | $this->unset_license(); |
427 | 427 | } |
428 | 428 | }// End if(). |
@@ -439,30 +439,30 @@ discard block |
||
439 | 439 | public function weekly_license_check() { |
440 | 440 | |
441 | 441 | if ( |
442 | - ! empty( $_POST['give_settings'] ) || |
|
443 | - empty( $this->license ) |
|
442 | + ! empty($_POST['give_settings']) || |
|
443 | + empty($this->license) |
|
444 | 444 | ) { |
445 | 445 | return; |
446 | 446 | } |
447 | 447 | |
448 | 448 | // Allow third party add-on developers to handle their license check. |
449 | - if ( $this->__is_third_party_addon() ) { |
|
450 | - do_action( 'give_weekly_license_check', $this ); |
|
449 | + if ($this->__is_third_party_addon()) { |
|
450 | + do_action('give_weekly_license_check', $this); |
|
451 | 451 | |
452 | 452 | return; |
453 | 453 | } |
454 | 454 | |
455 | 455 | // Make sure there are no api errors. |
456 | - if ( ! ( $license_data = $this->get_license_info( 'check_license' ) ) ) { |
|
456 | + if ( ! ($license_data = $this->get_license_info('check_license'))) { |
|
457 | 457 | return; |
458 | 458 | } |
459 | 459 | |
460 | 460 | // Bailout. |
461 | - if( ! $this->is_license( $license_data ) ) { |
|
461 | + if ( ! $this->is_license($license_data)) { |
|
462 | 462 | return; |
463 | 463 | } |
464 | 464 | |
465 | - update_option( $this->item_shortname . '_license_active', $license_data ); |
|
465 | + update_option($this->item_shortname.'_license_active', $license_data); |
|
466 | 466 | |
467 | 467 | return; |
468 | 468 | } |
@@ -478,21 +478,21 @@ discard block |
||
478 | 478 | public function weekly_subscription_check() { |
479 | 479 | // Bailout. |
480 | 480 | if ( |
481 | - ! empty( $_POST['give_settings'] ) || |
|
482 | - empty( $this->license ) |
|
481 | + ! empty($_POST['give_settings']) || |
|
482 | + empty($this->license) |
|
483 | 483 | ) { |
484 | 484 | return; |
485 | 485 | } |
486 | 486 | |
487 | 487 | // Remove old subscription data. |
488 | - if ( absint( get_option( '_give_subscriptions_edit_last', true ) ) < current_time( 'timestamp', 1 ) ) { |
|
489 | - delete_option( 'give_subscriptions' ); |
|
490 | - update_option( '_give_subscriptions_edit_last', strtotime( '+ 1 day', current_time( 'timestamp', 1 ) ) ); |
|
488 | + if (absint(get_option('_give_subscriptions_edit_last', true)) < current_time('timestamp', 1)) { |
|
489 | + delete_option('give_subscriptions'); |
|
490 | + update_option('_give_subscriptions_edit_last', strtotime('+ 1 day', current_time('timestamp', 1))); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | // Allow third party add-on developers to handle their subscription check. |
494 | - if ( $this->__is_third_party_addon() ) { |
|
495 | - do_action( 'give_weekly_subscription_check', $this ); |
|
494 | + if ($this->__is_third_party_addon()) { |
|
495 | + do_action('give_weekly_subscription_check', $this); |
|
496 | 496 | |
497 | 497 | return; |
498 | 498 | } |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | * @return void |
510 | 510 | */ |
511 | 511 | private function __single_subscription_check() { |
512 | - if ( empty( $this->license ) ) { |
|
512 | + if (empty($this->license)) { |
|
513 | 513 | return; |
514 | 514 | } |
515 | 515 | |
@@ -517,33 +517,33 @@ discard block |
||
517 | 517 | // Do not get confused with edd_action check_subscription. |
518 | 518 | // By default edd software licensing api does not have api to check subscription. |
519 | 519 | // This is a custom feature to check subscriptions. |
520 | - if ( ! ( $subscription_data = $this->get_license_info( 'check_subscription', true ) ) ) { |
|
520 | + if ( ! ($subscription_data = $this->get_license_info('check_subscription', true))) { |
|
521 | 521 | return; |
522 | 522 | } |
523 | 523 | |
524 | 524 | // Bailout. |
525 | - if( ! $this->is_subscription( $subscription_data ) ) { |
|
525 | + if ( ! $this->is_subscription($subscription_data)) { |
|
526 | 526 | return; |
527 | 527 | } |
528 | 528 | |
529 | - if ( ! empty( $subscription_data['success'] ) && absint( $subscription_data['success'] ) ) { |
|
530 | - $subscriptions = get_option( 'give_subscriptions', array() ); |
|
529 | + if ( ! empty($subscription_data['success']) && absint($subscription_data['success'])) { |
|
530 | + $subscriptions = get_option('give_subscriptions', array()); |
|
531 | 531 | |
532 | 532 | // Update subscription data only if subscription does not exist already. |
533 | - $subscriptions[ $subscription_data['id'] ] = $subscription_data; |
|
533 | + $subscriptions[$subscription_data['id']] = $subscription_data; |
|
534 | 534 | |
535 | 535 | |
536 | 536 | // Initiate default set of license for subscription. |
537 | - if( ! isset( $subscriptions[ $subscription_data['id'] ]['licenses'] ) ) { |
|
538 | - $subscriptions[ $subscription_data['id']]['licenses'] = array(); |
|
537 | + if ( ! isset($subscriptions[$subscription_data['id']]['licenses'])) { |
|
538 | + $subscriptions[$subscription_data['id']]['licenses'] = array(); |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | // Store licenses for subscription. |
542 | - if ( ! in_array( $this->license, $subscriptions[ $subscription_data['id'] ]['licenses'] ) ) { |
|
543 | - $subscriptions[ $subscription_data['id']]['licenses'][] = $this->license; |
|
542 | + if ( ! in_array($this->license, $subscriptions[$subscription_data['id']]['licenses'])) { |
|
543 | + $subscriptions[$subscription_data['id']]['licenses'][] = $this->license; |
|
544 | 544 | } |
545 | 545 | |
546 | - update_option( 'give_subscriptions', $subscriptions ); |
|
546 | + update_option('give_subscriptions', $subscriptions); |
|
547 | 547 | } |
548 | 548 | } |
549 | 549 | |
@@ -557,12 +557,12 @@ discard block |
||
557 | 557 | */ |
558 | 558 | public function notices() { |
559 | 559 | |
560 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
560 | + if ( ! current_user_can('manage_give_settings')) { |
|
561 | 561 | return; |
562 | 562 | } |
563 | 563 | |
564 | 564 | // Do not show licenses notices on license tab. |
565 | - if ( 'licenses' === give_get_current_setting_tab() ) { |
|
565 | + if ('licenses' === give_get_current_setting_tab()) { |
|
566 | 566 | return; |
567 | 567 | } |
568 | 568 | |
@@ -571,118 +571,118 @@ discard block |
||
571 | 571 | static $addon_license_key_in_subscriptions; |
572 | 572 | |
573 | 573 | // Set default value. |
574 | - $addon_license_key_in_subscriptions = ! empty( $addon_license_key_in_subscriptions ) ? $addon_license_key_in_subscriptions : array(); |
|
574 | + $addon_license_key_in_subscriptions = ! empty($addon_license_key_in_subscriptions) ? $addon_license_key_in_subscriptions : array(); |
|
575 | 575 | $messages = array(); |
576 | 576 | |
577 | 577 | // Check whether admin has Give Add-on activated since 24 hours? |
578 | - $is_license_notice_hidden = Give_Cache::get( 'give_cache_hide_license_notice_after_activation' ); |
|
578 | + $is_license_notice_hidden = Give_Cache::get('give_cache_hide_license_notice_after_activation'); |
|
579 | 579 | |
580 | 580 | // Display Invalid License notice, if its more than 24 hours since first Give Add-on activation. |
581 | 581 | if ( |
582 | - empty( $this->license ) |
|
583 | - && empty( $showed_invalid_message ) |
|
584 | - && ( false === $is_license_notice_hidden ) |
|
582 | + empty($this->license) |
|
583 | + && empty($showed_invalid_message) |
|
584 | + && (false === $is_license_notice_hidden) |
|
585 | 585 | ) { |
586 | 586 | |
587 | - Give()->notices->register_notice( array( |
|
587 | + Give()->notices->register_notice(array( |
|
588 | 588 | 'id' => 'give-invalid-license', |
589 | 589 | 'type' => 'error', |
590 | 590 | 'description' => sprintf( |
591 | - __( 'You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give' ), |
|
592 | - admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' ) |
|
591 | + __('You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give'), |
|
592 | + admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses') |
|
593 | 593 | ), |
594 | 594 | 'dismissible_type' => 'user', |
595 | 595 | 'dismiss_interval' => 'shortly', |
596 | - ) ); |
|
596 | + )); |
|
597 | 597 | |
598 | 598 | $showed_invalid_message = true; |
599 | 599 | |
600 | 600 | } |
601 | 601 | |
602 | 602 | // Get subscriptions. |
603 | - $subscriptions = get_option( 'give_subscriptions' ); |
|
603 | + $subscriptions = get_option('give_subscriptions'); |
|
604 | 604 | |
605 | 605 | // Show subscription messages. |
606 | - if ( ! empty( $subscriptions ) && ! $showed_subscriptions_message ) { |
|
606 | + if ( ! empty($subscriptions) && ! $showed_subscriptions_message) { |
|
607 | 607 | |
608 | - foreach ( $subscriptions as $subscription ) { |
|
608 | + foreach ($subscriptions as $subscription) { |
|
609 | 609 | // Subscription expires timestamp. |
610 | - $subscription_expires = strtotime( $subscription['expires'] ); |
|
610 | + $subscription_expires = strtotime($subscription['expires']); |
|
611 | 611 | |
612 | 612 | // Start showing subscriptions message before one week of renewal date. |
613 | - if ( strtotime( '- 7 days', $subscription_expires ) > current_time( 'timestamp', 1 ) ) { |
|
613 | + if (strtotime('- 7 days', $subscription_expires) > current_time('timestamp', 1)) { |
|
614 | 614 | continue; |
615 | 615 | } |
616 | 616 | |
617 | 617 | // Check if subscription message already exist in messages. |
618 | - if ( array_key_exists( $subscription['id'], $messages ) ) { |
|
618 | + if (array_key_exists($subscription['id'], $messages)) { |
|
619 | 619 | continue; |
620 | 620 | } |
621 | 621 | |
622 | 622 | // Check if license already expired. |
623 | - if ( strtotime( $subscription['expires'] ) < current_time( 'timestamp', 1 ) ) { |
|
624 | - Give()->notices->register_notice( array( |
|
623 | + if (strtotime($subscription['expires']) < current_time('timestamp', 1)) { |
|
624 | + Give()->notices->register_notice(array( |
|
625 | 625 | 'id' => "give-expired-subscription-{$subscription['id']}", |
626 | 626 | 'type' => 'error', |
627 | 627 | 'description' => sprintf( |
628 | - __( 'Your Give add-on license expired for payment <a href="%1$s" target="_blank">#%2$d</a>. <a href="%3$s" target="_blank">Click to renew an existing license</a> or %4$s.', 'give' ), |
|
629 | - urldecode( $subscription['invoice_url'] ), |
|
628 | + __('Your Give add-on license expired for payment <a href="%1$s" target="_blank">#%2$d</a>. <a href="%3$s" target="_blank">Click to renew an existing license</a> or %4$s.', 'give'), |
|
629 | + urldecode($subscription['invoice_url']), |
|
630 | 630 | $subscription['payment_id'], |
631 | 631 | "{$this->checkout_url}?edd_license_key={$subscription['license_key']}&utm_campaign=admin&utm_source=licenses&utm_medium=expired", |
632 | 632 | Give()->notices->get_dismiss_link(array( |
633 | - 'title' => __( 'Click here if already renewed', 'give' ), |
|
633 | + 'title' => __('Click here if already renewed', 'give'), |
|
634 | 634 | 'dismissible_type' => 'user', |
635 | 635 | 'dismiss_interval' => 'permanent', |
636 | 636 | )) |
637 | 637 | ), |
638 | 638 | 'dismissible_type' => 'user', |
639 | 639 | 'dismiss_interval' => 'shortly', |
640 | - ) ); |
|
640 | + )); |
|
641 | 641 | } else { |
642 | - Give()->notices->register_notice( array( |
|
642 | + Give()->notices->register_notice(array( |
|
643 | 643 | 'id' => "give-expires-subscription-{$subscription['id']}", |
644 | 644 | 'type' => 'error', |
645 | 645 | 'description' => sprintf( |
646 | - __( 'Your Give add-on license will expire in %1$s for payment <a href="%2$s" target="_blank">#%3$d</a>. <a href="%4$s" target="_blank">Click to renew an existing license</a> or %5$s.', 'give' ), |
|
647 | - human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscription['expires'] ) ), |
|
648 | - urldecode( $subscription['invoice_url'] ), |
|
646 | + __('Your Give add-on license will expire in %1$s for payment <a href="%2$s" target="_blank">#%3$d</a>. <a href="%4$s" target="_blank">Click to renew an existing license</a> or %5$s.', 'give'), |
|
647 | + human_time_diff(current_time('timestamp', 1), strtotime($subscription['expires'])), |
|
648 | + urldecode($subscription['invoice_url']), |
|
649 | 649 | $subscription['payment_id'], |
650 | 650 | "{$this->checkout_url}?edd_license_key={$subscription['license_key']}&utm_campaign=admin&utm_source=licenses&utm_medium=expired", |
651 | 651 | Give()->notices->get_dismiss_link(array( |
652 | - 'title' => __( 'Click here if already renewed', 'give' ), |
|
652 | + 'title' => __('Click here if already renewed', 'give'), |
|
653 | 653 | 'dismissible_type' => 'user', |
654 | 654 | 'dismiss_interval' => 'permanent', |
655 | 655 | )) |
656 | 656 | ), |
657 | 657 | 'dismissible_type' => 'user', |
658 | 658 | 'dismiss_interval' => 'shortly', |
659 | - ) ); |
|
659 | + )); |
|
660 | 660 | } |
661 | 661 | |
662 | 662 | // Stop validation for these license keys. |
663 | - $addon_license_key_in_subscriptions = array_merge( $addon_license_key_in_subscriptions, $subscription['licenses'] ); |
|
663 | + $addon_license_key_in_subscriptions = array_merge($addon_license_key_in_subscriptions, $subscription['licenses']); |
|
664 | 664 | }// End foreach(). |
665 | 665 | $showed_subscriptions_message = true; |
666 | 666 | }// End if(). |
667 | 667 | |
668 | 668 | // Show Non Subscription Give Add-on messages. |
669 | 669 | if ( |
670 | - ! in_array( $this->license, $addon_license_key_in_subscriptions ) |
|
671 | - && ! empty( $this->license ) |
|
672 | - && empty( $showed_invalid_message ) |
|
670 | + ! in_array($this->license, $addon_license_key_in_subscriptions) |
|
671 | + && ! empty($this->license) |
|
672 | + && empty($showed_invalid_message) |
|
673 | 673 | && ! $this->is_valid_license() |
674 | 674 | ) { |
675 | 675 | |
676 | - Give()->notices->register_notice( array( |
|
676 | + Give()->notices->register_notice(array( |
|
677 | 677 | 'id' => 'give-invalid-license', |
678 | 678 | 'type' => 'error', |
679 | 679 | 'description' => sprintf( |
680 | - __( 'You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give' ), |
|
681 | - admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' ) |
|
680 | + __('You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give'), |
|
681 | + admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses') |
|
682 | 682 | ), |
683 | 683 | 'dismissible_type' => 'user', |
684 | 684 | 'dismiss_interval' => 'shortly', |
685 | - ) ); |
|
685 | + )); |
|
686 | 686 | |
687 | 687 | $showed_invalid_message = true; |
688 | 688 | |
@@ -699,10 +699,10 @@ discard block |
||
699 | 699 | * |
700 | 700 | * @return bool |
701 | 701 | */ |
702 | - public function is_valid_license( $licence_data = null ) { |
|
703 | - $license_data = empty( $licence_data ) ? $this->license_data : $licence_data; |
|
702 | + public function is_valid_license($licence_data = null) { |
|
703 | + $license_data = empty($licence_data) ? $this->license_data : $licence_data; |
|
704 | 704 | |
705 | - if ( apply_filters( 'give_is_valid_license', ( $this->is_license( $license_data ) && 'valid' === $license_data->license ) ) ) { |
|
705 | + if (apply_filters('give_is_valid_license', ($this->is_license($license_data) && 'valid' === $license_data->license))) { |
|
706 | 706 | return true; |
707 | 707 | } |
708 | 708 | |
@@ -720,10 +720,10 @@ discard block |
||
720 | 720 | * |
721 | 721 | * @return bool |
722 | 722 | */ |
723 | - public function is_license( $licence_data = null ){ |
|
724 | - $license_data = empty( $licence_data ) ? $this->license_data : $licence_data; |
|
723 | + public function is_license($licence_data = null) { |
|
724 | + $license_data = empty($licence_data) ? $this->license_data : $licence_data; |
|
725 | 725 | |
726 | - if ( apply_filters( 'give_is_license', ( is_object( $license_data ) && ! empty( $license_data ) && property_exists( $license_data, 'license' ) ) ) ) { |
|
726 | + if (apply_filters('give_is_license', (is_object($license_data) && ! empty($license_data) && property_exists($license_data, 'license')))) { |
|
727 | 727 | return true; |
728 | 728 | } |
729 | 729 | |
@@ -740,10 +740,10 @@ discard block |
||
740 | 740 | * |
741 | 741 | * @return bool |
742 | 742 | */ |
743 | - public function is_subscription( $subscription_data = null ){ |
|
744 | - $subscription_data = empty( $subscription_data ) ? $this->license_data : $subscription_data; |
|
743 | + public function is_subscription($subscription_data = null) { |
|
744 | + $subscription_data = empty($subscription_data) ? $this->license_data : $subscription_data; |
|
745 | 745 | |
746 | - if ( apply_filters( 'give_is_subscription', ( is_object( $subscription_data ) && ! empty( $subscription_data ) && property_exists( $subscription_data, 'license_key' ) ) ) ) { |
|
746 | + if (apply_filters('give_is_subscription', (is_object($subscription_data) && ! empty($subscription_data) && property_exists($subscription_data, 'license_key')))) { |
|
747 | 747 | return true; |
748 | 748 | } |
749 | 749 | |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | * @return bool |
760 | 760 | */ |
761 | 761 | private function __is_third_party_addon() { |
762 | - return ( false === strpos( $this->api_url, 'givewp.com/' ) ); |
|
762 | + return (false === strpos($this->api_url, 'givewp.com/')); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | /** |
@@ -774,25 +774,25 @@ discard block |
||
774 | 774 | * @return bool |
775 | 775 | */ |
776 | 776 | private function __remove_license_key_from_subscriptions() { |
777 | - $subscriptions = get_option( 'give_subscriptions', array() ); |
|
777 | + $subscriptions = get_option('give_subscriptions', array()); |
|
778 | 778 | |
779 | 779 | // Bailout. |
780 | - if ( empty( $this->license ) ) { |
|
780 | + if (empty($this->license)) { |
|
781 | 781 | return false; |
782 | 782 | } |
783 | 783 | |
784 | - if ( ! empty( $subscriptions ) ) { |
|
785 | - foreach ( $subscriptions as $subscription_id => $subscription ) { |
|
786 | - $license_index = array_search( $this->license, $subscription['licenses'] ); |
|
787 | - if ( false !== $license_index ) { |
|
784 | + if ( ! empty($subscriptions)) { |
|
785 | + foreach ($subscriptions as $subscription_id => $subscription) { |
|
786 | + $license_index = array_search($this->license, $subscription['licenses']); |
|
787 | + if (false !== $license_index) { |
|
788 | 788 | // Remove license key. |
789 | - unset( $subscriptions[ $subscription_id ]['licenses'][ $license_index ] ); |
|
789 | + unset($subscriptions[$subscription_id]['licenses'][$license_index]); |
|
790 | 790 | |
791 | 791 | // Rearrange license keys. |
792 | - $subscriptions[ $subscription_id ]['licenses'] = array_values( $subscriptions[ $subscription_id ]['licenses'] ); |
|
792 | + $subscriptions[$subscription_id]['licenses'] = array_values($subscriptions[$subscription_id]['licenses']); |
|
793 | 793 | |
794 | 794 | // Update subscription information. |
795 | - update_option( 'give_subscriptions', $subscriptions ); |
|
795 | + update_option('give_subscriptions', $subscriptions); |
|
796 | 796 | break; |
797 | 797 | } |
798 | 798 | } |
@@ -806,17 +806,17 @@ discard block |
||
806 | 806 | * |
807 | 807 | * @return bool |
808 | 808 | */ |
809 | - public function plugin_page_notices( $plugin_file, $plugin_data, $status ) { |
|
809 | + public function plugin_page_notices($plugin_file, $plugin_data, $status) { |
|
810 | 810 | // Bailout. |
811 | - if ( $this->is_valid_license() ) { |
|
811 | + if ($this->is_valid_license()) { |
|
812 | 812 | return false; |
813 | 813 | } |
814 | 814 | |
815 | 815 | $update_notice_wrap = '<tr class="give-addon-notice-tr active"><td colspan="3" class="colspanchange"><div class="notice inline notice-warning notice-alt give-invalid-license"><p><span class="dashicons dashicons-info"></span> %s</p></div></td></tr>'; |
816 | 816 | $message = $this->license_state_message(); |
817 | 817 | |
818 | - if ( ! empty( $message['message'] ) ) { |
|
819 | - echo sprintf( $update_notice_wrap, $message['message'] ); |
|
818 | + if ( ! empty($message['message'])) { |
|
819 | + echo sprintf($update_notice_wrap, $message['message']); |
|
820 | 820 | } |
821 | 821 | } |
822 | 822 | |
@@ -831,11 +831,11 @@ discard block |
||
831 | 831 | public function license_state_message() { |
832 | 832 | $message_data = array(); |
833 | 833 | |
834 | - if ( ! $this->is_valid_license() ) { |
|
834 | + if ( ! $this->is_valid_license()) { |
|
835 | 835 | |
836 | 836 | $message_data['message'] = sprintf( |
837 | 837 | 'Please <a href="%1$s">activate your license</a> to receive updates and support for the %2$s add-on.', |
838 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' ) ), |
|
838 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses')), |
|
839 | 839 | $this->item_name |
840 | 840 | ); |
841 | 841 | } |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | // Bailout. |
855 | 855 | if ( |
856 | 856 | ! Give_Admin_Settings::verify_nonce() || |
857 | - ! current_user_can( 'manage_give_settings' ) || |
|
857 | + ! current_user_can('manage_give_settings') || |
|
858 | 858 | 'licenses' !== give_get_current_setting_tab() |
859 | 859 | ) { |
860 | 860 | return false; |
@@ -862,10 +862,10 @@ discard block |
||
862 | 862 | |
863 | 863 | // Security check. |
864 | 864 | if ( |
865 | - isset( $_POST[ $this->item_shortname . '_license_key-nonce'] ) && |
|
866 | - ! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce' ], $this->item_shortname . '_license_key-nonce' ) |
|
865 | + isset($_POST[$this->item_shortname.'_license_key-nonce']) && |
|
866 | + ! wp_verify_nonce($_REQUEST[$this->item_shortname.'_license_key-nonce'], $this->item_shortname.'_license_key-nonce') |
|
867 | 867 | ) { |
868 | - wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
868 | + wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
869 | 869 | } |
870 | 870 | |
871 | 871 | return true; |
@@ -883,8 +883,8 @@ discard block |
||
883 | 883 | * |
884 | 884 | * @return mixed |
885 | 885 | */ |
886 | - public function get_license_info( $edd_action = '', $response_in_array = false ) { |
|
887 | - if( empty( $edd_action ) ) { |
|
886 | + public function get_license_info($edd_action = '', $response_in_array = false) { |
|
887 | + if (empty($edd_action)) { |
|
888 | 888 | return false; |
889 | 889 | } |
890 | 890 | |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | $api_params = array( |
893 | 893 | 'edd_action' => $edd_action, // never change from "edd_" to "give_"! |
894 | 894 | 'license' => $this->license, |
895 | - 'item_name' => urlencode( $this->item_name ), |
|
895 | + 'item_name' => urlencode($this->item_name), |
|
896 | 896 | 'url' => home_url(), |
897 | 897 | ); |
898 | 898 | |
@@ -907,11 +907,11 @@ discard block |
||
907 | 907 | ); |
908 | 908 | |
909 | 909 | // Make sure there are no errors. |
910 | - if ( is_wp_error( $response ) ) { |
|
910 | + if (is_wp_error($response)) { |
|
911 | 911 | return false; |
912 | 912 | } |
913 | 913 | |
914 | - return json_decode( wp_remote_retrieve_body( $response ), $response_in_array ); |
|
914 | + return json_decode(wp_remote_retrieve_body($response), $response_in_array); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | |
@@ -926,8 +926,8 @@ discard block |
||
926 | 926 | $this->__remove_license_key_from_subscriptions(); |
927 | 927 | |
928 | 928 | // Remove license from database. |
929 | - delete_option( "{$this->item_shortname}_license_active" ); |
|
930 | - give_delete_option( "{$this->item_shortname}_license_key" ); |
|
929 | + delete_option("{$this->item_shortname}_license_active"); |
|
930 | + give_delete_option("{$this->item_shortname}_license_key"); |
|
931 | 931 | |
932 | 932 | // Unset license param. |
933 | 933 | $this->license = ''; |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Admin_Settings' ) ) : |
|
16 | +if ( ! class_exists('Give_Admin_Settings')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Admin_Settings Class. |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param array $settings Array of settings class object. |
74 | 74 | */ |
75 | - self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() ); |
|
75 | + self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array()); |
|
76 | 76 | |
77 | 77 | return self::$settings; |
78 | 78 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return bool |
87 | 87 | */ |
88 | 88 | public static function verify_nonce() { |
89 | - if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) { |
|
89 | + if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) { |
|
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | |
@@ -102,17 +102,17 @@ discard block |
||
102 | 102 | public static function save() { |
103 | 103 | $current_tab = give_get_current_setting_tab(); |
104 | 104 | |
105 | - if( ! self::verify_nonce() ) { |
|
106 | - echo '<div class="notice error"><p>' . __( 'Action failed. Please refresh the page and retry.', 'give' ) . '</p></div>'; |
|
105 | + if ( ! self::verify_nonce()) { |
|
106 | + echo '<div class="notice error"><p>'.__('Action failed. Please refresh the page and retry.', 'give').'</p></div>'; |
|
107 | 107 | die(); |
108 | 108 | } |
109 | 109 | |
110 | 110 | // Show error message if Akismet not configured and Admin try to save 'enabled' option. |
111 | - if ( isset( $_POST['akismet_spam_protection'] ) |
|
112 | - && give_is_setting_enabled( $_POST['akismet_spam_protection'] ) |
|
111 | + if (isset($_POST['akismet_spam_protection']) |
|
112 | + && give_is_setting_enabled($_POST['akismet_spam_protection']) |
|
113 | 113 | && ! give_check_akismet_key() |
114 | 114 | ) { |
115 | - self::add_error( 'give-akismet-protection', __( 'Please properly configure Akismet to enable SPAM protection.', 'give' ) ); |
|
115 | + self::add_error('give-akismet-protection', __('Please properly configure Akismet to enable SPAM protection.', 'give')); |
|
116 | 116 | |
117 | 117 | return; |
118 | 118 | } |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @since 1.8 |
128 | 128 | */ |
129 | - do_action( self::$setting_filter_prefix . '_save_' . $current_tab ); |
|
129 | + do_action(self::$setting_filter_prefix.'_save_'.$current_tab); |
|
130 | 130 | |
131 | - self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) ); |
|
131 | + self::add_message('give-setting-updated', __('Your settings have been saved.', 'give')); |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Trigger Action. |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @since 1.8 |
141 | 141 | */ |
142 | - do_action( self::$setting_filter_prefix . '_saved' ); |
|
142 | + do_action(self::$setting_filter_prefix.'_saved'); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return void |
154 | 154 | */ |
155 | - public static function add_message( $code, $message ) { |
|
156 | - self::$messages[ $code ] = $message; |
|
155 | + public static function add_message($code, $message) { |
|
156 | + self::$messages[$code] = $message; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return void |
168 | 168 | */ |
169 | - public static function add_error( $code, $message ) { |
|
170 | - self::$errors[ $code ] = $message; |
|
169 | + public static function add_error($code, $message) { |
|
170 | + self::$errors[$code] = $message; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -180,18 +180,18 @@ discard block |
||
180 | 180 | $notice_html = ''; |
181 | 181 | $classes = 'give-notice settings-error notice is-dismissible'; |
182 | 182 | |
183 | - self::$errors = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors ); |
|
184 | - self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages ); |
|
183 | + self::$errors = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors); |
|
184 | + self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages); |
|
185 | 185 | |
186 | - if ( 0 < count( self::$errors ) ) { |
|
187 | - foreach ( self::$errors as $code => $message ) { |
|
188 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>'; |
|
186 | + if (0 < count(self::$errors)) { |
|
187 | + foreach (self::$errors as $code => $message) { |
|
188 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>'; |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | - if ( 0 < count( self::$messages ) ) { |
|
193 | - foreach ( self::$messages as $code => $message ) { |
|
194 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>'; |
|
192 | + if (0 < count(self::$messages)) { |
|
193 | + foreach (self::$messages as $code => $message) { |
|
194 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>'; |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | self::$setting_filter_prefix = give_get_current_setting_page(); |
212 | 212 | |
213 | 213 | // Bailout: Exit if setting page is not defined. |
214 | - if ( empty( self::$setting_filter_prefix ) ) { |
|
214 | + if (empty(self::$setting_filter_prefix)) { |
|
215 | 215 | return false; |
216 | 216 | } |
217 | 217 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @since 1.8 |
226 | 226 | */ |
227 | - do_action( self::$setting_filter_prefix . '_start' ); |
|
227 | + do_action(self::$setting_filter_prefix.'_start'); |
|
228 | 228 | |
229 | 229 | $current_tab = give_get_current_setting_tab(); |
230 | 230 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | self::get_settings_pages(); |
233 | 233 | |
234 | 234 | // Save settings if data has been posted. |
235 | - if ( ! empty( $_POST ) ) { |
|
235 | + if ( ! empty($_POST)) { |
|
236 | 236 | self::save(); |
237 | 237 | } |
238 | 238 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * |
246 | 246 | * @since 1.8 |
247 | 247 | */ |
248 | - $tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() ); |
|
248 | + $tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array()); |
|
249 | 249 | |
250 | 250 | include 'views/html-admin-settings.php'; |
251 | 251 | |
@@ -263,25 +263,25 @@ discard block |
||
263 | 263 | * |
264 | 264 | * @return string|bool |
265 | 265 | */ |
266 | - public static function get_option( $option_name = '', $field_id = '', $default = false ) { |
|
266 | + public static function get_option($option_name = '', $field_id = '', $default = false) { |
|
267 | 267 | // Bailout. |
268 | - if ( empty( $option_name ) && empty( $field_id ) ) { |
|
268 | + if (empty($option_name) && empty($field_id)) { |
|
269 | 269 | return false; |
270 | 270 | } |
271 | 271 | |
272 | - if ( ! empty( $field_id ) && ! empty( $option_name ) ) { |
|
272 | + if ( ! empty($field_id) && ! empty($option_name)) { |
|
273 | 273 | // Get field value if any. |
274 | - $option_value = get_option( $option_name ); |
|
274 | + $option_value = get_option($option_name); |
|
275 | 275 | |
276 | - $option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) ) |
|
277 | - ? $option_value[ $field_id ] |
|
276 | + $option_value = (is_array($option_value) && array_key_exists($field_id, $option_value)) |
|
277 | + ? $option_value[$field_id] |
|
278 | 278 | : $default; |
279 | 279 | } else { |
280 | 280 | // If option name is empty but not field name then this means, setting is direct store to option table under there field name. |
281 | 281 | $option_name = ! $option_name ? $field_id : $option_name; |
282 | 282 | |
283 | 283 | // Get option value if any. |
284 | - $option_value = get_option( $option_name, $default ); |
|
284 | + $option_value = get_option($option_name, $default); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | return $option_value; |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * |
300 | 300 | * @return void |
301 | 301 | */ |
302 | - public static function output_fields( $options, $option_name = '' ) { |
|
302 | + public static function output_fields($options, $option_name = '') { |
|
303 | 303 | $current_tab = give_get_current_setting_tab(); |
304 | 304 | |
305 | 305 | // Field Default values. |
@@ -312,52 +312,52 @@ discard block |
||
312 | 312 | 'table_html' => true, |
313 | 313 | ); |
314 | 314 | |
315 | - foreach ( $options as $value ) { |
|
316 | - if ( ! isset( $value['type'] ) ) { |
|
315 | + foreach ($options as $value) { |
|
316 | + if ( ! isset($value['type'])) { |
|
317 | 317 | continue; |
318 | 318 | } |
319 | 319 | |
320 | 320 | // Set title. |
321 | - $defaults['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
321 | + $defaults['title'] = isset($value['name']) ? $value['name'] : ''; |
|
322 | 322 | |
323 | 323 | // Set default setting. |
324 | - $value = wp_parse_args( $value, $defaults ); |
|
324 | + $value = wp_parse_args($value, $defaults); |
|
325 | 325 | |
326 | 326 | // Colorpicker field. |
327 | - $value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] ); |
|
328 | - $value['type'] = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] ); |
|
327 | + $value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']); |
|
328 | + $value['type'] = ('colorpicker' === $value['type'] ? 'text' : $value['type']); |
|
329 | 329 | |
330 | 330 | |
331 | 331 | // Custom attribute handling. |
332 | 332 | $custom_attributes = array(); |
333 | 333 | |
334 | - if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) { |
|
335 | - foreach ( $value['attributes'] as $attribute => $attribute_value ) { |
|
336 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
334 | + if ( ! empty($value['attributes']) && is_array($value['attributes'])) { |
|
335 | + foreach ($value['attributes'] as $attribute => $attribute_value) { |
|
336 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | |
340 | 340 | // Description handling. |
341 | - $description = self::get_field_description( $value ); |
|
341 | + $description = self::get_field_description($value); |
|
342 | 342 | |
343 | 343 | // Switch based on type. |
344 | - switch ( $value['type'] ) { |
|
344 | + switch ($value['type']) { |
|
345 | 345 | |
346 | 346 | // Section Titles |
347 | 347 | case 'title': |
348 | - if ( ! empty( $value['title'] ) ) { |
|
349 | - echo '<div class="give-setting-tab-header give-setting-tab-header-' . $current_tab . '"><h2>' . self::get_field_title( $value ) . '</h2><hr></div>'; |
|
348 | + if ( ! empty($value['title'])) { |
|
349 | + echo '<div class="give-setting-tab-header give-setting-tab-header-'.$current_tab.'"><h2>'.self::get_field_title($value).'</h2><hr></div>'; |
|
350 | 350 | } |
351 | 351 | |
352 | - if ( ! empty( $value['desc'] ) ) { |
|
353 | - echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); |
|
352 | + if ( ! empty($value['desc'])) { |
|
353 | + echo wpautop(wptexturize(wp_kses_post($value['desc']))); |
|
354 | 354 | } |
355 | 355 | |
356 | - if ( $value['table_html'] ) { |
|
357 | - echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n"; |
|
356 | + if ($value['table_html']) { |
|
357 | + echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n"; |
|
358 | 358 | } |
359 | 359 | |
360 | - if ( ! empty( $value['id'] ) ) { |
|
360 | + if ( ! empty($value['id'])) { |
|
361 | 361 | |
362 | 362 | /** |
363 | 363 | * Trigger Action. |
@@ -366,14 +366,14 @@ discard block |
||
366 | 366 | * |
367 | 367 | * @since 1.8 |
368 | 368 | */ |
369 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) ); |
|
369 | + do_action('give_settings_'.sanitize_title($value['id'])); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | break; |
373 | 373 | |
374 | 374 | // Section Ends. |
375 | 375 | case 'sectionend': |
376 | - if ( ! empty( $value['id'] ) ) { |
|
376 | + if ( ! empty($value['id'])) { |
|
377 | 377 | |
378 | 378 | /** |
379 | 379 | * Trigger Action. |
@@ -382,14 +382,14 @@ discard block |
||
382 | 382 | * |
383 | 383 | * @since 1.8 |
384 | 384 | */ |
385 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
385 | + do_action('give_settings_'.sanitize_title($value['id']).'_end'); |
|
386 | 386 | } |
387 | 387 | |
388 | - if ( $value['table_html'] ) { |
|
388 | + if ($value['table_html']) { |
|
389 | 389 | echo '</table>'; |
390 | 390 | } |
391 | 391 | |
392 | - if ( ! empty( $value['id'] ) ) { |
|
392 | + if ( ! empty($value['id'])) { |
|
393 | 393 | |
394 | 394 | /** |
395 | 395 | * Trigger Action. |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | * |
399 | 399 | * @since 1.8 |
400 | 400 | */ |
401 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
401 | + do_action('give_settings_'.sanitize_title($value['id']).'_after'); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | break; |
@@ -406,27 +406,27 @@ discard block |
||
406 | 406 | // Standard text inputs and subtypes like 'number'. |
407 | 407 | case 'colorpicker': |
408 | 408 | case 'hidden' : |
409 | - $value['wrapper_class'] = empty( $value['wrapper_class'] ) ? 'give-hidden' : trim( $value['wrapper_class'] ) . ' give-hidden'; |
|
409 | + $value['wrapper_class'] = empty($value['wrapper_class']) ? 'give-hidden' : trim($value['wrapper_class']).' give-hidden'; |
|
410 | 410 | case 'text': |
411 | 411 | case 'email': |
412 | 412 | case 'number': |
413 | 413 | case 'password' : |
414 | 414 | $type = $value['type']; |
415 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
415 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
416 | 416 | ?> |
417 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
417 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
418 | 418 | <th scope="row" class="titledesc"> |
419 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
419 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
420 | 420 | </th> |
421 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
421 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
422 | 422 | <input |
423 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
424 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
425 | - type="<?php echo esc_attr( $type ); ?>" |
|
426 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
427 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
428 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
429 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
423 | + name="<?php echo esc_attr($value['id']); ?>" |
|
424 | + id="<?php echo esc_attr($value['id']); ?>" |
|
425 | + type="<?php echo esc_attr($type); ?>" |
|
426 | + style="<?php echo esc_attr($value['css']); ?>" |
|
427 | + value="<?php echo esc_attr($option_value); ?>" |
|
428 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
429 | + <?php echo implode(' ', $custom_attributes); ?> |
|
430 | 430 | /> <?php echo $description; ?> |
431 | 431 | </td> |
432 | 432 | </tr> |
@@ -436,23 +436,23 @@ discard block |
||
436 | 436 | // Textarea. |
437 | 437 | case 'textarea': |
438 | 438 | |
439 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
439 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
440 | 440 | |
441 | 441 | ?> |
442 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
442 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
443 | 443 | <th scope="row" class="titledesc"> |
444 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
444 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
445 | 445 | </th> |
446 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
446 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
447 | 447 | <textarea |
448 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
449 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
450 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
451 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
448 | + name="<?php echo esc_attr($value['id']); ?>" |
|
449 | + id="<?php echo esc_attr($value['id']); ?>" |
|
450 | + style="<?php echo esc_attr($value['css']); ?>" |
|
451 | + class="<?php echo esc_attr($value['class']); ?>" |
|
452 | 452 | rows="10" |
453 | 453 | cols="60" |
454 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
455 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
454 | + <?php echo implode(' ', $custom_attributes); ?> |
|
455 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
456 | 456 | <?php echo $description; ?> |
457 | 457 | </td> |
458 | 458 | </tr><?php |
@@ -462,35 +462,35 @@ discard block |
||
462 | 462 | case 'select' : |
463 | 463 | case 'multiselect' : |
464 | 464 | |
465 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
465 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
466 | 466 | |
467 | 467 | ?> |
468 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
468 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
469 | 469 | <th scope="row" class="titledesc"> |
470 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
470 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
471 | 471 | </th> |
472 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
472 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
473 | 473 | <select |
474 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) { |
|
474 | + name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') { |
|
475 | 475 | echo '[]'; |
476 | 476 | } ?>" |
477 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
478 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
479 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
480 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
481 | - <?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?> |
|
477 | + id="<?php echo esc_attr($value['id']); ?>" |
|
478 | + style="<?php echo esc_attr($value['css']); ?>" |
|
479 | + class="<?php echo esc_attr($value['class']); ?>" |
|
480 | + <?php echo implode(' ', $custom_attributes); ?> |
|
481 | + <?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?> |
|
482 | 482 | > |
483 | 483 | |
484 | 484 | <?php |
485 | - if ( ! empty( $value['options'] ) ) { |
|
486 | - foreach ( $value['options'] as $key => $val ) { |
|
485 | + if ( ! empty($value['options'])) { |
|
486 | + foreach ($value['options'] as $key => $val) { |
|
487 | 487 | ?> |
488 | - <option value="<?php echo esc_attr( $key ); ?>" <?php |
|
488 | + <option value="<?php echo esc_attr($key); ?>" <?php |
|
489 | 489 | |
490 | - if ( is_array( $option_value ) ) { |
|
491 | - selected( in_array( $key, $option_value ), true ); |
|
490 | + if (is_array($option_value)) { |
|
491 | + selected(in_array($key, $option_value), true); |
|
492 | 492 | } else { |
493 | - selected( $option_value, $key ); |
|
493 | + selected($option_value, $key); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | ?>><?php echo $val ?></option> |
@@ -506,28 +506,28 @@ discard block |
||
506 | 506 | |
507 | 507 | // Radio inputs. |
508 | 508 | case 'radio_inline' : |
509 | - $value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline'; |
|
509 | + $value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline'; |
|
510 | 510 | case 'radio' : |
511 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
511 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
512 | 512 | ?> |
513 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
513 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
514 | 514 | <th scope="row" class="titledesc"> |
515 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
515 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
516 | 516 | </th> |
517 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
517 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
518 | 518 | <fieldset> |
519 | 519 | <ul> |
520 | 520 | <?php |
521 | - foreach ( $value['options'] as $key => $val ) { |
|
521 | + foreach ($value['options'] as $key => $val) { |
|
522 | 522 | ?> |
523 | 523 | <li> |
524 | 524 | <label><input |
525 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
525 | + name="<?php echo esc_attr($value['id']); ?>" |
|
526 | 526 | value="<?php echo $key; ?>" |
527 | 527 | type="radio" |
528 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
529 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
530 | - <?php checked( $key, $option_value ); ?> |
|
528 | + style="<?php echo esc_attr($value['css']); ?>" |
|
529 | + <?php echo implode(' ', $custom_attributes); ?> |
|
530 | + <?php checked($key, $option_value); ?> |
|
531 | 531 | /> <?php echo $val ?></label> |
532 | 532 | </li> |
533 | 533 | <?php |
@@ -541,21 +541,21 @@ discard block |
||
541 | 541 | |
542 | 542 | // Checkbox input. |
543 | 543 | case 'checkbox' : |
544 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
544 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
545 | 545 | ?> |
546 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
546 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
547 | 547 | <th scope="row" class="titledesc"> |
548 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
548 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
549 | 549 | </th> |
550 | 550 | <td class="give-forminp"> |
551 | 551 | <input |
552 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
553 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
552 | + name="<?php echo esc_attr($value['id']); ?>" |
|
553 | + id="<?php echo esc_attr($value['id']); ?>" |
|
554 | 554 | type="checkbox" |
555 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
555 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
556 | 556 | value="1" |
557 | - <?php checked( $option_value, 'on' ); ?> |
|
558 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
557 | + <?php checked($option_value, 'on'); ?> |
|
558 | + <?php echo implode(' ', $custom_attributes); ?> |
|
559 | 559 | /> |
560 | 560 | <?php echo $description; ?> |
561 | 561 | </td> |
@@ -565,28 +565,28 @@ discard block |
||
565 | 565 | |
566 | 566 | // Multi Checkbox input. |
567 | 567 | case 'multicheck' : |
568 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
569 | - $option_value = is_array( $option_value ) ? $option_value : array(); |
|
568 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
569 | + $option_value = is_array($option_value) ? $option_value : array(); |
|
570 | 570 | ?> |
571 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
571 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
572 | 572 | <th scope="row" class="titledesc"> |
573 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
573 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
574 | 574 | </th> |
575 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
575 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
576 | 576 | <fieldset> |
577 | 577 | <ul> |
578 | 578 | <?php |
579 | - foreach ( $value['options'] as $key => $val ) { |
|
579 | + foreach ($value['options'] as $key => $val) { |
|
580 | 580 | ?> |
581 | 581 | <li> |
582 | 582 | <label> |
583 | 583 | <input |
584 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
584 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
585 | 585 | value="<?php echo $key; ?>" |
586 | 586 | type="checkbox" |
587 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
588 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
589 | - <?php if ( in_array( $key, $option_value ) ) { |
|
587 | + style="<?php echo esc_attr($value['css']); ?>" |
|
588 | + <?php echo implode(' ', $custom_attributes); ?> |
|
589 | + <?php if (in_array($key, $option_value)) { |
|
590 | 590 | echo 'checked="checked"'; |
591 | 591 | } ?> |
592 | 592 | /> <?php echo $val ?> |
@@ -605,35 +605,35 @@ discard block |
||
605 | 605 | // File input field. |
606 | 606 | case 'file' : |
607 | 607 | case 'media' : |
608 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
609 | - $button_label = esc_html__( sprintf( 'Add or Upload %s', ( 'file' === $value['type'] ? 'File' : 'Image' ) ), 'give' ); |
|
610 | - $fvalue = empty( $value['fvalue'] ) ? 'url' : $value['fvalue']; |
|
611 | - |
|
612 | - $allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' ); |
|
613 | - $preview_image_src = $option_value ? ( 'id' === $fvalue ? wp_get_attachment_url( $option_value ) : $option_value ) : '#'; |
|
614 | - $preview_image_extension = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : ''; |
|
615 | - $is_show_preview = in_array( $preview_image_extension, $allow_media_preview_tags ); |
|
608 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
609 | + $button_label = esc_html__(sprintf('Add or Upload %s', ('file' === $value['type'] ? 'File' : 'Image')), 'give'); |
|
610 | + $fvalue = empty($value['fvalue']) ? 'url' : $value['fvalue']; |
|
611 | + |
|
612 | + $allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico'); |
|
613 | + $preview_image_src = $option_value ? ('id' === $fvalue ? wp_get_attachment_url($option_value) : $option_value) : '#'; |
|
614 | + $preview_image_extension = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : ''; |
|
615 | + $is_show_preview = in_array($preview_image_extension, $allow_media_preview_tags); |
|
616 | 616 | ?> |
617 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
617 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
618 | 618 | <th scope="row" class="titledesc"> |
619 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
619 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
620 | 620 | </th> |
621 | 621 | <td class="give-forminp"> |
622 | 622 | <div class="give-field-wrap"> |
623 | 623 | <label for="<?php echo $value['id'] ?>"> |
624 | 624 | <input |
625 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
626 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
625 | + name="<?php echo esc_attr($value['id']); ?>" |
|
626 | + id="<?php echo esc_attr($value['id']); ?>" |
|
627 | 627 | type="text" |
628 | - class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>" |
|
628 | + class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>" |
|
629 | 629 | value="<?php echo $option_value; ?>" |
630 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
631 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
630 | + style="<?php echo esc_attr($value['css']); ?>" |
|
631 | + <?php echo implode(' ', $custom_attributes); ?> |
|
632 | 632 | /> <input class="give-upload-button button" type="button" data-fvalue="<?php echo $fvalue; ?>" data-field-type="<?php echo $value['type']; ?>" value="<?php echo $button_label; ?>"> |
633 | 633 | <?php echo $description ?> |
634 | 634 | <div class="give-image-thumb<?php echo ! $option_value || ! $is_show_preview ? ' give-hidden' : ''; ?>"> |
635 | 635 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
636 | - <img src="<?php echo $preview_image_src ; ?>" alt=""> |
|
636 | + <img src="<?php echo $preview_image_src; ?>" alt=""> |
|
637 | 637 | </div> |
638 | 638 | </label> |
639 | 639 | </div> |
@@ -645,17 +645,17 @@ discard block |
||
645 | 645 | // WordPress Editor. |
646 | 646 | case 'wysiwyg' : |
647 | 647 | // Get option value. |
648 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
648 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
649 | 649 | |
650 | 650 | // Get editor settings. |
651 | - $editor_settings = ! empty( $value['options'] ) ? $value['options'] : array(); |
|
651 | + $editor_settings = ! empty($value['options']) ? $value['options'] : array(); |
|
652 | 652 | ?> |
653 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
653 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
654 | 654 | <th scope="row" class="titledesc"> |
655 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
655 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
656 | 656 | </th> |
657 | 657 | <td class="give-forminp"> |
658 | - <?php wp_editor( $option_value, $value['id'], $editor_settings ); ?> |
|
658 | + <?php wp_editor($option_value, $value['id'], $editor_settings); ?> |
|
659 | 659 | <?php echo $description; ?> |
660 | 660 | </td> |
661 | 661 | </tr><?php |
@@ -664,9 +664,9 @@ discard block |
||
664 | 664 | // Custom: System setting field. |
665 | 665 | case 'system_info' : |
666 | 666 | ?> |
667 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
667 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
668 | 668 | <th scope="row" class="titledesc"> |
669 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
669 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
670 | 670 | </th> |
671 | 671 | <td class="give-forminp"> |
672 | 672 | <?php give_system_info_callback(); ?> |
@@ -677,14 +677,14 @@ discard block |
||
677 | 677 | |
678 | 678 | // Custom: Default gateways setting field. |
679 | 679 | case 'default_gateway' : |
680 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
680 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
681 | 681 | ?> |
682 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
682 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
683 | 683 | <th scope="row" class="titledesc"> |
684 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
684 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
685 | 685 | </th> |
686 | 686 | <td class="give-forminp"> |
687 | - <?php give_default_gateway_callback( $value, $option_value ); ?> |
|
687 | + <?php give_default_gateway_callback($value, $option_value); ?> |
|
688 | 688 | <?php echo $description; ?> |
689 | 689 | </td> |
690 | 690 | </tr><?php |
@@ -692,14 +692,14 @@ discard block |
||
692 | 692 | |
693 | 693 | // Custom: Enable gateways setting field. |
694 | 694 | case 'enabled_gateways' : |
695 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
695 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
696 | 696 | ?> |
697 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
697 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
698 | 698 | <th scope="row" class="titledesc"> |
699 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
699 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
700 | 700 | </th> |
701 | 701 | <td class="give-forminp"> |
702 | - <?php give_enabled_gateways_callback( $value, $option_value ); ?> |
|
702 | + <?php give_enabled_gateways_callback($value, $option_value); ?> |
|
703 | 703 | <?php echo $description; ?> |
704 | 704 | </td> |
705 | 705 | </tr><?php |
@@ -708,9 +708,9 @@ discard block |
||
708 | 708 | // Custom: Email preview buttons field. |
709 | 709 | case 'email_preview_buttons' : |
710 | 710 | ?> |
711 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
711 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
712 | 712 | <th scope="row" class="titledesc"> |
713 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
713 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
714 | 714 | </th> |
715 | 715 | <td class="give-forminp"> |
716 | 716 | <?php give_email_preview_buttons_callback(); ?> |
@@ -727,22 +727,22 @@ discard block |
||
727 | 727 | |
728 | 728 | // Custom: Gateway API key. |
729 | 729 | case 'api_key' : |
730 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
731 | - $type = ! empty( $option_value ) ? 'password' : 'text'; |
|
730 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
731 | + $type = ! empty($option_value) ? 'password' : 'text'; |
|
732 | 732 | ?> |
733 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
733 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
734 | 734 | <th scope="row" class="titledesc"> |
735 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
735 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
736 | 736 | </th> |
737 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
737 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
738 | 738 | <input |
739 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
740 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
741 | - type="<?php echo esc_attr( $type ); ?>" |
|
742 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
743 | - value="<?php echo esc_attr( trim( $option_value ) ); ?>" |
|
744 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
745 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
739 | + name="<?php echo esc_attr($value['id']); ?>" |
|
740 | + id="<?php echo esc_attr($value['id']); ?>" |
|
741 | + type="<?php echo esc_attr($type); ?>" |
|
742 | + style="<?php echo esc_attr($value['css']); ?>" |
|
743 | + value="<?php echo esc_attr(trim($option_value)); ?>" |
|
744 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
745 | + <?php echo implode(' ', $custom_attributes); ?> |
|
746 | 746 | /> <?php echo $description; ?> |
747 | 747 | </td> |
748 | 748 | </tr><?php |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | * |
760 | 760 | * @since 1.0 |
761 | 761 | */ |
762 | - do_action( "give_logs_view_{$current_section}" ); |
|
762 | + do_action("give_logs_view_{$current_section}"); |
|
763 | 763 | |
764 | 764 | echo $description; |
765 | 765 | break; |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | // Custom: Data field. |
768 | 768 | case 'data' : |
769 | 769 | |
770 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-data.php'; |
|
770 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-data.php'; |
|
771 | 771 | |
772 | 772 | echo $description; |
773 | 773 | break; |
@@ -775,12 +775,12 @@ discard block |
||
775 | 775 | // Custom: Give Docs Link field type. |
776 | 776 | case 'give_docs_link' : |
777 | 777 | ?> |
778 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
778 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
779 | 779 | <td class="give-docs-link" colspan="2"> |
780 | 780 | <?php |
781 | - echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
|
781 | + echo '<p class="give-docs-link"><a href="'.esc_url($value['url']) |
|
782 | 782 | . '" target="_blank">' |
783 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
783 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $value['title']) |
|
784 | 784 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
785 | 785 | ?> |
786 | 786 | </td> |
@@ -791,8 +791,8 @@ discard block |
||
791 | 791 | // You can add or handle your custom field action. |
792 | 792 | default: |
793 | 793 | // Get option value. |
794 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
795 | - do_action( 'give_admin_field_' . $value['type'], $value, $option_value ); |
|
794 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
795 | + do_action('give_admin_field_'.$value['type'], $value, $option_value); |
|
796 | 796 | break; |
797 | 797 | } |
798 | 798 | } |
@@ -808,15 +808,15 @@ discard block |
||
808 | 808 | * |
809 | 809 | * @return string The HTML description of the field. |
810 | 810 | */ |
811 | - public static function get_field_description( $value ) { |
|
811 | + public static function get_field_description($value) { |
|
812 | 812 | $description = ''; |
813 | 813 | |
814 | 814 | // Support for both 'description' and 'desc' args. |
815 | - $description_key = isset( $value['description'] ) ? 'description' : 'desc'; |
|
816 | - $value = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : ''; |
|
815 | + $description_key = isset($value['description']) ? 'description' : 'desc'; |
|
816 | + $value = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : ''; |
|
817 | 817 | |
818 | - if ( ! empty( $value ) ) { |
|
819 | - $description = '<p class="give-field-description">' . wp_kses_post( $value ) . '</p>'; |
|
818 | + if ( ! empty($value)) { |
|
819 | + $description = '<p class="give-field-description">'.wp_kses_post($value).'</p>'; |
|
820 | 820 | } |
821 | 821 | |
822 | 822 | return $description; |
@@ -833,11 +833,11 @@ discard block |
||
833 | 833 | * |
834 | 834 | * @return array The description and tip as a 2 element array |
835 | 835 | */ |
836 | - public static function get_field_title( $value ) { |
|
837 | - $title = esc_html( $value['title'] ); |
|
836 | + public static function get_field_title($value) { |
|
837 | + $title = esc_html($value['title']); |
|
838 | 838 | |
839 | 839 | // If html tag detected then allow them to print. |
840 | - if ( strip_tags( $title ) ) { |
|
840 | + if (strip_tags($title)) { |
|
841 | 841 | $title = $value['title']; |
842 | 842 | } |
843 | 843 | |
@@ -856,8 +856,8 @@ discard block |
||
856 | 856 | * |
857 | 857 | * @return bool |
858 | 858 | */ |
859 | - public static function save_fields( $options, $option_name = '' ) { |
|
860 | - if ( empty( $_POST ) ) { |
|
859 | + public static function save_fields($options, $option_name = '') { |
|
860 | + if (empty($_POST)) { |
|
861 | 861 | return false; |
862 | 862 | } |
863 | 863 | |
@@ -865,37 +865,37 @@ discard block |
||
865 | 865 | $update_options = array(); |
866 | 866 | |
867 | 867 | // Loop options and get values to save. |
868 | - foreach ( $options as $option ) { |
|
869 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
868 | + foreach ($options as $option) { |
|
869 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
870 | 870 | continue; |
871 | 871 | } |
872 | 872 | |
873 | 873 | // Get posted value. |
874 | - if ( strstr( $option['id'], '[' ) ) { |
|
875 | - parse_str( $option['id'], $option_name_array ); |
|
876 | - $field_option_name = current( array_keys( $option_name_array ) ); |
|
877 | - $setting_name = key( $option_name_array[ $field_option_name ] ); |
|
878 | - $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; |
|
874 | + if (strstr($option['id'], '[')) { |
|
875 | + parse_str($option['id'], $option_name_array); |
|
876 | + $field_option_name = current(array_keys($option_name_array)); |
|
877 | + $setting_name = key($option_name_array[$field_option_name]); |
|
878 | + $raw_value = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null; |
|
879 | 879 | } else { |
880 | 880 | $field_option_name = $option['id']; |
881 | 881 | $setting_name = ''; |
882 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
882 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | // Format the value based on option type. |
886 | - switch ( $option['type'] ) { |
|
886 | + switch ($option['type']) { |
|
887 | 887 | case 'checkbox' : |
888 | - $value = is_null( $raw_value ) ? '' : 'on'; |
|
888 | + $value = is_null($raw_value) ? '' : 'on'; |
|
889 | 889 | break; |
890 | 890 | case 'wysiwyg' : |
891 | 891 | case 'textarea' : |
892 | - $value = wp_kses_post( trim( $raw_value ) ); |
|
892 | + $value = wp_kses_post(trim($raw_value)); |
|
893 | 893 | break; |
894 | 894 | case 'multiselect' : |
895 | - $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); |
|
895 | + $value = array_filter(array_map('give_clean', (array) $raw_value)); |
|
896 | 896 | break; |
897 | 897 | default : |
898 | - $value = give_clean( $raw_value ); |
|
898 | + $value = give_clean($raw_value); |
|
899 | 899 | break; |
900 | 900 | } |
901 | 901 | |
@@ -904,37 +904,37 @@ discard block |
||
904 | 904 | * |
905 | 905 | * @since 1.8 |
906 | 906 | */ |
907 | - $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); |
|
907 | + $value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value); |
|
908 | 908 | |
909 | 909 | /** |
910 | 910 | * Sanitize the value of an option by option name. |
911 | 911 | * |
912 | 912 | * @since 1.8 |
913 | 913 | */ |
914 | - $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); |
|
914 | + $value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value); |
|
915 | 915 | |
916 | - if ( is_null( $value ) ) { |
|
916 | + if (is_null($value)) { |
|
917 | 917 | continue; |
918 | 918 | } |
919 | 919 | |
920 | 920 | // Check if option is an array and handle that differently to single values. |
921 | - if ( $field_option_name && $setting_name ) { |
|
922 | - if ( ! isset( $update_options[ $field_option_name ] ) ) { |
|
923 | - $update_options[ $field_option_name ] = get_option( $field_option_name, array() ); |
|
921 | + if ($field_option_name && $setting_name) { |
|
922 | + if ( ! isset($update_options[$field_option_name])) { |
|
923 | + $update_options[$field_option_name] = get_option($field_option_name, array()); |
|
924 | 924 | } |
925 | - if ( ! is_array( $update_options[ $field_option_name ] ) ) { |
|
926 | - $update_options[ $field_option_name ] = array(); |
|
925 | + if ( ! is_array($update_options[$field_option_name])) { |
|
926 | + $update_options[$field_option_name] = array(); |
|
927 | 927 | } |
928 | - $update_options[ $field_option_name ][ $setting_name ] = $value; |
|
928 | + $update_options[$field_option_name][$setting_name] = $value; |
|
929 | 929 | } else { |
930 | - $update_options[ $field_option_name ] = $value; |
|
930 | + $update_options[$field_option_name] = $value; |
|
931 | 931 | } |
932 | 932 | } |
933 | 933 | |
934 | 934 | // Save all options in our array or there own option name i.e. option id. |
935 | - if ( empty( $option_name ) ) { |
|
936 | - foreach ( $update_options as $name => $value ) { |
|
937 | - update_option( $name, $value ); |
|
935 | + if (empty($option_name)) { |
|
936 | + foreach ($update_options as $name => $value) { |
|
937 | + update_option($name, $value); |
|
938 | 938 | |
939 | 939 | /** |
940 | 940 | * Trigger action. |
@@ -943,13 +943,13 @@ discard block |
||
943 | 943 | * |
944 | 944 | * @since 1.8 |
945 | 945 | */ |
946 | - do_action( "give_save_option_{$name}", $value, $name ); |
|
946 | + do_action("give_save_option_{$name}", $value, $name); |
|
947 | 947 | } |
948 | 948 | } else { |
949 | - $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : array(); |
|
950 | - $update_options = array_merge( $old_options, $update_options ); |
|
949 | + $old_options = ($old_options = get_option($option_name)) ? $old_options : array(); |
|
950 | + $update_options = array_merge($old_options, $update_options); |
|
951 | 951 | |
952 | - update_option( $option_name, $update_options ); |
|
952 | + update_option($option_name, $update_options); |
|
953 | 953 | |
954 | 954 | /** |
955 | 955 | * Trigger action. |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | * |
959 | 959 | * @since 1.8 |
960 | 960 | */ |
961 | - do_action( "give_save_settings_{$option_name}", $update_options, $option_name ); |
|
961 | + do_action("give_save_settings_{$option_name}", $update_options, $option_name); |
|
962 | 962 | } |
963 | 963 | |
964 | 964 | return true; |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | public function __construct() { |
44 | 44 | |
45 | 45 | // Custom CMB2 Settings Fields |
46 | - add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 ); |
|
47 | - add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 ); |
|
48 | - add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 ); |
|
49 | - add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 ); |
|
50 | - add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 ); |
|
51 | - add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 ); |
|
52 | - add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 ); |
|
53 | - add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 ); |
|
46 | + add_action('cmb2_render_give_title', 'give_title_callback', 10, 5); |
|
47 | + add_action('cmb2_render_give_description', 'give_description_callback', 10, 5); |
|
48 | + add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5); |
|
49 | + add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5); |
|
50 | + add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5); |
|
51 | + add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5); |
|
52 | + add_action('cmb2_render_api', 'give_api_callback', 10, 5); |
|
53 | + add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @since 1.0 |
61 | 61 | */ |
62 | 62 | public function init() { |
63 | - register_setting( $this->key, $this->key ); |
|
63 | + register_setting($this->key, $this->key); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return mixed |
76 | 76 | */ |
77 | - public function give_update_cmb_meta_box_url( $url ) { |
|
77 | + public function give_update_cmb_meta_box_url($url) { |
|
78 | 78 | // Path to Give's CMB |
79 | - return GIVE_PLUGIN_URL . '/includes/libraries/cmb2'; |
|
79 | + return GIVE_PLUGIN_URL.'/includes/libraries/cmb2'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -88,27 +88,27 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function give_get_settings_tabs() { |
90 | 90 | |
91 | - $settings = $this->give_settings( null ); |
|
91 | + $settings = $this->give_settings(null); |
|
92 | 92 | |
93 | 93 | $tabs = array(); |
94 | - $tabs['general'] = __( 'General', 'give' ); |
|
95 | - $tabs['gateways'] = __( 'Payment Gateways', 'give' ); |
|
96 | - $tabs['display'] = __( 'Display Options', 'give' ); |
|
97 | - $tabs['emails'] = __( 'Emails', 'give' ); |
|
94 | + $tabs['general'] = __('General', 'give'); |
|
95 | + $tabs['gateways'] = __('Payment Gateways', 'give'); |
|
96 | + $tabs['display'] = __('Display Options', 'give'); |
|
97 | + $tabs['emails'] = __('Emails', 'give'); |
|
98 | 98 | |
99 | - if ( ! empty( $settings['addons']['fields'] ) ) { |
|
100 | - $tabs['addons'] = __( 'Add-ons', 'give' ); |
|
99 | + if ( ! empty($settings['addons']['fields'])) { |
|
100 | + $tabs['addons'] = __('Add-ons', 'give'); |
|
101 | 101 | } |
102 | 102 | |
103 | - if ( ! empty( $settings['licenses']['fields'] ) ) { |
|
104 | - $tabs['licenses'] = __( 'Licenses', 'give' ); |
|
103 | + if ( ! empty($settings['licenses']['fields'])) { |
|
104 | + $tabs['licenses'] = __('Licenses', 'give'); |
|
105 | 105 | } |
106 | 106 | |
107 | - $tabs['advanced'] = __( 'Advanced', 'give' ); |
|
108 | - $tabs['api'] = __( 'API', 'give' ); |
|
109 | - $tabs['system_info'] = __( 'System Info', 'give' ); |
|
107 | + $tabs['advanced'] = __('Advanced', 'give'); |
|
108 | + $tabs['api'] = __('API', 'give'); |
|
109 | + $tabs['system_info'] = __('System Info', 'give'); |
|
110 | 110 | |
111 | - return apply_filters( 'give_settings_tabs', $tabs ); |
|
111 | + return apply_filters('give_settings_tabs', $tabs); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function admin_page_display() { |
121 | 121 | |
122 | - $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general'; |
|
122 | + $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general'; |
|
123 | 123 | |
124 | 124 | ?> |
125 | 125 | |
@@ -129,22 +129,22 @@ discard block |
||
129 | 129 | |
130 | 130 | <h2 class="nav-tab-wrapper"> |
131 | 131 | <?php |
132 | - foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) { |
|
132 | + foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) { |
|
133 | 133 | |
134 | - $tab_url = esc_url( add_query_arg( array( |
|
134 | + $tab_url = esc_url(add_query_arg(array( |
|
135 | 135 | 'settings-updated' => false, |
136 | 136 | 'tab' => $tab_id, |
137 | - ) ) ); |
|
137 | + ))); |
|
138 | 138 | |
139 | 139 | $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; |
140 | 140 | |
141 | - echo '<a href="' . esc_url( $tab_url ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>'; |
|
141 | + echo '<a href="'.esc_url($tab_url).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>'; |
|
142 | 142 | |
143 | 143 | } |
144 | 144 | ?> |
145 | 145 | </h2> |
146 | 146 | |
147 | - <?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?> |
|
147 | + <?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?> |
|
148 | 148 | |
149 | 149 | </div><!-- .wrap --> |
150 | 150 | |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return string |
168 | 168 | */ |
169 | - function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) { |
|
169 | + function give_modify_cmb2_form_output($form_format, $object_id, $cmb) { |
|
170 | 170 | |
171 | 171 | // only modify the give settings form |
172 | - if ( 'give_settings' == $object_id ) { |
|
172 | + if ('give_settings' == $object_id) { |
|
173 | 173 | |
174 | - return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . esc_attr__( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>'; |
|
174 | + return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.esc_attr__('Save Settings', 'give').'" class="button-primary"></div></form>'; |
|
175 | 175 | |
176 | 176 | } |
177 | 177 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @return array |
190 | 190 | */ |
191 | - public function give_settings( $active_tab ) { |
|
191 | + public function give_settings($active_tab) { |
|
192 | 192 | |
193 | 193 | $give_settings = array( |
194 | 194 | /** |
@@ -196,99 +196,99 @@ discard block |
||
196 | 196 | */ |
197 | 197 | 'general' => array( |
198 | 198 | 'id' => 'general_settings', |
199 | - 'give_title' => __( 'General Settings', 'give' ), |
|
200 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
201 | - 'fields' => apply_filters( 'give_settings_general', array( |
|
199 | + 'give_title' => __('General Settings', 'give'), |
|
200 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
201 | + 'fields' => apply_filters('give_settings_general', array( |
|
202 | 202 | array( |
203 | - 'name' => __( 'General Settings', 'give' ), |
|
203 | + 'name' => __('General Settings', 'give'), |
|
204 | 204 | 'desc' => '', |
205 | 205 | 'type' => 'give_title', |
206 | 206 | 'id' => 'give_title_general_settings_1', |
207 | 207 | ), |
208 | 208 | array( |
209 | - 'name' => __( 'Success Page', 'give' ), |
|
209 | + 'name' => __('Success Page', 'give'), |
|
210 | 210 | /* translators: %s: [give_receipt] */ |
211 | - 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
211 | + 'desc' => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
212 | 212 | 'id' => 'success_page', |
213 | 213 | 'type' => 'select', |
214 | - 'options' => give_cmb2_get_post_options( array( |
|
214 | + 'options' => give_cmb2_get_post_options(array( |
|
215 | 215 | 'post_type' => 'page', |
216 | - 'numberposts' => - 1, |
|
217 | - ) ), |
|
216 | + 'numberposts' => -1, |
|
217 | + )), |
|
218 | 218 | ), |
219 | 219 | array( |
220 | - 'name' => __( 'Failed Donation Page', 'give' ), |
|
221 | - 'desc' => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ), |
|
220 | + 'name' => __('Failed Donation Page', 'give'), |
|
221 | + 'desc' => __('The page donors are sent to if their donation is cancelled or fails.', 'give'), |
|
222 | 222 | 'id' => 'failure_page', |
223 | 223 | 'type' => 'select', |
224 | - 'options' => give_cmb2_get_post_options( array( |
|
224 | + 'options' => give_cmb2_get_post_options(array( |
|
225 | 225 | 'post_type' => 'page', |
226 | - 'numberposts' => - 1, |
|
227 | - ) ), |
|
226 | + 'numberposts' => -1, |
|
227 | + )), |
|
228 | 228 | ), |
229 | 229 | array( |
230 | - 'name' => __( 'Donation History Page', 'give' ), |
|
230 | + 'name' => __('Donation History Page', 'give'), |
|
231 | 231 | /* translators: %s: [donation_history] */ |
232 | - 'desc' => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
232 | + 'desc' => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
233 | 233 | 'id' => 'history_page', |
234 | 234 | 'type' => 'select', |
235 | - 'options' => give_cmb2_get_post_options( array( |
|
235 | + 'options' => give_cmb2_get_post_options(array( |
|
236 | 236 | 'post_type' => 'page', |
237 | - 'numberposts' => - 1, |
|
238 | - ) ), |
|
237 | + 'numberposts' => -1, |
|
238 | + )), |
|
239 | 239 | ), |
240 | 240 | array( |
241 | - 'name' => __( 'Base Country', 'give' ), |
|
242 | - 'desc' => __( 'The country your site operates from.', 'give' ), |
|
241 | + 'name' => __('Base Country', 'give'), |
|
242 | + 'desc' => __('The country your site operates from.', 'give'), |
|
243 | 243 | 'id' => 'base_country', |
244 | 244 | 'type' => 'select', |
245 | 245 | 'options' => give_get_country_list(), |
246 | 246 | ), |
247 | 247 | array( |
248 | - 'name' => __( 'Currency Settings', 'give' ), |
|
248 | + 'name' => __('Currency Settings', 'give'), |
|
249 | 249 | 'desc' => '', |
250 | 250 | 'type' => 'give_title', |
251 | 251 | 'id' => 'give_title_general_settings_2', |
252 | 252 | ), |
253 | 253 | array( |
254 | - 'name' => __( 'Currency', 'give' ), |
|
255 | - 'desc' => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
254 | + 'name' => __('Currency', 'give'), |
|
255 | + 'desc' => __('The donation currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
256 | 256 | 'id' => 'currency', |
257 | 257 | 'type' => 'select', |
258 | 258 | 'options' => give_get_currencies(), |
259 | 259 | 'default' => 'USD', |
260 | 260 | ), |
261 | 261 | array( |
262 | - 'name' => __( 'Currency Position', 'give' ), |
|
263 | - 'desc' => __( 'The position of the currency symbol.', 'give' ), |
|
262 | + 'name' => __('Currency Position', 'give'), |
|
263 | + 'desc' => __('The position of the currency symbol.', 'give'), |
|
264 | 264 | 'id' => 'currency_position', |
265 | 265 | 'type' => 'select', |
266 | 266 | 'options' => array( |
267 | 267 | /* translators: %s: currency symbol */ |
268 | - 'before' => sprintf( __( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
268 | + 'before' => sprintf(__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())), |
|
269 | 269 | /* translators: %s: currency symbol */ |
270 | - 'after' => sprintf( __( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
270 | + 'after' => sprintf(__('After - 10%s', 'give'), give_currency_symbol(give_get_currency())), |
|
271 | 271 | ), |
272 | 272 | 'default' => 'before', |
273 | 273 | ), |
274 | 274 | array( |
275 | - 'name' => __( 'Thousands Separator', 'give' ), |
|
276 | - 'desc' => __( 'The symbol (usually , or .) to separate thousands.', 'give' ), |
|
275 | + 'name' => __('Thousands Separator', 'give'), |
|
276 | + 'desc' => __('The symbol (usually , or .) to separate thousands.', 'give'), |
|
277 | 277 | 'id' => 'thousands_separator', |
278 | 278 | 'type' => 'text_small', |
279 | 279 | 'sanitization_cb' => 'give_sanitize_thousand_separator', |
280 | 280 | 'default' => ',', |
281 | 281 | ), |
282 | 282 | array( |
283 | - 'name' => __( 'Decimal Separator', 'give' ), |
|
284 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
283 | + 'name' => __('Decimal Separator', 'give'), |
|
284 | + 'desc' => __('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
285 | 285 | 'id' => 'decimal_separator', |
286 | 286 | 'type' => 'text_small', |
287 | 287 | 'default' => '.', |
288 | 288 | ), |
289 | 289 | array( |
290 | - 'name' => __( 'Number of Decimals', 'give' ), |
|
291 | - 'desc' => __( 'The number of decimal points displayed in amounts.', 'give' ), |
|
290 | + 'name' => __('Number of Decimals', 'give'), |
|
291 | + 'desc' => __('The number of decimal points displayed in amounts.', 'give'), |
|
292 | 292 | 'id' => 'number_decimals', |
293 | 293 | 'type' => 'text_small', |
294 | 294 | 'default' => 2, |
@@ -302,83 +302,83 @@ discard block |
||
302 | 302 | */ |
303 | 303 | 'gateways' => array( |
304 | 304 | 'id' => 'payment_gateways', |
305 | - 'give_title' => __( 'Payment Gateways', 'give' ), |
|
306 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
307 | - 'fields' => apply_filters( 'give_settings_gateways', array( |
|
305 | + 'give_title' => __('Payment Gateways', 'give'), |
|
306 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
307 | + 'fields' => apply_filters('give_settings_gateways', array( |
|
308 | 308 | array( |
309 | - 'name' => __( 'Gateways Settings', 'give' ), |
|
309 | + 'name' => __('Gateways Settings', 'give'), |
|
310 | 310 | 'desc' => '', |
311 | 311 | 'id' => 'give_title_gateway_settings_1', |
312 | 312 | 'type' => 'give_title', |
313 | 313 | ), |
314 | 314 | array( |
315 | - 'name' => __( 'Test Mode', 'give' ), |
|
316 | - 'desc' => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
315 | + 'name' => __('Test Mode', 'give'), |
|
316 | + 'desc' => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
317 | 317 | 'id' => 'test_mode', |
318 | 318 | 'type' => 'checkbox', |
319 | 319 | ), |
320 | 320 | array( |
321 | - 'name' => __( 'Enabled Gateways', 'give' ), |
|
322 | - 'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ), |
|
321 | + 'name' => __('Enabled Gateways', 'give'), |
|
322 | + 'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'), |
|
323 | 323 | 'id' => 'gateways', |
324 | 324 | 'type' => 'enabled_gateways', |
325 | 325 | ), |
326 | 326 | array( |
327 | - 'name' => __( 'Default Gateway', 'give' ), |
|
328 | - 'desc' => __( 'The gateway that will be selected by default.', 'give' ), |
|
327 | + 'name' => __('Default Gateway', 'give'), |
|
328 | + 'desc' => __('The gateway that will be selected by default.', 'give'), |
|
329 | 329 | 'id' => 'default_gateway', |
330 | 330 | 'type' => 'default_gateway', |
331 | 331 | ), |
332 | 332 | array( |
333 | - 'name' => __( 'PayPal Standard', 'give' ), |
|
333 | + 'name' => __('PayPal Standard', 'give'), |
|
334 | 334 | 'desc' => '', |
335 | 335 | 'type' => 'give_title', |
336 | 336 | 'id' => 'give_title_gateway_settings_2', |
337 | 337 | ), |
338 | 338 | array( |
339 | - 'name' => __( 'PayPal Email', 'give' ), |
|
340 | - 'desc' => __( 'Enter your PayPal account\'s email.', 'give' ), |
|
339 | + 'name' => __('PayPal Email', 'give'), |
|
340 | + 'desc' => __('Enter your PayPal account\'s email.', 'give'), |
|
341 | 341 | 'id' => 'paypal_email', |
342 | 342 | 'type' => 'text_email', |
343 | 343 | ), |
344 | 344 | array( |
345 | - 'name' => __( 'PayPal Page Style', 'give' ), |
|
346 | - 'desc' => __( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ), |
|
345 | + 'name' => __('PayPal Page Style', 'give'), |
|
346 | + 'desc' => __('Enter the name of the page style to use, or leave blank to use the default.', 'give'), |
|
347 | 347 | 'id' => 'paypal_page_style', |
348 | 348 | 'type' => 'text', |
349 | 349 | ), |
350 | 350 | array( |
351 | - 'name' => __( 'PayPal Transaction Type', 'give' ), |
|
352 | - 'desc' => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
351 | + 'name' => __('PayPal Transaction Type', 'give'), |
|
352 | + 'desc' => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
353 | 353 | 'id' => 'paypal_button_type', |
354 | 354 | 'type' => 'radio_inline', |
355 | 355 | 'options' => array( |
356 | - 'donation' => __( 'Donation', 'give' ), |
|
357 | - 'standard' => __( 'Standard Transaction', 'give' ), |
|
356 | + 'donation' => __('Donation', 'give'), |
|
357 | + 'standard' => __('Standard Transaction', 'give'), |
|
358 | 358 | ), |
359 | 359 | 'default' => 'donation', |
360 | 360 | ), |
361 | 361 | array( |
362 | - 'name' => __( 'Disable PayPal IPN Verification', 'give' ), |
|
363 | - 'desc' => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ), |
|
362 | + 'name' => __('Disable PayPal IPN Verification', 'give'), |
|
363 | + 'desc' => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'), |
|
364 | 364 | 'id' => 'disable_paypal_verification', |
365 | 365 | 'type' => 'checkbox', |
366 | 366 | ), |
367 | 367 | array( |
368 | - 'name' => __( 'Offline Donations', 'give' ), |
|
368 | + 'name' => __('Offline Donations', 'give'), |
|
369 | 369 | 'desc' => '', |
370 | 370 | 'type' => 'give_title', |
371 | 371 | 'id' => 'give_title_gateway_settings_3', |
372 | 372 | ), |
373 | 373 | array( |
374 | - 'name' => __( 'Collect Billing Details', 'give' ), |
|
375 | - 'desc' => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ), |
|
374 | + 'name' => __('Collect Billing Details', 'give'), |
|
375 | + 'desc' => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'), |
|
376 | 376 | 'id' => 'give_offline_donation_enable_billing_fields', |
377 | 377 | 'type' => 'checkbox', |
378 | 378 | ), |
379 | 379 | array( |
380 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
381 | - 'desc' => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
380 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
381 | + 'desc' => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
382 | 382 | 'id' => 'global_offline_donation_content', |
383 | 383 | 'default' => give_get_default_offline_donation_content(), |
384 | 384 | 'type' => 'wysiwyg', |
@@ -387,15 +387,15 @@ discard block |
||
387 | 387 | ), |
388 | 388 | ), |
389 | 389 | array( |
390 | - 'name' => __( 'Offline Donation Email Instructions Subject', 'give' ), |
|
391 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
390 | + 'name' => __('Offline Donation Email Instructions Subject', 'give'), |
|
391 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
392 | 392 | 'id' => 'offline_donation_subject', |
393 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
393 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
394 | 394 | 'type' => 'text', |
395 | 395 | ), |
396 | 396 | array( |
397 | - 'name' => __( 'Offline Donation Email Instructions', 'give' ), |
|
398 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
397 | + 'name' => __('Offline Donation Email Instructions', 'give'), |
|
398 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
399 | 399 | 'id' => 'global_offline_donation_email', |
400 | 400 | 'default' => give_get_default_offline_donation_email_content(), |
401 | 401 | 'type' => 'wysiwyg', |
@@ -409,104 +409,104 @@ discard block |
||
409 | 409 | /** Display Settings */ |
410 | 410 | 'display' => array( |
411 | 411 | 'id' => 'display_settings', |
412 | - 'give_title' => __( 'Display Settings', 'give' ), |
|
413 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
414 | - 'fields' => apply_filters( 'give_settings_display', array( |
|
412 | + 'give_title' => __('Display Settings', 'give'), |
|
413 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
414 | + 'fields' => apply_filters('give_settings_display', array( |
|
415 | 415 | array( |
416 | - 'name' => __( 'Display Settings', 'give' ), |
|
416 | + 'name' => __('Display Settings', 'give'), |
|
417 | 417 | 'desc' => '', |
418 | 418 | 'id' => 'give_title_display_settings_1', |
419 | 419 | 'type' => 'give_title', |
420 | 420 | ), |
421 | 421 | array( |
422 | - 'name' => __( 'Disable CSS', 'give' ), |
|
423 | - 'desc' => __( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ), |
|
422 | + 'name' => __('Disable CSS', 'give'), |
|
423 | + 'desc' => __('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'), |
|
424 | 424 | 'id' => 'disable_css', |
425 | 425 | 'type' => 'checkbox', |
426 | 426 | ), |
427 | 427 | array( |
428 | - 'name' => __( 'Enable Floating Labels', 'give' ), |
|
428 | + 'name' => __('Enable Floating Labels', 'give'), |
|
429 | 429 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
430 | - 'desc' => sprintf( wp_kses( __( 'Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( |
|
430 | + 'desc' => sprintf(wp_kses(__('Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array( |
|
431 | 431 | 'a' => array( |
432 | 432 | 'href' => array(), |
433 | 433 | 'target' => array(), |
434 | 434 | ), |
435 | - ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
435 | + )), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
436 | 436 | 'id' => 'floatlabels', |
437 | 437 | 'type' => 'checkbox', |
438 | 438 | ), |
439 | 439 | array( |
440 | - 'name' => __( 'Disable Welcome Screen', 'give' ), |
|
440 | + 'name' => __('Disable Welcome Screen', 'give'), |
|
441 | 441 | /* translators: %s: about page URL */ |
442 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give' ), array( |
|
442 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give'), array( |
|
443 | 443 | 'a' => array( |
444 | 444 | 'href' => array(), |
445 | 445 | 'target' => array(), |
446 | 446 | ), |
447 | - ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
447 | + )), esc_url(admin_url('index.php?page=give-about'))), |
|
448 | 448 | 'id' => 'disable_welcome', |
449 | 449 | 'type' => 'checkbox', |
450 | 450 | ), |
451 | 451 | array( |
452 | - 'name' => __( 'Post Types', 'give' ), |
|
452 | + 'name' => __('Post Types', 'give'), |
|
453 | 453 | 'desc' => '', |
454 | 454 | 'id' => 'give_title_display_settings_2', |
455 | 455 | 'type' => 'give_title', |
456 | 456 | ), |
457 | 457 | array( |
458 | - 'name' => __( 'Disable Form Single Views', 'give' ), |
|
459 | - 'desc' => __( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
458 | + 'name' => __('Disable Form Single Views', 'give'), |
|
459 | + 'desc' => __('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
460 | 460 | 'id' => 'disable_forms_singular', |
461 | 461 | 'type' => 'checkbox', |
462 | 462 | ), |
463 | 463 | array( |
464 | - 'name' => __( 'Disable Form Archives', 'give' ), |
|
465 | - 'desc' => __( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ), |
|
464 | + 'name' => __('Disable Form Archives', 'give'), |
|
465 | + 'desc' => __('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'), |
|
466 | 466 | 'id' => 'disable_forms_archives', |
467 | 467 | 'type' => 'checkbox', |
468 | 468 | ), |
469 | 469 | array( |
470 | - 'name' => __( 'Disable Form Excerpts', 'give' ), |
|
471 | - 'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
470 | + 'name' => __('Disable Form Excerpts', 'give'), |
|
471 | + 'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
472 | 472 | 'id' => 'disable_forms_excerpt', |
473 | 473 | 'type' => 'checkbox', |
474 | 474 | ), |
475 | 475 | array( |
476 | - 'name' => __( 'Featured Image Size', 'give' ), |
|
477 | - 'desc' => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ), |
|
476 | + 'name' => __('Featured Image Size', 'give'), |
|
477 | + 'desc' => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'), |
|
478 | 478 | 'id' => 'featured_image_size', |
479 | 479 | 'type' => 'select', |
480 | 480 | 'default' => 'large', |
481 | 481 | 'options' => give_get_featured_image_sizes(), |
482 | 482 | ), |
483 | 483 | array( |
484 | - 'name' => __( 'Disable Form Featured Image', 'give' ), |
|
485 | - 'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
484 | + 'name' => __('Disable Form Featured Image', 'give'), |
|
485 | + 'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
486 | 486 | 'id' => 'disable_form_featured_img', |
487 | 487 | 'type' => 'checkbox', |
488 | 488 | ), |
489 | 489 | array( |
490 | - 'name' => __( 'Disable Single Form Sidebar', 'give' ), |
|
491 | - 'desc' => __( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
490 | + 'name' => __('Disable Single Form Sidebar', 'give'), |
|
491 | + 'desc' => __('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
492 | 492 | 'id' => 'disable_form_sidebar', |
493 | 493 | 'type' => 'checkbox', |
494 | 494 | ), |
495 | 495 | array( |
496 | - 'name' => __( 'Taxonomies', 'give' ), |
|
496 | + 'name' => __('Taxonomies', 'give'), |
|
497 | 497 | 'desc' => '', |
498 | 498 | 'id' => 'give_title_display_settings_3', |
499 | 499 | 'type' => 'give_title', |
500 | 500 | ), |
501 | 501 | array( |
502 | - 'name' => __( 'Enable Form Categories', 'give' ), |
|
503 | - 'desc' => __( 'Enables the "Category" taxonomy for all Give forms.', 'give' ), |
|
502 | + 'name' => __('Enable Form Categories', 'give'), |
|
503 | + 'desc' => __('Enables the "Category" taxonomy for all Give forms.', 'give'), |
|
504 | 504 | 'id' => 'categories', |
505 | 505 | 'type' => 'checkbox', |
506 | 506 | ), |
507 | 507 | array( |
508 | - 'name' => __( 'Enable Form Tags', 'give' ), |
|
509 | - 'desc' => __( 'Enables the "Tag" taxonomy for all Give forms.', 'give' ), |
|
508 | + 'name' => __('Enable Form Tags', 'give'), |
|
509 | + 'desc' => __('Enables the "Tag" taxonomy for all Give forms.', 'give'), |
|
510 | 510 | 'id' => 'tags', |
511 | 511 | 'type' => 'checkbox', |
512 | 512 | ), |
@@ -519,101 +519,101 @@ discard block |
||
519 | 519 | */ |
520 | 520 | 'emails' => array( |
521 | 521 | 'id' => 'email_settings', |
522 | - 'give_title' => __( 'Email Settings', 'give' ), |
|
523 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
524 | - 'fields' => apply_filters( 'give_settings_emails', array( |
|
522 | + 'give_title' => __('Email Settings', 'give'), |
|
523 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
524 | + 'fields' => apply_filters('give_settings_emails', array( |
|
525 | 525 | array( |
526 | - 'name' => __( 'Email Settings', 'give' ), |
|
526 | + 'name' => __('Email Settings', 'give'), |
|
527 | 527 | 'desc' => '', |
528 | 528 | 'id' => 'give_title_email_settings_1', |
529 | 529 | 'type' => 'give_title', |
530 | 530 | ), |
531 | 531 | array( |
532 | 532 | 'id' => 'email_template', |
533 | - 'name' => __( 'Email Template', 'give' ), |
|
534 | - 'desc' => __( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ), |
|
533 | + 'name' => __('Email Template', 'give'), |
|
534 | + 'desc' => __('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'), |
|
535 | 535 | 'type' => 'select', |
536 | 536 | 'options' => give_get_email_templates(), |
537 | 537 | ), |
538 | 538 | array( |
539 | 539 | 'id' => 'email_logo', |
540 | - 'name' => __( 'Logo', 'give' ), |
|
541 | - 'desc' => __( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
540 | + 'name' => __('Logo', 'give'), |
|
541 | + 'desc' => __('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
542 | 542 | 'type' => 'file', |
543 | 543 | ), |
544 | 544 | array( |
545 | 545 | 'id' => 'from_name', |
546 | - 'name' => __( 'From Name', 'give' ), |
|
547 | - 'desc' => __( 'The name that appears in the "From" field in donation receipt emails.', 'give' ), |
|
548 | - 'default' => get_bloginfo( 'name' ), |
|
546 | + 'name' => __('From Name', 'give'), |
|
547 | + 'desc' => __('The name that appears in the "From" field in donation receipt emails.', 'give'), |
|
548 | + 'default' => get_bloginfo('name'), |
|
549 | 549 | 'type' => 'text', |
550 | 550 | ), |
551 | 551 | array( |
552 | 552 | 'id' => 'from_email', |
553 | - 'name' => __( 'From Email', 'give' ), |
|
554 | - 'desc' => __( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ), |
|
555 | - 'default' => get_bloginfo( 'admin_email' ), |
|
553 | + 'name' => __('From Email', 'give'), |
|
554 | + 'desc' => __('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'), |
|
555 | + 'default' => get_bloginfo('admin_email'), |
|
556 | 556 | 'type' => 'text', |
557 | 557 | ), |
558 | 558 | array( |
559 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
559 | + 'name' => __('Donation Receipt', 'give'), |
|
560 | 560 | 'desc' => '', |
561 | 561 | 'id' => 'give_title_email_settings_2', |
562 | 562 | 'type' => 'give_title', |
563 | 563 | ), |
564 | 564 | array( |
565 | 565 | 'id' => 'donation_subject', |
566 | - 'name' => __( 'Donation Email Subject', 'give' ), |
|
567 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
568 | - 'default' => esc_attr__( 'Donation Receipt', 'give' ), |
|
566 | + 'name' => __('Donation Email Subject', 'give'), |
|
567 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
568 | + 'default' => esc_attr__('Donation Receipt', 'give'), |
|
569 | 569 | 'type' => 'text', |
570 | 570 | ), |
571 | 571 | array( |
572 | 572 | 'id' => 'donation_receipt', |
573 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
573 | + 'name' => __('Donation Receipt', 'give'), |
|
574 | 574 | 'desc' => sprintf( |
575 | 575 | /* translators: %s: emails tags list */ |
576 | - __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ), |
|
577 | - '<br/>' . give_get_emails_tags_list() |
|
576 | + __('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'), |
|
577 | + '<br/>'.give_get_emails_tags_list() |
|
578 | 578 | ), |
579 | 579 | 'type' => 'wysiwyg', |
580 | 580 | 'default' => give_get_default_donation_receipt_email(), |
581 | 581 | ), |
582 | 582 | array( |
583 | - 'name' => __( 'New Donation Notification', 'give' ), |
|
583 | + 'name' => __('New Donation Notification', 'give'), |
|
584 | 584 | 'desc' => '', |
585 | 585 | 'id' => 'give_title_email_settings_3', |
586 | 586 | 'type' => 'give_title', |
587 | 587 | ), |
588 | 588 | array( |
589 | 589 | 'id' => 'donation_notification_subject', |
590 | - 'name' => __( 'Donation Notification Subject', 'give' ), |
|
591 | - 'desc' => __( 'Enter the subject line for the donation notification email.', 'give' ), |
|
590 | + 'name' => __('Donation Notification Subject', 'give'), |
|
591 | + 'desc' => __('Enter the subject line for the donation notification email.', 'give'), |
|
592 | 592 | 'type' => 'text', |
593 | - 'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ), |
|
593 | + 'default' => esc_attr__('New Donation - #{payment_id}', 'give'), |
|
594 | 594 | ), |
595 | 595 | array( |
596 | 596 | 'id' => 'donation_notification', |
597 | - 'name' => __( 'Donation Notification', 'give' ), |
|
597 | + 'name' => __('Donation Notification', 'give'), |
|
598 | 598 | 'desc' => sprintf( |
599 | 599 | /* translators: %s: emails tags list */ |
600 | - __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ), |
|
601 | - '<br/>' . give_get_emails_tags_list() |
|
600 | + __('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'), |
|
601 | + '<br/>'.give_get_emails_tags_list() |
|
602 | 602 | ), |
603 | 603 | 'type' => 'wysiwyg', |
604 | 604 | 'default' => give_get_default_donation_notification_email(), |
605 | 605 | ), |
606 | 606 | array( |
607 | 607 | 'id' => 'admin_notice_emails', |
608 | - 'name' => __( 'Donation Notification Emails', 'give' ), |
|
609 | - 'desc' => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ), |
|
608 | + 'name' => __('Donation Notification Emails', 'give'), |
|
609 | + 'desc' => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'), |
|
610 | 610 | 'type' => 'textarea', |
611 | - 'default' => get_bloginfo( 'admin_email' ), |
|
611 | + 'default' => get_bloginfo('admin_email'), |
|
612 | 612 | ), |
613 | 613 | array( |
614 | 614 | 'id' => 'disable_admin_notices', |
615 | - 'name' => __( 'Disable Admin Notifications', 'give' ), |
|
616 | - 'desc' => __( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ), |
|
615 | + 'name' => __('Disable Admin Notifications', 'give'), |
|
616 | + 'desc' => __('Check this box if you do not want to receive emails when new donations are made.', 'give'), |
|
617 | 617 | 'type' => 'checkbox', |
618 | 618 | ), |
619 | 619 | ) |
@@ -622,99 +622,99 @@ discard block |
||
622 | 622 | /** Extension Settings */ |
623 | 623 | 'addons' => array( |
624 | 624 | 'id' => 'addons', |
625 | - 'give_title' => __( 'Give Add-ons Settings', 'give' ), |
|
626 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
627 | - 'fields' => apply_filters( 'give_settings_addons', array() |
|
625 | + 'give_title' => __('Give Add-ons Settings', 'give'), |
|
626 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
627 | + 'fields' => apply_filters('give_settings_addons', array() |
|
628 | 628 | ), |
629 | 629 | ), |
630 | 630 | /** Licenses Settings */ |
631 | 631 | 'licenses' => array( |
632 | 632 | 'id' => 'licenses', |
633 | - 'give_title' => __( 'Give Licenses', 'give' ), |
|
634 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
635 | - 'fields' => apply_filters( 'give_settings_licenses', array() |
|
633 | + 'give_title' => __('Give Licenses', 'give'), |
|
634 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
635 | + 'fields' => apply_filters('give_settings_licenses', array() |
|
636 | 636 | ), |
637 | 637 | ), |
638 | 638 | /** Advanced Options */ |
639 | 639 | 'advanced' => array( |
640 | 640 | 'id' => 'advanced_options', |
641 | - 'give_title' => __( 'Advanced Options', 'give' ), |
|
642 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
643 | - 'fields' => apply_filters( 'give_settings_advanced', array( |
|
641 | + 'give_title' => __('Advanced Options', 'give'), |
|
642 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
643 | + 'fields' => apply_filters('give_settings_advanced', array( |
|
644 | 644 | array( |
645 | - 'name' => __( 'Access Control', 'give' ), |
|
645 | + 'name' => __('Access Control', 'give'), |
|
646 | 646 | 'desc' => '', |
647 | 647 | 'id' => 'give_title_session_control_1', |
648 | 648 | 'type' => 'give_title', |
649 | 649 | ), |
650 | 650 | array( |
651 | 651 | 'id' => 'session_lifetime', |
652 | - 'name' => __( 'Session Lifetime', 'give' ), |
|
653 | - 'desc' => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ), |
|
652 | + 'name' => __('Session Lifetime', 'give'), |
|
653 | + 'desc' => __('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'), |
|
654 | 654 | 'type' => 'select', |
655 | 655 | 'options' => array( |
656 | - '86400' => __( '24 Hours', 'give' ), |
|
657 | - '172800' => __( '48 Hours', 'give' ), |
|
658 | - '259200' => __( '72 Hours', 'give' ), |
|
659 | - '604800' => __( '1 Week', 'give' ), |
|
656 | + '86400' => __('24 Hours', 'give'), |
|
657 | + '172800' => __('48 Hours', 'give'), |
|
658 | + '259200' => __('72 Hours', 'give'), |
|
659 | + '604800' => __('1 Week', 'give'), |
|
660 | 660 | ), |
661 | 661 | ), |
662 | 662 | array( |
663 | - 'name' => __( 'Email Access', 'give' ), |
|
664 | - 'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
663 | + 'name' => __('Email Access', 'give'), |
|
664 | + 'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
665 | 665 | 'id' => 'email_access', |
666 | 666 | 'type' => 'checkbox', |
667 | 667 | ), |
668 | 668 | array( |
669 | 669 | 'id' => 'recaptcha_key', |
670 | - 'name' => __( 'reCAPTCHA Site Key', 'give' ), |
|
670 | + 'name' => __('reCAPTCHA Site Key', 'give'), |
|
671 | 671 | /* translators: %s: https://www.google.com/recaptcha/ */ |
672 | - 'desc' => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ), |
|
672 | + 'desc' => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')), |
|
673 | 673 | 'default' => '', |
674 | 674 | 'type' => 'text', |
675 | 675 | ), |
676 | 676 | array( |
677 | 677 | 'id' => 'recaptcha_secret', |
678 | - 'name' => __( 'reCAPTCHA Secret Key', 'give' ), |
|
679 | - 'desc' => __( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ), |
|
678 | + 'name' => __('reCAPTCHA Secret Key', 'give'), |
|
679 | + 'desc' => __('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'), |
|
680 | 680 | 'default' => '', |
681 | 681 | 'type' => 'text', |
682 | 682 | ), |
683 | 683 | array( |
684 | - 'name' => __( 'Data Control', 'give' ), |
|
684 | + 'name' => __('Data Control', 'give'), |
|
685 | 685 | 'desc' => '', |
686 | 686 | 'id' => 'give_title_data_control_2', |
687 | 687 | 'type' => 'give_title', |
688 | 688 | ), |
689 | 689 | array( |
690 | - 'name' => __( 'Remove All Data on Uninstall?', 'give' ), |
|
691 | - 'desc' => __( 'When the plugin is deleted, completely remove all Give data.', 'give' ), |
|
690 | + 'name' => __('Remove All Data on Uninstall?', 'give'), |
|
691 | + 'desc' => __('When the plugin is deleted, completely remove all Give data.', 'give'), |
|
692 | 692 | 'id' => 'uninstall_on_delete', |
693 | 693 | 'type' => 'checkbox', |
694 | 694 | ), |
695 | 695 | array( |
696 | - 'name' => __( 'Filter Control', 'give' ), |
|
696 | + 'name' => __('Filter Control', 'give'), |
|
697 | 697 | 'desc' => '', |
698 | 698 | 'id' => 'give_title_filter_control', |
699 | 699 | 'type' => 'give_title', |
700 | 700 | ), |
701 | 701 | array( |
702 | 702 | /* translators: %s: the_content */ |
703 | - 'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ), |
|
703 | + 'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'), |
|
704 | 704 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
705 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
705 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
706 | 706 | 'id' => 'disable_the_content_filter', |
707 | 707 | 'type' => 'checkbox', |
708 | 708 | ), |
709 | 709 | array( |
710 | - 'name' => __( 'Script Loading', 'give' ), |
|
710 | + 'name' => __('Script Loading', 'give'), |
|
711 | 711 | 'desc' => '', |
712 | 712 | 'id' => 'give_title_script_control', |
713 | 713 | 'type' => 'give_title', |
714 | 714 | ), |
715 | 715 | array( |
716 | - 'name' => __( 'Load Scripts in Footer?', 'give' ), |
|
717 | - 'desc' => __( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ), |
|
716 | + 'name' => __('Load Scripts in Footer?', 'give'), |
|
717 | + 'desc' => __('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'), |
|
718 | 718 | 'id' => 'scripts_footer', |
719 | 719 | 'type' => 'checkbox', |
720 | 720 | ), |
@@ -724,13 +724,13 @@ discard block |
||
724 | 724 | /** API Settings */ |
725 | 725 | 'api' => array( |
726 | 726 | 'id' => 'api', |
727 | - 'give_title' => __( 'API', 'give' ), |
|
728 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
727 | + 'give_title' => __('API', 'give'), |
|
728 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
729 | 729 | 'show_names' => false, // Hide field names on the left |
730 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
730 | + 'fields' => apply_filters('give_settings_system', array( |
|
731 | 731 | array( |
732 | 732 | 'id' => 'api', |
733 | - 'name' => __( 'API', 'give' ), |
|
733 | + 'name' => __('API', 'give'), |
|
734 | 734 | 'type' => 'api', |
735 | 735 | ), |
736 | 736 | ) |
@@ -739,13 +739,13 @@ discard block |
||
739 | 739 | /** Licenses Settings */ |
740 | 740 | 'system_info' => array( |
741 | 741 | 'id' => 'system_info', |
742 | - 'give_title' => __( 'System Info', 'give' ), |
|
743 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
744 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
742 | + 'give_title' => __('System Info', 'give'), |
|
743 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
744 | + 'fields' => apply_filters('give_settings_system', array( |
|
745 | 745 | array( |
746 | 746 | 'id' => 'system-info-textarea', |
747 | - 'name' => __( 'System Info', 'give' ), |
|
748 | - 'desc' => __( 'Please copy and paste this information in your ticket when contacting support.', 'give' ), |
|
747 | + 'name' => __('System Info', 'give'), |
|
748 | + 'desc' => __('Please copy and paste this information in your ticket when contacting support.', 'give'), |
|
749 | 749 | 'type' => 'system_info', |
750 | 750 | ), |
751 | 751 | ) |
@@ -753,15 +753,15 @@ discard block |
||
753 | 753 | ), |
754 | 754 | ); |
755 | 755 | |
756 | - $give_settings = apply_filters( 'give_registered_settings', $give_settings ); |
|
756 | + $give_settings = apply_filters('give_registered_settings', $give_settings); |
|
757 | 757 | |
758 | 758 | // Return all settings array if no active tab |
759 | - if ( empty( $active_tab ) || ! isset( $give_settings[ $active_tab ] ) ) { |
|
759 | + if (empty($active_tab) || ! isset($give_settings[$active_tab])) { |
|
760 | 760 | return $give_settings; |
761 | 761 | } |
762 | 762 | |
763 | 763 | // Add other tabs and settings fields as needed |
764 | - return $give_settings[ $active_tab ]; |
|
764 | + return $give_settings[$active_tab]; |
|
765 | 765 | |
766 | 766 | } |
767 | 767 | |
@@ -770,11 +770,11 @@ discard block |
||
770 | 770 | */ |
771 | 771 | public function settings_notices() { |
772 | 772 | |
773 | - if ( ! isset( $_POST['give_settings_saved'] ) ) { |
|
773 | + if ( ! isset($_POST['give_settings_saved'])) { |
|
774 | 774 | return; |
775 | 775 | } |
776 | 776 | |
777 | - add_settings_error( 'give-notices', 'global-settings-updated', __( 'Settings updated.', 'give' ), 'updated' ); |
|
777 | + add_settings_error('give-notices', 'global-settings-updated', __('Settings updated.', 'give'), 'updated'); |
|
778 | 778 | |
779 | 779 | } |
780 | 780 | |
@@ -789,14 +789,14 @@ discard block |
||
789 | 789 | * @return mixed Field value or exception is thrown. |
790 | 790 | * @throws Exception Throws an exception if the field is invalid. |
791 | 791 | */ |
792 | - public function __get( $field ) { |
|
792 | + public function __get($field) { |
|
793 | 793 | |
794 | 794 | // Allowed fields to retrieve |
795 | - if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) { |
|
795 | + if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) { |
|
796 | 796 | return $this->{$field}; |
797 | 797 | } |
798 | 798 | |
799 | - throw new Exception( sprintf( __( 'Invalid property: %s', 'give' ), $field ) ); |
|
799 | + throw new Exception(sprintf(__('Invalid property: %s', 'give'), $field)); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | |
@@ -815,12 +815,12 @@ discard block |
||
815 | 815 | * |
816 | 816 | * @return mixed Option value |
817 | 817 | */ |
818 | -function give_get_option( $key = '', $default = false ) { |
|
818 | +function give_get_option($key = '', $default = false) { |
|
819 | 819 | $give_options = give_get_settings(); |
820 | - $value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default; |
|
821 | - $value = apply_filters( 'give_get_option', $value, $key, $default ); |
|
820 | + $value = ! empty($give_options[$key]) ? $give_options[$key] : $default; |
|
821 | + $value = apply_filters('give_get_option', $value, $key, $default); |
|
822 | 822 | |
823 | - return apply_filters( "give_get_option_{$key}", $value, $key, $default ); |
|
823 | + return apply_filters("give_get_option_{$key}", $value, $key, $default); |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | |
@@ -838,33 +838,33 @@ discard block |
||
838 | 838 | * |
839 | 839 | * @return boolean True if updated, false if not. |
840 | 840 | */ |
841 | -function give_update_option( $key = '', $value = false ) { |
|
841 | +function give_update_option($key = '', $value = false) { |
|
842 | 842 | |
843 | 843 | // If no key, exit |
844 | - if ( empty( $key ) ) { |
|
844 | + if (empty($key)) { |
|
845 | 845 | return false; |
846 | 846 | } |
847 | 847 | |
848 | - if ( empty( $value ) ) { |
|
849 | - $remove_option = give_delete_option( $key ); |
|
848 | + if (empty($value)) { |
|
849 | + $remove_option = give_delete_option($key); |
|
850 | 850 | |
851 | 851 | return $remove_option; |
852 | 852 | } |
853 | 853 | |
854 | 854 | // First let's grab the current settings |
855 | - $options = get_option( 'give_settings' ); |
|
855 | + $options = get_option('give_settings'); |
|
856 | 856 | |
857 | 857 | // Let's let devs alter that value coming in |
858 | - $value = apply_filters( 'give_update_option', $value, $key ); |
|
858 | + $value = apply_filters('give_update_option', $value, $key); |
|
859 | 859 | |
860 | 860 | // Next let's try to update the value |
861 | - $options[ $key ] = $value; |
|
862 | - $did_update = update_option( 'give_settings', $options ); |
|
861 | + $options[$key] = $value; |
|
862 | + $did_update = update_option('give_settings', $options); |
|
863 | 863 | |
864 | 864 | // If it updated, let's update the global variable |
865 | - if ( $did_update ) { |
|
865 | + if ($did_update) { |
|
866 | 866 | global $give_options; |
867 | - $give_options[ $key ] = $value; |
|
867 | + $give_options[$key] = $value; |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | return $did_update; |
@@ -883,25 +883,25 @@ discard block |
||
883 | 883 | * |
884 | 884 | * @return boolean True if updated, false if not. |
885 | 885 | */ |
886 | -function give_delete_option( $key = '' ) { |
|
886 | +function give_delete_option($key = '') { |
|
887 | 887 | |
888 | 888 | // If no key, exit |
889 | - if ( empty( $key ) ) { |
|
889 | + if (empty($key)) { |
|
890 | 890 | return false; |
891 | 891 | } |
892 | 892 | |
893 | 893 | // First let's grab the current settings |
894 | - $options = get_option( 'give_settings' ); |
|
894 | + $options = get_option('give_settings'); |
|
895 | 895 | |
896 | 896 | // Next let's try to update the value |
897 | - if ( isset( $options[ $key ] ) ) { |
|
898 | - unset( $options[ $key ] ); |
|
897 | + if (isset($options[$key])) { |
|
898 | + unset($options[$key]); |
|
899 | 899 | } |
900 | 900 | |
901 | - $did_update = update_option( 'give_settings', $options ); |
|
901 | + $did_update = update_option('give_settings', $options); |
|
902 | 902 | |
903 | 903 | // If it updated, let's update the global variable |
904 | - if ( $did_update ) { |
|
904 | + if ($did_update) { |
|
905 | 905 | global $give_options; |
906 | 906 | $give_options = $options; |
907 | 907 | } |
@@ -920,9 +920,9 @@ discard block |
||
920 | 920 | */ |
921 | 921 | function give_get_settings() { |
922 | 922 | |
923 | - $settings = get_option( 'give_settings' ); |
|
923 | + $settings = get_option('give_settings'); |
|
924 | 924 | |
925 | - return (array) apply_filters( 'give_get_settings', $settings ); |
|
925 | + return (array) apply_filters('give_get_settings', $settings); |
|
926 | 926 | |
927 | 927 | } |
928 | 928 | |
@@ -940,25 +940,25 @@ discard block |
||
940 | 940 | * |
941 | 941 | * @return array |
942 | 942 | */ |
943 | -function give_settings_array_insert( $array, $position, $insert ) { |
|
944 | - if ( is_int( $position ) ) { |
|
945 | - array_splice( $array, $position, 0, $insert ); |
|
943 | +function give_settings_array_insert($array, $position, $insert) { |
|
944 | + if (is_int($position)) { |
|
945 | + array_splice($array, $position, 0, $insert); |
|
946 | 946 | } else { |
947 | 947 | |
948 | - foreach ( $array as $index => $subarray ) { |
|
949 | - if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) { |
|
948 | + foreach ($array as $index => $subarray) { |
|
949 | + if (isset($subarray['id']) && $subarray['id'] == $position) { |
|
950 | 950 | $pos = $index; |
951 | 951 | } |
952 | 952 | } |
953 | 953 | |
954 | - if ( ! isset( $pos ) ) { |
|
954 | + if ( ! isset($pos)) { |
|
955 | 955 | return $array; |
956 | 956 | } |
957 | 957 | |
958 | 958 | $array = array_merge( |
959 | - array_slice( $array, 0, $pos ), |
|
959 | + array_slice($array, 0, $pos), |
|
960 | 960 | $insert, |
961 | - array_slice( $array, $pos ) |
|
961 | + array_slice($array, $pos) |
|
962 | 962 | ); |
963 | 963 | } |
964 | 964 | |
@@ -978,23 +978,23 @@ discard block |
||
978 | 978 | * |
979 | 979 | * @return void |
980 | 980 | */ |
981 | -function give_enabled_gateways_callback( $field_arr, $saved_values = array() ) { |
|
981 | +function give_enabled_gateways_callback($field_arr, $saved_values = array()) { |
|
982 | 982 | |
983 | 983 | $id = $field_arr['id']; |
984 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
984 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
985 | 985 | |
986 | 986 | echo '<ul class="give-checklist-fields give-payment-gatways-list">'; |
987 | 987 | |
988 | - foreach ( $gateways as $key => $option ) : |
|
988 | + foreach ($gateways as $key => $option) : |
|
989 | 989 | |
990 | - if ( is_array( $saved_values ) && array_key_exists( $key, $saved_values ) ) { |
|
990 | + if (is_array($saved_values) && array_key_exists($key, $saved_values)) { |
|
991 | 991 | $enabled = '1'; |
992 | 992 | } else { |
993 | 993 | $enabled = null; |
994 | 994 | } |
995 | 995 | |
996 | - echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/> '; |
|
997 | - echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>'; |
|
996 | + echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/> '; |
|
997 | + echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>'; |
|
998 | 998 | |
999 | 999 | endforeach; |
1000 | 1000 | |
@@ -1013,16 +1013,16 @@ discard block |
||
1013 | 1013 | * |
1014 | 1014 | * @return void |
1015 | 1015 | */ |
1016 | -function give_default_gateway_callback( $field_arr, $saved_value ) { |
|
1016 | +function give_default_gateway_callback($field_arr, $saved_value) { |
|
1017 | 1017 | $id = $field_arr['id']; |
1018 | 1018 | $gateways = give_get_enabled_payment_gateways(); |
1019 | - $saved_value = give_get_default_gateway( null ); |
|
1019 | + $saved_value = give_get_default_gateway(null); |
|
1020 | 1020 | |
1021 | - echo '<select class="give-select" name="' . $id . '" id="' . $id . '">'; |
|
1021 | + echo '<select class="give-select" name="'.$id.'" id="'.$id.'">'; |
|
1022 | 1022 | |
1023 | - foreach ( $gateways as $key => $option ) : |
|
1024 | - $selected = isset( $saved_value ) ? selected( $key, $saved_value, false ) : ''; |
|
1025 | - echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
1023 | + foreach ($gateways as $key => $option) : |
|
1024 | + $selected = isset($saved_value) ? selected($key, $saved_value, false) : ''; |
|
1025 | + echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>'; |
|
1026 | 1026 | endforeach; |
1027 | 1027 | |
1028 | 1028 | echo '</select>'; |
@@ -1040,13 +1040,13 @@ discard block |
||
1040 | 1040 | * |
1041 | 1041 | * @return void |
1042 | 1042 | */ |
1043 | -function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1043 | +function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1044 | 1044 | |
1045 | 1045 | $id = $field_type_object->field->args['id']; |
1046 | 1046 | $title = $field_type_object->field->args['name']; |
1047 | 1047 | $field_description = $field_type_object->field->args['desc']; |
1048 | 1048 | |
1049 | - echo '<hr>' . $field_description; |
|
1049 | + echo '<hr>'.$field_description; |
|
1050 | 1050 | |
1051 | 1051 | } |
1052 | 1052 | |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | * |
1062 | 1062 | * @return void |
1063 | 1063 | */ |
1064 | -function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1064 | +function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1065 | 1065 | |
1066 | 1066 | $id = $field_type_object->field->args['id']; |
1067 | 1067 | $title = $field_type_object->field->args['name']; |
@@ -1080,25 +1080,25 @@ discard block |
||
1080 | 1080 | * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types |
1081 | 1081 | * @return array An array of options that matches the CMB2 options array |
1082 | 1082 | */ |
1083 | -function give_cmb2_get_post_options( $query_args, $force = false ) { |
|
1083 | +function give_cmb2_get_post_options($query_args, $force = false) { |
|
1084 | 1084 | |
1085 | - $post_options = array( '' => '' ); // Blank option |
|
1085 | + $post_options = array('' => ''); // Blank option |
|
1086 | 1086 | |
1087 | - if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) { |
|
1087 | + if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) { |
|
1088 | 1088 | return $post_options; |
1089 | 1089 | } |
1090 | 1090 | |
1091 | - $args = wp_parse_args( $query_args, array( |
|
1091 | + $args = wp_parse_args($query_args, array( |
|
1092 | 1092 | 'post_type' => 'page', |
1093 | 1093 | 'numberposts' => 10, |
1094 | - ) ); |
|
1094 | + )); |
|
1095 | 1095 | |
1096 | - $posts = get_posts( $args ); |
|
1096 | + $posts = get_posts($args); |
|
1097 | 1097 | |
1098 | - if ( $posts ) { |
|
1099 | - foreach ( $posts as $post ) { |
|
1098 | + if ($posts) { |
|
1099 | + foreach ($posts as $post) { |
|
1100 | 1100 | |
1101 | - $post_options[ $post->ID ] = $post->post_title; |
|
1101 | + $post_options[$post->ID] = $post->post_title; |
|
1102 | 1102 | |
1103 | 1103 | } |
1104 | 1104 | } |
@@ -1123,33 +1123,33 @@ discard block |
||
1123 | 1123 | |
1124 | 1124 | $sizes = array(); |
1125 | 1125 | $get_sizes = get_intermediate_image_sizes(); |
1126 | - $core_image_sizes = array( 'thumbnail', 'medium', 'medium_large', 'large' ); |
|
1126 | + $core_image_sizes = array('thumbnail', 'medium', 'medium_large', 'large'); |
|
1127 | 1127 | |
1128 | 1128 | |
1129 | 1129 | // This will help us to filter special characters from a string |
1130 | - $filter_slug_items = array( '_', '-' ); |
|
1130 | + $filter_slug_items = array('_', '-'); |
|
1131 | 1131 | |
1132 | - foreach ( $get_sizes as $_size ) { |
|
1132 | + foreach ($get_sizes as $_size) { |
|
1133 | 1133 | |
1134 | 1134 | // Converting image size slug to title case |
1135 | - $sizes[ $_size ] = give_slug_to_title( $_size, $filter_slug_items ); |
|
1135 | + $sizes[$_size] = give_slug_to_title($_size, $filter_slug_items); |
|
1136 | 1136 | |
1137 | - if ( in_array( $_size, $core_image_sizes ) ) { |
|
1138 | - $sizes[ $_size ] .= ' (' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" ); |
|
1139 | - } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) { |
|
1140 | - $sizes[ $_size ] .= " ({$_wp_additional_image_sizes[ $_size ]['width']} x {$_wp_additional_image_sizes[ $_size ]['height']}"; |
|
1137 | + if (in_array($_size, $core_image_sizes)) { |
|
1138 | + $sizes[$_size] .= ' ('.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h"); |
|
1139 | + } elseif (isset($_wp_additional_image_sizes[$_size])) { |
|
1140 | + $sizes[$_size] .= " ({$_wp_additional_image_sizes[$_size]['width']} x {$_wp_additional_image_sizes[$_size]['height']}"; |
|
1141 | 1141 | } |
1142 | 1142 | |
1143 | 1143 | // Based on the above image height check, label the respective resolution as responsive |
1144 | - if ( ( array_key_exists( $_size, $_wp_additional_image_sizes ) && ! $_wp_additional_image_sizes[ $_size ]['crop'] ) || ( in_array( $_size, $core_image_sizes ) && ! get_option( "{$_size}_crop" ) ) ) { |
|
1145 | - $sizes[ $_size ] .= ' - responsive'; |
|
1144 | + if ((array_key_exists($_size, $_wp_additional_image_sizes) && ! $_wp_additional_image_sizes[$_size]['crop']) || (in_array($_size, $core_image_sizes) && ! get_option("{$_size}_crop"))) { |
|
1145 | + $sizes[$_size] .= ' - responsive'; |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | - $sizes[ $_size ] .= ')'; |
|
1148 | + $sizes[$_size] .= ')'; |
|
1149 | 1149 | |
1150 | 1150 | } |
1151 | 1151 | |
1152 | - return apply_filters( 'give_get_featured_image_sizes', $sizes ); |
|
1152 | + return apply_filters('give_get_featured_image_sizes', $sizes); |
|
1153 | 1153 | } |
1154 | 1154 | |
1155 | 1155 | |
@@ -1165,14 +1165,14 @@ discard block |
||
1165 | 1165 | * |
1166 | 1166 | * @return text $string |
1167 | 1167 | */ |
1168 | -function give_slug_to_title( $string, $filters = array() ){ |
|
1168 | +function give_slug_to_title($string, $filters = array()) { |
|
1169 | 1169 | |
1170 | - foreach( $filters as $filter_item ){ |
|
1171 | - $string = str_replace( $filter_item, ' ', $string ); |
|
1170 | + foreach ($filters as $filter_item) { |
|
1171 | + $string = str_replace($filter_item, ' ', $string); |
|
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | // Return updated string after converting it to title case |
1175 | - return ucwords( $string ); |
|
1175 | + return ucwords($string); |
|
1176 | 1176 | |
1177 | 1177 | } |
1178 | 1178 | |
@@ -1188,18 +1188,18 @@ discard block |
||
1188 | 1188 | * |
1189 | 1189 | * @return void |
1190 | 1190 | */ |
1191 | -function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1191 | +function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1192 | 1192 | /* @var CMB2_Types $field_type_object */ |
1193 | 1193 | |
1194 | 1194 | $id = $field_type_object->field->args['id']; |
1195 | 1195 | $field_description = $field_type_object->field->args['desc']; |
1196 | 1196 | $license = $field_type_object->field->args['options']['license']; |
1197 | 1197 | $license_key = $escaped_value; |
1198 | - $is_license_key = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) ); |
|
1199 | - $is_valid_license = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) ); |
|
1198 | + $is_license_key = apply_filters('give_is_license_key', (is_object($license) && ! empty($license))); |
|
1199 | + $is_valid_license = apply_filters('give_is_valid_license', ($is_license_key && property_exists($license, 'license') && 'valid' === $license->license)); |
|
1200 | 1200 | $shortname = $field_type_object->field->args['options']['shortname']; |
1201 | 1201 | $field_classes = 'regular-text give-license-field'; |
1202 | - $type = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password'; |
|
1202 | + $type = empty($escaped_value) || ! $is_valid_license ? 'text' : 'password'; |
|
1203 | 1203 | $custom_html = ''; |
1204 | 1204 | $messages = array(); |
1205 | 1205 | $class = ''; |
@@ -1211,117 +1211,117 @@ discard block |
||
1211 | 1211 | |
1212 | 1212 | // By default query on edd api url will return license object which contain status and message property, this can break below functionality. |
1213 | 1213 | // To combat that check if status is set to error or not, if yes then set $is_license_key to false. |
1214 | - if ( $is_license_key && property_exists( $license, 'status' ) && 'error' === $license->status ) { |
|
1214 | + if ($is_license_key && property_exists($license, 'status') && 'error' === $license->status) { |
|
1215 | 1215 | $is_license_key = false; |
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | // Check if current license is part of subscription or not. |
1219 | - $subscriptions = get_option( 'give_subscriptions' ); |
|
1219 | + $subscriptions = get_option('give_subscriptions'); |
|
1220 | 1220 | |
1221 | - if ( $is_license_key && $subscriptions ) { |
|
1222 | - foreach ( $subscriptions as $subscription ) { |
|
1223 | - if ( in_array( $license_key, $subscription['licenses'] ) ) { |
|
1221 | + if ($is_license_key && $subscriptions) { |
|
1222 | + foreach ($subscriptions as $subscription) { |
|
1223 | + if (in_array($license_key, $subscription['licenses'])) { |
|
1224 | 1224 | $is_in_subscription = $subscription['id']; |
1225 | 1225 | break; |
1226 | 1226 | } |
1227 | 1227 | } |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - if ( $is_license_key ) { |
|
1231 | - if ( $is_in_subscription ) { |
|
1232 | - $subscription_expires = strtotime( $subscriptions[ $is_in_subscription ]['expires'] ); |
|
1233 | - $subscription_status = __( 'renew', 'give' ); |
|
1230 | + if ($is_license_key) { |
|
1231 | + if ($is_in_subscription) { |
|
1232 | + $subscription_expires = strtotime($subscriptions[$is_in_subscription]['expires']); |
|
1233 | + $subscription_status = __('renew', 'give'); |
|
1234 | 1234 | |
1235 | - if ( ( 'active' !== $subscriptions[ $is_in_subscription ]['status'] ) ) { |
|
1236 | - $subscription_status = __( 'expire', 'give' ); |
|
1235 | + if (('active' !== $subscriptions[$is_in_subscription]['status'])) { |
|
1236 | + $subscription_status = __('expire', 'give'); |
|
1237 | 1237 | } |
1238 | 1238 | |
1239 | - if ( $subscription_expires < current_time( 'timestamp', 1 ) ) { |
|
1240 | - $messages[] = sprintf( |
|
1241 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ), |
|
1242 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1243 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1244 | - $checkout_page_link . '?edd_license_key=' . $subscriptions[ $is_in_subscription ]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1239 | + if ($subscription_expires < current_time('timestamp', 1)) { |
|
1240 | + $messages[] = sprintf( |
|
1241 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give'), |
|
1242 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1243 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1244 | + $checkout_page_link.'?edd_license_key='.$subscriptions[$is_in_subscription]['license_key'].'&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1245 | 1245 | ); |
1246 | 1246 | $license_status = 'license-expired'; |
1247 | - } elseif ( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) { |
|
1247 | + } elseif (strtotime('- 7 days', $subscription_expires) < current_time('timestamp', 1)) { |
|
1248 | 1248 | $messages[] = sprintf( |
1249 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give' ), |
|
1250 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1251 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1249 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give'), |
|
1250 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1251 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1252 | 1252 | $subscription_status, |
1253 | - human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[ $is_in_subscription ]['expires'] ) ) |
|
1253 | + human_time_diff(current_time('timestamp', 1), strtotime($subscriptions[$is_in_subscription]['expires'])) |
|
1254 | 1254 | ); |
1255 | 1255 | $license_status = 'license-expires-soon'; |
1256 | 1256 | } else { |
1257 | 1257 | $messages[] = sprintf( |
1258 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give' ), |
|
1259 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1260 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1258 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give'), |
|
1259 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1260 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1261 | 1261 | $subscription_status, |
1262 | - date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[ $is_in_subscription ]['expires'], current_time( 'timestamp' ) ) ) |
|
1262 | + date_i18n(get_option('date_format'), strtotime($subscriptions[$is_in_subscription]['expires'], current_time('timestamp'))) |
|
1263 | 1263 | ); |
1264 | 1264 | $license_status = 'license-expiration-date'; |
1265 | 1265 | } |
1266 | - } elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) { |
|
1266 | + } elseif (empty($license->success) && property_exists($license, 'error')) { |
|
1267 | 1267 | |
1268 | 1268 | // activate_license 'invalid' on anything other than valid, so if there was an error capture it |
1269 | - switch ( $license->error ) { |
|
1269 | + switch ($license->error) { |
|
1270 | 1270 | case 'expired' : |
1271 | 1271 | $class = $license->error; |
1272 | 1272 | $messages[] = sprintf( |
1273 | - __( 'Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ), |
|
1274 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ), |
|
1275 | - $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1273 | + __('Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give'), |
|
1274 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))), |
|
1275 | + $checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1276 | 1276 | ); |
1277 | - $license_status = 'license-' . $class; |
|
1277 | + $license_status = 'license-'.$class; |
|
1278 | 1278 | break; |
1279 | 1279 | |
1280 | 1280 | case 'missing' : |
1281 | 1281 | $class = $license->error; |
1282 | 1282 | $messages[] = sprintf( |
1283 | - __( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ), |
|
1284 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing' |
|
1283 | + __('Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give'), |
|
1284 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=missing' |
|
1285 | 1285 | ); |
1286 | - $license_status = 'license-' . $class; |
|
1286 | + $license_status = 'license-'.$class; |
|
1287 | 1287 | break; |
1288 | 1288 | |
1289 | 1289 | case 'invalid' : |
1290 | 1290 | $class = $license->error; |
1291 | 1291 | $messages[] = sprintf( |
1292 | - __( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1292 | + __('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1293 | 1293 | $addon_name, |
1294 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1294 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1295 | 1295 | ); |
1296 | - $license_status = 'license-' . $class; |
|
1296 | + $license_status = 'license-'.$class; |
|
1297 | 1297 | break; |
1298 | 1298 | |
1299 | 1299 | case 'site_inactive' : |
1300 | 1300 | $class = $license->error; |
1301 | 1301 | $messages[] = sprintf( |
1302 | - __( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1302 | + __('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1303 | 1303 | $addon_name, |
1304 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1304 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1305 | 1305 | ); |
1306 | - $license_status = 'license-' . $class; |
|
1306 | + $license_status = 'license-'.$class; |
|
1307 | 1307 | break; |
1308 | 1308 | |
1309 | 1309 | case 'item_name_mismatch' : |
1310 | 1310 | $class = $license->error; |
1311 | - $messages[] = sprintf( __( 'This license %1$s does not belong to %2$s.', 'give' ), $license_key, $addon_name ); |
|
1312 | - $license_status = 'license-' . $class; |
|
1311 | + $messages[] = sprintf(__('This license %1$s does not belong to %2$s.', 'give'), $license_key, $addon_name); |
|
1312 | + $license_status = 'license-'.$class; |
|
1313 | 1313 | break; |
1314 | 1314 | |
1315 | 1315 | case 'no_activations_left': |
1316 | 1316 | $class = $license->error; |
1317 | - $messages[] = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link ); |
|
1318 | - $license_status = 'license-' . $class; |
|
1317 | + $messages[] = sprintf(__('Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give'), $account_page_link); |
|
1318 | + $license_status = 'license-'.$class; |
|
1319 | 1319 | break; |
1320 | 1320 | |
1321 | 1321 | default: |
1322 | 1322 | $class = $license->error; |
1323 | 1323 | $messages[] = sprintf( |
1324 | - __( 'Your license is not activated.Please <a href="%3$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs. %2$sError Code: %1$s.', 'give' ), |
|
1324 | + __('Your license is not activated.Please <a href="%3$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs. %2$sError Code: %1$s.', 'give'), |
|
1325 | 1325 | $license->error, |
1326 | 1326 | '<br/>', |
1327 | 1327 | "{$account_page_link}?utm_campaign=admin&utm_source=licenses&utm_medium={$license->error}" |
@@ -1330,37 +1330,37 @@ discard block |
||
1330 | 1330 | break; |
1331 | 1331 | } |
1332 | 1332 | |
1333 | - } elseif ( empty( $license->success ) ){ |
|
1333 | + } elseif (empty($license->success)) { |
|
1334 | 1334 | $class = 'invalid'; |
1335 | 1335 | $messages[] = sprintf( |
1336 | - __( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1336 | + __('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1337 | 1337 | $addon_name, |
1338 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1338 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1339 | 1339 | ); |
1340 | - $license_status = 'license-' . $class; |
|
1340 | + $license_status = 'license-'.$class; |
|
1341 | 1341 | |
1342 | - }else { |
|
1343 | - switch ( $license->license ) { |
|
1342 | + } else { |
|
1343 | + switch ($license->license) { |
|
1344 | 1344 | case 'valid' : |
1345 | 1345 | default: |
1346 | 1346 | $class = 'valid'; |
1347 | - $now = current_time( 'timestamp' ); |
|
1348 | - $expiration = strtotime( $license->expires, current_time( 'timestamp' ) ); |
|
1347 | + $now = current_time('timestamp'); |
|
1348 | + $expiration = strtotime($license->expires, current_time('timestamp')); |
|
1349 | 1349 | |
1350 | - if ( 'lifetime' === $license->expires ) { |
|
1351 | - $messages[] = __( 'License key never expires.', 'give' ); |
|
1350 | + if ('lifetime' === $license->expires) { |
|
1351 | + $messages[] = __('License key never expires.', 'give'); |
|
1352 | 1352 | $license_status = 'license-lifetime-notice'; |
1353 | - } elseif ( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) { |
|
1353 | + } elseif ($expiration > $now && $expiration - $now < (DAY_IN_SECONDS * 30)) { |
|
1354 | 1354 | $messages[] = sprintf( |
1355 | - __( 'Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ), |
|
1356 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ), |
|
1357 | - $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew' |
|
1355 | + __('Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give'), |
|
1356 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))), |
|
1357 | + $checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=renew' |
|
1358 | 1358 | ); |
1359 | 1359 | $license_status = 'license-expires-soon'; |
1360 | 1360 | } else { |
1361 | 1361 | $messages[] = sprintf( |
1362 | - __( 'Your license key expires on %s.', 'give' ), |
|
1363 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ) |
|
1362 | + __('Your license key expires on %s.', 'give'), |
|
1363 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))) |
|
1364 | 1364 | ); |
1365 | 1365 | $license_status = 'license-expiration-date'; |
1366 | 1366 | } |
@@ -1368,15 +1368,15 @@ discard block |
||
1368 | 1368 | } |
1369 | 1369 | } |
1370 | 1370 | } else { |
1371 | - $messages[] = sprintf( |
|
1372 | - __( 'To receive updates, please enter your valid %s license key.', 'give' ), |
|
1371 | + $messages[] = sprintf( |
|
1372 | + __('To receive updates, please enter your valid %s license key.', 'give'), |
|
1373 | 1373 | $addon_name |
1374 | 1374 | ); |
1375 | 1375 | $license_status = 'inactive'; |
1376 | 1376 | } |
1377 | 1377 | |
1378 | 1378 | // Add class for input field if license is active. |
1379 | - if ( $is_valid_license ) { |
|
1379 | + if ($is_valid_license) { |
|
1380 | 1380 | $field_classes .= ' give-license-active'; |
1381 | 1381 | } |
1382 | 1382 | |
@@ -1384,33 +1384,33 @@ discard block |
||
1384 | 1384 | $input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\">"; |
1385 | 1385 | |
1386 | 1386 | // If license is active so show deactivate button. |
1387 | - if ( $is_valid_license ) { |
|
1387 | + if ($is_valid_license) { |
|
1388 | 1388 | // Get input field html. |
1389 | 1389 | $input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\" readonly=\"readonly\">"; |
1390 | 1390 | |
1391 | - $custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>'; |
|
1391 | + $custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>'; |
|
1392 | 1392 | |
1393 | 1393 | } |
1394 | 1394 | |
1395 | 1395 | // Field description. |
1396 | - $custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>'; |
|
1396 | + $custom_html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>'; |
|
1397 | 1397 | |
1398 | 1398 | // If no messages found then inform user that to get updated in future register yourself. |
1399 | - if ( empty( $messages ) ) { |
|
1400 | - $messages[] = apply_filters( "{$shortname}_default_addon_notice", __( 'To receive updates, please enter your valid license key.', 'give' ) ); |
|
1399 | + if (empty($messages)) { |
|
1400 | + $messages[] = apply_filters("{$shortname}_default_addon_notice", __('To receive updates, please enter your valid license key.', 'give')); |
|
1401 | 1401 | } |
1402 | 1402 | |
1403 | - foreach ( $messages as $message ) { |
|
1404 | - $custom_html .= '<div class="give-license-status-notice give-' . $license_status . '">'; |
|
1405 | - $custom_html .= '<p>' . $message . '</p>'; |
|
1403 | + foreach ($messages as $message) { |
|
1404 | + $custom_html .= '<div class="give-license-status-notice give-'.$license_status.'">'; |
|
1405 | + $custom_html .= '<p>'.$message.'</p>'; |
|
1406 | 1406 | $custom_html .= '</div>'; |
1407 | 1407 | } |
1408 | 1408 | |
1409 | 1409 | // Field html. |
1410 | - $custom_html = apply_filters( 'give_license_key_field_html', $input_field_html . $custom_html, $field_type_object ); |
|
1410 | + $custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object); |
|
1411 | 1411 | |
1412 | 1412 | // Nonce. |
1413 | - wp_nonce_field( $id . '-nonce', $id . '-nonce' ); |
|
1413 | + wp_nonce_field($id.'-nonce', $id.'-nonce'); |
|
1414 | 1414 | |
1415 | 1415 | // Print field html. |
1416 | 1416 | echo "<div class=\"give-license-key\"><label for=\"{$id}\">{$addon_name }</label></div><div class=\"give-license-block\">{$custom_html}</div>"; |
@@ -1425,7 +1425,7 @@ discard block |
||
1425 | 1425 | */ |
1426 | 1426 | function give_api_callback() { |
1427 | 1427 | |
1428 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
1428 | + if ( ! current_user_can('manage_give_settings')) { |
|
1429 | 1429 | return; |
1430 | 1430 | } |
1431 | 1431 | |
@@ -1434,9 +1434,9 @@ discard block |
||
1434 | 1434 | * |
1435 | 1435 | * @since 1.0 |
1436 | 1436 | */ |
1437 | - do_action( 'give_tools_api_keys_before' ); |
|
1437 | + do_action('give_tools_api_keys_before'); |
|
1438 | 1438 | |
1439 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
1439 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
1440 | 1440 | |
1441 | 1441 | $api_keys_table = new Give_API_Keys_Table(); |
1442 | 1442 | $api_keys_table->prepare_items(); |
@@ -1445,9 +1445,9 @@ discard block |
||
1445 | 1445 | <span class="cmb2-metabox-description api-description"> |
1446 | 1446 | <?php echo sprintf( |
1447 | 1447 | /* translators: 1: http://docs.givewp.com/api 2: http://docs.givewp.com/addon-zapier */ |
1448 | - __( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ), |
|
1449 | - esc_url( 'http://docs.givewp.com/api' ), |
|
1450 | - esc_url( 'http://docs.givewp.com/addon-zapier' ) |
|
1448 | + __('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'), |
|
1449 | + esc_url('http://docs.givewp.com/api'), |
|
1450 | + esc_url('http://docs.givewp.com/addon-zapier') |
|
1451 | 1451 | ); ?> |
1452 | 1452 | </span> |
1453 | 1453 | <?php |
@@ -1457,10 +1457,10 @@ discard block |
||
1457 | 1457 | * |
1458 | 1458 | * @since 1.0 |
1459 | 1459 | */ |
1460 | - do_action( 'give_tools_api_keys_after' ); |
|
1460 | + do_action('give_tools_api_keys_after'); |
|
1461 | 1461 | } |
1462 | 1462 | |
1463 | -add_action( 'give_settings_tab_api_keys', 'give_api_callback' ); |
|
1463 | +add_action('give_settings_tab_api_keys', 'give_api_callback'); |
|
1464 | 1464 | |
1465 | 1465 | /** |
1466 | 1466 | * Hook Callback |
@@ -1473,7 +1473,7 @@ discard block |
||
1473 | 1473 | * |
1474 | 1474 | * @return void |
1475 | 1475 | */ |
1476 | -function give_hook_callback( $args ) { |
|
1476 | +function give_hook_callback($args) { |
|
1477 | 1477 | |
1478 | 1478 | $id = $args['id']; |
1479 | 1479 | |
@@ -1482,7 +1482,7 @@ discard block |
||
1482 | 1482 | * |
1483 | 1483 | * @since 1.0 |
1484 | 1484 | */ |
1485 | - do_action( "give_{$id}" ); |
|
1485 | + do_action("give_{$id}"); |
|
1486 | 1486 | |
1487 | 1487 | } |
1488 | 1488 | |
@@ -1497,19 +1497,19 @@ discard block |
||
1497 | 1497 | * |
1498 | 1498 | * @return bool |
1499 | 1499 | */ |
1500 | -function give_is_setting_enabled( $value, $compare_with = null ) { |
|
1501 | - if ( ! is_null( $compare_with ) ) { |
|
1500 | +function give_is_setting_enabled($value, $compare_with = null) { |
|
1501 | + if ( ! is_null($compare_with)) { |
|
1502 | 1502 | |
1503 | - if ( is_array( $compare_with ) ) { |
|
1503 | + if (is_array($compare_with)) { |
|
1504 | 1504 | // Output. |
1505 | - return in_array( $value, $compare_with ); |
|
1505 | + return in_array($value, $compare_with); |
|
1506 | 1506 | } |
1507 | 1507 | |
1508 | 1508 | // Output. |
1509 | - return ( $value === $compare_with ); |
|
1509 | + return ($value === $compare_with); |
|
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | // Backward compatibility: From version 1.8 most of setting is modified to enabled/disabled |
1513 | 1513 | // Output. |
1514 | - return ( in_array( $value, array( 'enabled', 'on', 'yes' ) ) ? true : false ); |
|
1514 | + return (in_array($value, array('enabled', 'on', 'yes')) ? true : false); |
|
1515 | 1515 | } |