Completed
Push — master ( 20241e...1e8296 )
by Devin
17:08
created
includes/class-give-template-loader.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 
@@ -36,29 +36,29 @@  discard block
 block discarded – undo
36 36
 		/**
37 37
 		 * Templates
38 38
 		 */
39
-		add_filter( 'template_include', array( __CLASS__, 'template_loader' ) );
39
+		add_filter('template_include', array(__CLASS__, 'template_loader'));
40 40
 
41 41
 		/**
42 42
 		 * Content Wrappers
43 43
 		 */
44
-		add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 );
45
-		add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 );
44
+		add_action('give_before_main_content', 'give_output_content_wrapper', 10);
45
+		add_action('give_after_main_content', 'give_output_content_wrapper_end', 10);
46 46
 
47 47
 		/**
48 48
 		 * Entry Summary Classes
49 49
 		 */
50
-		add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) );
50
+		add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes'));
51 51
 
52 52
 		/**
53 53
 		 * Sidebar
54 54
 		 */
55
-		add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 );
55
+		add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1);
56 56
 
57 57
 		/**
58 58
 		 * Single Forms Summary Box
59 59
 		 */
60
-		add_action( 'give_single_form_summary', 'give_template_single_title', 5 );
61
-		add_action( 'give_single_form_summary', 'give_get_donation_form', 10 );
60
+		add_action('give_single_form_summary', 'give_template_single_title', 5);
61
+		add_action('give_single_form_summary', 'give_get_donation_form', 10);
62 62
 
63 63
 	}
64 64
 
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return string $classes List of space separated class names.
75 75
 	 */
76
-	public function give_set_single_summary_classes( $classes ) {
76
+	public function give_set_single_summary_classes($classes) {
77 77
 
78 78
 		//Add full width class when feature image is disabled AND no widgets are present
79
-		if ( ! give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) {
79
+		if ( ! give_is_setting_enabled(give_get_option('form_sidebar'))) {
80 80
 			$classes .= ' give-full-width';
81 81
 		}
82 82
 
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 	public function give_output_sidebar_option() {
98 98
 
99 99
 		//Add full width class when feature image is disabled AND no widgets are present
100
-		if ( give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) {
101
-			add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 );
102
-			add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 );
103
-			add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 );
104
-			add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 );
100
+		if (give_is_setting_enabled(give_get_option('form_sidebar'))) {
101
+			add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5);
102
+			add_action('give_before_single_form_summary', 'give_show_form_images', 10);
103
+			add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20);
104
+			add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30);
105 105
 		}
106 106
 
107 107
 	}
@@ -123,20 +123,20 @@  discard block
 block discarded – undo
123 123
 	 *
124 124
 	 * @return string $template
125 125
 	 */
126
-	public static function template_loader( $template ) {
127
-		$find = array( 'give.php' );
126
+	public static function template_loader($template) {
127
+		$find = array('give.php');
128 128
 		$file = '';
129 129
 
130
-		if ( is_single() && get_post_type() == 'give_forms' ) {
130
+		if (is_single() && get_post_type() == 'give_forms') {
131 131
 			$file   = 'single-give-form.php';
132 132
 			$find[] = $file;
133
-			$find[] = apply_filters( 'give_template_path', 'give/' ) . $file;
133
+			$find[] = apply_filters('give_template_path', 'give/').$file;
134 134
 		}
135 135
 
136
-		if ( $file ) {
137
-			$template = locate_template( array_unique( $find ) );
138
-			if ( ! $template ) {
139
-				$template = GIVE_PLUGIN_DIR . '/templates/' . $file;
136
+		if ($file) {
137
+			$template = locate_template(array_unique($find));
138
+			if ( ! $template) {
139
+				$template = GIVE_PLUGIN_DIR.'/templates/'.$file;
140 140
 			}
141 141
 		}
142 142
 
Please login to merge, or discard this patch.
includes/admin/reporting/tools.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_tools_recount_stats_display() {
24 24
 
25
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
25
+	if ( ! current_user_can('manage_give_settings')) {
26 26
 		return;
27 27
 	}
28 28
 
@@ -31,27 +31,27 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @since 1.5
33 33
 	 */
34
-	do_action( 'give_tools_recount_stats_before' );
34
+	do_action('give_tools_recount_stats_before');
35 35
 	?>
36 36
 	<div id="poststuff">
37 37
 		<div class="postbox">
38 38
 
39
-			<h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2>
39
+			<h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2>
40 40
 
41 41
 			<div class="inside recount-stats-controls">
42
-				<p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p>
42
+				<p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p>
43 43
 				<form method="post" id="give-tools-recount-form" class="give-export-form">
44 44
 
45
-					<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
45
+					<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
46 46
 
47 47
 					<select name="give-export-class" id="recount-stats-type">
48
-						<option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option>
49
-						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option>
50
-						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option>
51
-						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option>
52
-						<option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option>
53
-						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Transactions', 'give' ); ?></option>
54
-						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option>
48
+						<option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option>
49
+						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option>
50
+						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option>
51
+						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option>
52
+						<option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option>
53
+						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Transactions', 'give'); ?></option>
54
+						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option>
55 55
 						<?php
56 56
 						/**
57 57
 						 * Fires in the recount stats selectbox.
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 						 *
61 61
 						 * @since 1.5
62 62
 						 */
63
-						do_action( 'give_recount_tool_options' );
63
+						do_action('give_recount_tool_options');
64 64
 						?>
65 65
 					</select>
66 66
 
@@ -68,22 +68,22 @@  discard block
 block discarded – undo
68 68
 						<?php
69 69
 						$args = array(
70 70
 							'name'   => 'form_id',
71
-							'number' => - 1,
71
+							'number' => -1,
72 72
 							'chosen' => true,
73 73
 						);
74
-						echo Give()->html->forms_dropdown( $args );
74
+						echo Give()->html->forms_dropdown($args);
75 75
 						?>
76 76
 					</span>
77 77
 
78
-					<input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/>
78
+					<input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/>
79 79
 
80 80
 					<br/>
81 81
 
82 82
 					<span class="give-recount-stats-descriptions">
83
-						<span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span>
84
-						<span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span>
85
-						<span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span>
86
-						<span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span>
83
+						<span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span>
84
+						<span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span>
85
+						<span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span>
86
+						<span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span>
87 87
 						<?php
88 88
 						/**
89 89
 						 * Fires in the recount stats description area.
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
 						 *
93 93
 						 * @since 1.5
94 94
 						 */
95
-						do_action( 'give_recount_tool_descriptions' );
95
+						do_action('give_recount_tool_descriptions');
96 96
 						?>
97
-						<span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span>
98
-						<span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span>
97
+						<span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span>
98
+						<span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span>
99 99
 					</span>
100 100
 
101 101
 					<span class="spinner"></span>
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 				 *
110 110
 				 * @since 1.5
111 111
 				 */
112
-				do_action( 'give_tools_recount_forms' );
112
+				do_action('give_tools_recount_forms');
113 113
 				?>
114 114
 			</div><!-- .inside -->
115 115
 		</div><!-- .postbox -->
@@ -120,5 +120,5 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @since 1.5
122 122
 	 */
123
-	do_action( 'give_tools_recount_stats_after' );
123
+	do_action('give_tools_recount_stats_after');
124 124
 }
125 125
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-api.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_API' ) ) :
16
+if ( ! class_exists('Give_Settings_API')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_API.
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'api';
46
-			$this->label = esc_html__( 'API', 'give' );
46
+			$this->label = esc_html__('API', 'give');
47 47
 
48
-			add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) );
48
+			add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-tools_settings_{$this->id}_page", array($this, 'output'));
50 50
 		}
51 51
 
52 52
 		/**
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 		 * @param  array $pages Lst of pages.
57 57
 		 * @return array
58 58
 		 */
59
-		public function add_settings_page( $pages ) {
60
-			$pages[ $this->id ] = $this->label;
59
+		public function add_settings_page($pages) {
60
+			$pages[$this->id] = $this->label;
61 61
 
62 62
 			return $pages;
63 63
 		}
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 			$GLOBALS['give_hide_save_button'] = true;
74 74
 
75 75
 			// Get settings.
76
-			$settings = apply_filters( 'give_settings_system', array(
76
+			$settings = apply_filters('give_settings_system', array(
77 77
 				array(
78 78
 					'id'   => 'give_tools_api',
79 79
 					'type' => 'title',
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 				),
82 82
 				array(
83 83
 					'id'   => 'api',
84
-					'name' => esc_html__( 'API', 'give' ),
84
+					'name' => esc_html__('API', 'give'),
85 85
 					'type' => 'api',
86 86
 				),
87 87
 				array(
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			 * @since  1.8
98 98
 			 * @param  array $settings
99 99
 			 */
100
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
100
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
101 101
 
102 102
 			// Output.
103 103
 			return $settings;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		public function output() {
113 113
 			$settings = $this->get_settings();
114 114
 
115
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
115
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
116 116
 		}
117 117
 	}
118 118
 
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-data.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Data' ) ) :
16
+if ( ! class_exists('Give_Settings_Data')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Data.
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'data';
46
-			$this->label = esc_html__( 'Data', 'give' );
46
+			$this->label = esc_html__('Data', 'give');
47 47
 
48
-			add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) );
48
+			add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-tools_settings_{$this->id}_page", array($this, 'output'));
50 50
 
51 51
 			// Do not use main form for this tab.
52
-			if( give_get_current_setting_tab() === $this->id ) {
53
-				add_action( "give-tools_open_form", '__return_empty_string' );
54
-				add_action( "give-tools_close_form", '__return_empty_string' );
52
+			if (give_get_current_setting_tab() === $this->id) {
53
+				add_action("give-tools_open_form", '__return_empty_string');
54
+				add_action("give-tools_close_form", '__return_empty_string');
55 55
 			}
56 56
 		}
57 57
 
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 		 * @param  array $pages Lst of pages.
63 63
 		 * @return array
64 64
 		 */
65
-		public function add_settings_page( $pages ) {
66
-			$pages[ $this->id ] = $this->label;
65
+		public function add_settings_page($pages) {
66
+			$pages[$this->id] = $this->label;
67 67
 
68 68
 			return $pages;
69 69
 		}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 			$GLOBALS['give_hide_save_button'] = true;
80 80
 
81 81
 			// Get settings.
82
-			$settings = apply_filters( 'give_settings_system', array(
82
+			$settings = apply_filters('give_settings_system', array(
83 83
 				array(
84 84
 					'id'   => 'give_tools_tools',
85 85
 					'type' => 'title',
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 				),
88 88
 				array(
89 89
 					'id'   => 'api',
90
-					'name' => esc_html__( 'Tools', 'give' ),
90
+					'name' => esc_html__('Tools', 'give'),
91 91
 					'type' => 'data',
92 92
 				),
93 93
 				array(
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 			 * @since  1.8
104 104
 			 * @param  array $settings
105 105
 			 */
106
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
106
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
107 107
 
108 108
 			// Output.
109 109
 			return $settings;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		public function output() {
119 119
 			$settings = $this->get_settings();
120 120
 
121
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
121
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
122 122
 		}
123 123
 	}
124 124
 
Please login to merge, or discard this patch.
includes/class-give-logging.php 2 patches
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function __setup_hooks() {
45 45
 		// Create the log post type
46
-		add_action( 'init', array( $this, 'register_post_type' ), 1 );
46
+		add_action('init', array($this, 'register_post_type'), 1);
47 47
 
48 48
 		// Create types taxonomy and default types
49
-		add_action( 'init', array( $this, 'register_taxonomy' ), 1 );
49
+		add_action('init', array($this, 'register_taxonomy'), 1);
50 50
 
51
-		add_action( 'save_post_give_payment', array( $this, 'background_process_delete_cache') );
52
-		add_action( 'save_post_give_forms', array( $this, 'background_process_delete_cache') );
53
-		add_action( 'save_post_give_log', array( $this, 'background_process_delete_cache') );
54
-		add_action( 'give_delete_log_cache', array( $this, 'delete_cache') );
51
+		add_action('save_post_give_payment', array($this, 'background_process_delete_cache'));
52
+		add_action('save_post_give_forms', array($this, 'background_process_delete_cache'));
53
+		add_action('save_post_give_log', array($this, 'background_process_delete_cache'));
54
+		add_action('give_delete_log_cache', array($this, 'delete_cache'));
55 55
 	}
56 56
 
57 57
 	/**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	public function register_post_type() {
68 68
 		/* Logs post type */
69 69
 		$log_args = array(
70
-			'labels'              => array( 'name' => esc_html__( 'Logs', 'give' ) ),
70
+			'labels'              => array('name' => esc_html__('Logs', 'give')),
71 71
 			'public'              => false,
72 72
 			'exclude_from_search' => true,
73 73
 			'publicly_queryable'  => false,
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 			'query_var'           => false,
76 76
 			'rewrite'             => false,
77 77
 			'capability_type'     => 'post',
78
-			'supports'            => array( 'title', 'editor' ),
78
+			'supports'            => array('title', 'editor'),
79 79
 			'can_export'          => true,
80 80
 		);
81 81
 
82
-		register_post_type( 'give_log', $log_args );
82
+		register_post_type('give_log', $log_args);
83 83
 	}
84 84
 
85 85
 	/**
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @return void
94 94
 	 */
95 95
 	public function register_taxonomy() {
96
-		register_taxonomy( 'give_log_type', 'give_log', array( 'public' => false ) );
96
+		register_taxonomy('give_log_type', 'give_log', array('public' => false));
97 97
 	}
98 98
 
99 99
 	/**
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 			'api_request',
114 114
 		);
115 115
 
116
-		return apply_filters( 'give_log_types', $terms );
116
+		return apply_filters('give_log_types', $terms);
117 117
 	}
118 118
 
119 119
 	/**
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	 *
129 129
 	 * @return bool         Whether log type is valid.
130 130
 	 */
131
-	public function valid_type( $type ) {
132
-		return in_array( $type, $this->log_types() );
131
+	public function valid_type($type) {
132
+		return in_array($type, $this->log_types());
133 133
 	}
134 134
 
135 135
 	/**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @return int             Log ID.
150 150
 	 */
151
-	public function add( $title = '', $message = '', $parent = 0, $type = null ) {
151
+	public function add($title = '', $message = '', $parent = 0, $type = null) {
152 152
 		$log_data = array(
153 153
 			'post_title'   => $title,
154 154
 			'post_content' => $message,
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			'log_type'     => $type,
157 157
 		);
158 158
 
159
-		return $this->insert_log( $log_data );
159
+		return $this->insert_log($log_data);
160 160
 	}
161 161
 
162 162
 	/**
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @return array             An array of the connected logs.
175 175
 	 */
176
-	public function get_logs( $object_id = 0, $type = null, $paged = null ) {
177
-		return $this->get_connected_logs( array(
176
+	public function get_logs($object_id = 0, $type = null, $paged = null) {
177
+		return $this->get_connected_logs(array(
178 178
 			'post_parent' => $object_id,
179 179
 			'paged'       => $paged,
180 180
 			'log_type'    => $type,
181
-		) );
181
+		));
182 182
 	}
183 183
 
184 184
 	/**
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @return int             The ID of the newly created log item.
194 194
 	 */
195
-	public function insert_log( $log_data = array(), $log_meta = array() ) {
195
+	public function insert_log($log_data = array(), $log_meta = array()) {
196 196
 		$defaults = array(
197 197
 			'post_type'    => 'give_log',
198 198
 			'post_status'  => 'publish',
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 			'log_type'     => false,
202 202
 		);
203 203
 
204
-		$args = wp_parse_args( $log_data, $defaults );
204
+		$args = wp_parse_args($log_data, $defaults);
205 205
 
206 206
 		/**
207 207
 		 * Fires before inserting log entry.
@@ -211,20 +211,20 @@  discard block
 block discarded – undo
211 211
 		 * @param array $log_data Log entry data.
212 212
 		 * @param array $log_meta Log entry meta.
213 213
 		 */
214
-		do_action( 'give_pre_insert_log', $log_data, $log_meta );
214
+		do_action('give_pre_insert_log', $log_data, $log_meta);
215 215
 
216 216
 		// Store the log entry
217
-		$log_id = wp_insert_post( $args );
217
+		$log_id = wp_insert_post($args);
218 218
 
219 219
 		// Set the log type, if any
220
-		if ( $log_data['log_type'] && $this->valid_type( $log_data['log_type'] ) ) {
221
-			wp_set_object_terms( $log_id, $log_data['log_type'], 'give_log_type', false );
220
+		if ($log_data['log_type'] && $this->valid_type($log_data['log_type'])) {
221
+			wp_set_object_terms($log_id, $log_data['log_type'], 'give_log_type', false);
222 222
 		}
223 223
 
224 224
 		// Set log meta, if any
225
-		if ( $log_id && ! empty( $log_meta ) ) {
226
-			foreach ( (array) $log_meta as $key => $meta ) {
227
-				update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
225
+		if ($log_id && ! empty($log_meta)) {
226
+			foreach ((array) $log_meta as $key => $meta) {
227
+				update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
228 228
 			}
229 229
 		}
230 230
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		 * @param array $log_data Log entry data.
238 238
 		 * @param array $log_meta Log entry meta.
239 239
 		 */
240
-		do_action( 'give_post_insert_log', $log_id, $log_data, $log_meta );
240
+		do_action('give_post_insert_log', $log_id, $log_data, $log_meta);
241 241
 
242 242
 		return $log_id;
243 243
 	}
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @return bool|null       True if successful, false otherwise.
255 255
 	 */
256
-	public function update_log( $log_data = array(), $log_meta = array() ) {
256
+	public function update_log($log_data = array(), $log_meta = array()) {
257 257
 
258 258
 		/**
259 259
 		 * Fires before updating log entry.
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 		 * @param array $log_data Log entry data.
264 264
 		 * @param array $log_meta Log entry meta.
265 265
 		 */
266
-		do_action( 'give_pre_update_log', $log_data, $log_meta );
266
+		do_action('give_pre_update_log', $log_data, $log_meta);
267 267
 
268 268
 		$defaults = array(
269 269
 			'post_type'   => 'give_log',
@@ -271,15 +271,15 @@  discard block
 block discarded – undo
271 271
 			'post_parent' => 0,
272 272
 		);
273 273
 
274
-		$args = wp_parse_args( $log_data, $defaults );
274
+		$args = wp_parse_args($log_data, $defaults);
275 275
 
276 276
 		// Store the log entry
277
-		$log_id = wp_update_post( $args );
277
+		$log_id = wp_update_post($args);
278 278
 
279
-		if ( $log_id && ! empty( $log_meta ) ) {
280
-			foreach ( (array) $log_meta as $key => $meta ) {
281
-				if ( ! empty( $meta ) ) {
282
-					update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
279
+		if ($log_id && ! empty($log_meta)) {
280
+			foreach ((array) $log_meta as $key => $meta) {
281
+				if ( ! empty($meta)) {
282
+					update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
283 283
 				}
284 284
 			}
285 285
 		}
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 		 * @param array $log_data Log entry data.
294 294
 		 * @param array $log_meta Log entry meta.
295 295
 		 */
296
-		do_action( 'give_post_update_log', $log_id, $log_data, $log_meta );
296
+		do_action('give_post_update_log', $log_id, $log_data, $log_meta);
297 297
 	}
298 298
 
299 299
 	/**
@@ -308,19 +308,19 @@  discard block
 block discarded – undo
308 308
 	 *
309 309
 	 * @return array|false Array if logs were found, false otherwise.
310 310
 	 */
311
-	public function get_connected_logs( $args = array() ) {
311
+	public function get_connected_logs($args = array()) {
312 312
 
313 313
 		$defaults = array(
314 314
 			'post_type'      => 'give_log',
315 315
 			'posts_per_page' => 20,
316 316
 			'post_status'    => 'publish',
317
-			'paged'          => get_query_var( 'paged' ),
317
+			'paged'          => get_query_var('paged'),
318 318
 			'log_type'       => false,
319 319
 		);
320 320
 
321
-		$query_args = wp_parse_args( $args, $defaults );
321
+		$query_args = wp_parse_args($args, $defaults);
322 322
 
323
-		if ( $query_args['log_type'] && $this->valid_type( $query_args['log_type'] ) ) {
323
+		if ($query_args['log_type'] && $this->valid_type($query_args['log_type'])) {
324 324
 			$query_args['tax_query'] = array(
325 325
 				array(
326 326
 					'taxonomy' => 'give_log_type',
@@ -330,9 +330,9 @@  discard block
 block discarded – undo
330 330
 			);
331 331
 		}
332 332
 
333
-		$logs = get_posts( $query_args );
333
+		$logs = get_posts($query_args);
334 334
 
335
-		if ( $logs ) {
335
+		if ($logs) {
336 336
 			return $logs;
337 337
 		}
338 338
 
@@ -355,17 +355,17 @@  discard block
 block discarded – undo
355 355
 	 *
356 356
 	 * @return int                Log count.
357 357
 	 */
358
-	public function get_log_count( $object_id = 0, $type = null, $meta_query = null, $date_query = null ) {
358
+	public function get_log_count($object_id = 0, $type = null, $meta_query = null, $date_query = null) {
359 359
 
360 360
 		$query_args = array(
361 361
 			'post_parent'    => $object_id,
362 362
 			'post_type'      => 'give_log',
363
-			'posts_per_page' => - 1,
363
+			'posts_per_page' => -1,
364 364
 			'post_status'    => 'publish',
365 365
 			'fields'         => 'ids',
366 366
 		);
367 367
 
368
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
368
+		if ( ! empty($type) && $this->valid_type($type)) {
369 369
 			$query_args['tax_query'] = array(
370 370
 				array(
371 371
 					'taxonomy' => 'give_log_type',
@@ -375,25 +375,25 @@  discard block
 block discarded – undo
375 375
 			);
376 376
 		}
377 377
 
378
-		if ( ! empty( $meta_query ) ) {
378
+		if ( ! empty($meta_query)) {
379 379
 			$query_args['meta_query'] = $meta_query;
380 380
 		}
381 381
 
382
-		if ( ! empty( $date_query ) ) {
382
+		if ( ! empty($date_query)) {
383 383
 			$query_args['date_query'] = $date_query;
384 384
 		}
385 385
 
386 386
 
387 387
 		// Get cache key for current query.
388
-		$cache_key =  give_get_cache_key( 'get_log_count', $query_args );
388
+		$cache_key = give_get_cache_key('get_log_count', $query_args);
389 389
 
390 390
 		// check if cache already exist or not.
391
-		if( ! ( $logs_count = get_option( $cache_key ) ) ) {
392
-			$logs = new WP_Query( $query_args );
391
+		if ( ! ($logs_count = get_option($cache_key))) {
392
+			$logs = new WP_Query($query_args);
393 393
 			$logs_count = (int) $logs->post_count;
394 394
 
395 395
 			// Cache results.
396
-			add_option( $cache_key, $logs_count, '', 'no' );
396
+			add_option($cache_key, $logs_count, '', 'no');
397 397
 		}
398 398
 
399 399
 		return $logs_count;
@@ -413,16 +413,16 @@  discard block
 block discarded – undo
413 413
 	 *
414 414
 	 * @return void
415 415
 	 */
416
-	public function delete_logs( $object_id = 0, $type = null, $meta_query = null ) {
416
+	public function delete_logs($object_id = 0, $type = null, $meta_query = null) {
417 417
 		$query_args = array(
418 418
 			'post_parent'    => $object_id,
419 419
 			'post_type'      => 'give_log',
420
-			'posts_per_page' => - 1,
420
+			'posts_per_page' => -1,
421 421
 			'post_status'    => 'publish',
422 422
 			'fields'         => 'ids',
423 423
 		);
424 424
 
425
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
425
+		if ( ! empty($type) && $this->valid_type($type)) {
426 426
 			$query_args['tax_query'] = array(
427 427
 				array(
428 428
 					'taxonomy' => 'give_log_type',
@@ -432,15 +432,15 @@  discard block
 block discarded – undo
432 432
 			);
433 433
 		}
434 434
 
435
-		if ( ! empty( $meta_query ) ) {
435
+		if ( ! empty($meta_query)) {
436 436
 			$query_args['meta_query'] = $meta_query;
437 437
 		}
438 438
 
439
-		$logs = get_posts( $query_args );
439
+		$logs = get_posts($query_args);
440 440
 
441
-		if ( $logs ) {
442
-			foreach ( $logs as $log ) {
443
-				wp_delete_post( $log, true );
441
+		if ($logs) {
442
+			foreach ($logs as $log) {
443
+				wp_delete_post($log, true);
444 444
 			}
445 445
 		}
446 446
 	}
@@ -453,8 +453,8 @@  discard block
 block discarded – undo
453 453
 	 *
454 454
 	 * @param int $post_id
455 455
 	 */
456
-	public function background_process_delete_cache( $post_id ) {
457
-		wp_schedule_single_event( time(), 'give_delete_log_cache' );
456
+	public function background_process_delete_cache($post_id) {
457
+		wp_schedule_single_event(time(), 'give_delete_log_cache');
458 458
 	}
459 459
 
460 460
 	/**
@@ -476,14 +476,14 @@  discard block
 block discarded – undo
476 476
 		);
477 477
 
478 478
 		// Bailout.
479
-		if( empty( $cache_option_names ) ) {
479
+		if (empty($cache_option_names)) {
480 480
 			return false;
481 481
 		}
482 482
 
483 483
 
484 484
 		// Delete log cache.
485
-		foreach ( $cache_option_names as $option_name ) {
486
-			delete_option( $option_name['option_name'] );
485
+		foreach ($cache_option_names as $option_name) {
486
+			delete_option($option_name['option_name']);
487 487
 		}
488 488
 	}
489 489
 }
@@ -506,10 +506,10 @@  discard block
 block discarded – undo
506 506
  *
507 507
  * @return int             ID of the new log entry.
508 508
  */
509
-function give_record_log( $title = '', $message = '', $parent = 0, $type = null ) {
509
+function give_record_log($title = '', $message = '', $parent = 0, $type = null) {
510 510
 	/* @var Give_Logging $give_logs */
511 511
 	global $give_logs;
512
-	$log = $give_logs->add( $title, $message, $parent, $type );
512
+	$log = $give_logs->add($title, $message, $parent, $type);
513 513
 
514 514
 	return $log;
515 515
 }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -463,7 +463,7 @@
 block discarded – undo
463 463
 	 * @since  1.7
464 464
 	 * @access public
465 465
 	 *
466
-	 * @return bool
466
+	 * @return false|null
467 467
 	 */
468 468
 	public function delete_cache() {
469 469
 		global $wpdb;
Please login to merge, or discard this patch.
includes/price-functions.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return bool true if has variable prices, false otherwise
25 25
  */
26
-function give_has_variable_prices( $form_id = 0 ) {
26
+function give_has_variable_prices($form_id = 0) {
27 27
 
28
-	if ( empty( $form_id ) ) {
28
+	if (empty($form_id)) {
29 29
 		return false;
30 30
 	}
31 31
 
32
-	$form = new Give_Donate_Form( $form_id );
32
+	$form = new Give_Donate_Form($form_id);
33 33
 
34 34
 	return $form->has_variable_prices();
35 35
 }
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array Variable prices
46 46
  */
47
-function give_get_variable_prices( $form_id = 0 ) {
47
+function give_get_variable_prices($form_id = 0) {
48 48
 
49
-	if ( empty( $form_id ) ) {
49
+	if (empty($form_id)) {
50 50
 		return false;
51 51
 	}
52 52
 
53
-	$form = new Give_Donate_Form( $form_id );
53
+	$form = new Give_Donate_Form($form_id);
54 54
 
55 55
 	return $form->prices;
56 56
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return string $default_price
69 69
  */
70
-function give_get_default_multilevel_amount( $form_id ) {
70
+function give_get_default_multilevel_amount($form_id) {
71 71
 	$default_price = '1.00';
72
-	$prices        = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
72
+	$prices        = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
73 73
 
74
-	foreach ( $prices as $price ) {
74
+	foreach ($prices as $price) {
75 75
 
76
-		if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
76
+		if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
77 77
 			$default_price = $price['_give_amount'];
78 78
 		}
79 79
 
@@ -94,19 +94,19 @@  discard block
 block discarded – undo
94 94
  * @return string $default_price
95 95
  * @since      1.0
96 96
  */
97
-function give_get_default_form_amount( $form_id ) {
97
+function give_get_default_form_amount($form_id) {
98 98
 
99
-	if ( give_has_variable_prices( $form_id ) ) {
99
+	if (give_has_variable_prices($form_id)) {
100 100
 
101
-		$default_amount = give_get_default_multilevel_amount( $form_id );
101
+		$default_amount = give_get_default_multilevel_amount($form_id);
102 102
 
103 103
 	} else {
104 104
 
105
-		$default_amount = get_post_meta( $form_id, '_give_set_price', true );
105
+		$default_amount = get_post_meta($form_id, '_give_set_price', true);
106 106
 
107 107
 	}
108 108
 
109
-	return apply_filters( 'give_default_form_amount', $default_amount );
109
+	return apply_filters('give_default_form_amount', $default_amount);
110 110
 
111 111
 }
112 112
 
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
  *
125 125
  * @return bool
126 126
  */
127
-function give_is_custom_price_mode( $form_id = 0 ) {
127
+function give_is_custom_price_mode($form_id = 0) {
128 128
 
129
-	if ( empty( $form_id ) ) {
129
+	if (empty($form_id)) {
130 130
 		return false;
131 131
 	}
132 132
 
133
-	$form = new Give_Donate_Form( $form_id );
133
+	$form = new Give_Donate_Form($form_id);
134 134
 
135 135
 	return $form->is_custom_price_mode();
136 136
 }
137 137
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-roles.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @access public
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 );
38
+		add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4);
39 39
 	}
40 40
 
41 41
 	/**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @return void
50 50
 	 */
51 51
 	public function add_roles() {
52
-		add_role( 'give_manager', esc_html__( 'Give Manager', 'give' ), array(
52
+		add_role('give_manager', esc_html__('Give Manager', 'give'), array(
53 53
 			'read'                   => true,
54 54
 			'edit_posts'             => true,
55 55
 			'delete_posts'           => true,
@@ -78,20 +78,20 @@  discard block
 block discarded – undo
78 78
 			'publish_posts'          => true,
79 79
 			'read_private_pages'     => true,
80 80
 			'read_private_posts'     => true
81
-		) );
81
+		));
82 82
 
83
-		add_role( 'give_accountant', esc_html__( 'Give Accountant', 'give' ), array(
83
+		add_role('give_accountant', esc_html__('Give Accountant', 'give'), array(
84 84
 			'read'         => true,
85 85
 			'edit_posts'   => false,
86 86
 			'delete_posts' => false
87
-		) );
87
+		));
88 88
 
89
-		add_role( 'give_worker', esc_html__( 'Give Worker', 'give' ), array(
89
+		add_role('give_worker', esc_html__('Give Worker', 'give'), array(
90 90
 			'read'         => true,
91 91
 			'edit_posts'   => false,
92 92
 			'upload_files' => true,
93 93
 			'delete_posts' => false
94
-		) );
94
+		));
95 95
 
96 96
 	}
97 97
 
@@ -110,38 +110,38 @@  discard block
 block discarded – undo
110 110
 	public function add_caps() {
111 111
 		global $wp_roles;
112 112
 
113
-		if ( class_exists( 'WP_Roles' ) ) {
114
-			if ( ! isset( $wp_roles ) ) {
113
+		if (class_exists('WP_Roles')) {
114
+			if ( ! isset($wp_roles)) {
115 115
 				$wp_roles = new WP_Roles();
116 116
 			}
117 117
 		}
118 118
 
119
-		if ( is_object( $wp_roles ) ) {
120
-			$wp_roles->add_cap( 'give_manager', 'view_give_reports' );
121
-			$wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' );
122
-			$wp_roles->add_cap( 'give_manager', 'export_give_reports' );
123
-			$wp_roles->add_cap( 'give_manager', 'manage_give_settings' );
119
+		if (is_object($wp_roles)) {
120
+			$wp_roles->add_cap('give_manager', 'view_give_reports');
121
+			$wp_roles->add_cap('give_manager', 'view_give_sensitive_data');
122
+			$wp_roles->add_cap('give_manager', 'export_give_reports');
123
+			$wp_roles->add_cap('give_manager', 'manage_give_settings');
124 124
 
125
-			$wp_roles->add_cap( 'administrator', 'view_give_reports' );
126
-			$wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' );
127
-			$wp_roles->add_cap( 'administrator', 'export_give_reports' );
128
-			$wp_roles->add_cap( 'administrator', 'manage_give_settings' );
125
+			$wp_roles->add_cap('administrator', 'view_give_reports');
126
+			$wp_roles->add_cap('administrator', 'view_give_sensitive_data');
127
+			$wp_roles->add_cap('administrator', 'export_give_reports');
128
+			$wp_roles->add_cap('administrator', 'manage_give_settings');
129 129
 
130 130
 			// Add the main post type capabilities.
131 131
 			$capabilities = $this->get_core_caps();
132
-			foreach ( $capabilities as $cap_group ) {
133
-				foreach ( $cap_group as $cap ) {
134
-					$wp_roles->add_cap( 'administrator', $cap );
135
-					$wp_roles->add_cap( 'give_manager', $cap );
136
-					$wp_roles->add_cap( 'give_worker', $cap );
132
+			foreach ($capabilities as $cap_group) {
133
+				foreach ($cap_group as $cap) {
134
+					$wp_roles->add_cap('administrator', $cap);
135
+					$wp_roles->add_cap('give_manager', $cap);
136
+					$wp_roles->add_cap('give_worker', $cap);
137 137
 				}
138 138
 			}
139 139
 
140
-			$wp_roles->add_cap( 'give_accountant', 'edit_give_forms' );
141
-			$wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' );
142
-			$wp_roles->add_cap( 'give_accountant', 'view_give_reports' );
143
-			$wp_roles->add_cap( 'give_accountant', 'export_give_reports' );
144
-			$wp_roles->add_cap( 'give_accountant', 'edit_give_payments' );
140
+			$wp_roles->add_cap('give_accountant', 'edit_give_forms');
141
+			$wp_roles->add_cap('give_accountant', 'read_private_give_forms');
142
+			$wp_roles->add_cap('give_accountant', 'view_give_reports');
143
+			$wp_roles->add_cap('give_accountant', 'export_give_reports');
144
+			$wp_roles->add_cap('give_accountant', 'edit_give_payments');
145 145
 
146 146
 		}
147 147
 	}
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
 	public function get_core_caps() {
160 160
 		$capabilities = array();
161 161
 
162
-		$capability_types = array( 'give_form', 'give_payment' );
162
+		$capability_types = array('give_form', 'give_payment');
163 163
 
164
-		foreach ( $capability_types as $capability_type ) {
165
-			$capabilities[ $capability_type ] = array(
164
+		foreach ($capability_types as $capability_type) {
165
+			$capabilities[$capability_type] = array(
166 166
 				// Post type.
167 167
 				"edit_{$capability_type}",
168 168
 				"read_{$capability_type}",
@@ -208,22 +208,22 @@  discard block
 block discarded – undo
208 208
 	 *
209 209
 	 * @return array  $caps    Meta capabilities.
210 210
 	 */
211
-	public function meta_caps( $caps, $cap, $user_id, $args ) {
211
+	public function meta_caps($caps, $cap, $user_id, $args) {
212 212
 
213
-		switch ( $cap ) {
213
+		switch ($cap) {
214 214
 
215 215
 			case 'view_give_form_stats' :
216 216
 
217
-				if ( empty( $args[0] ) ) {
217
+				if (empty($args[0])) {
218 218
 					break;
219 219
 				}
220 220
 
221
-				$form = get_post( $args[0] );
222
-				if ( empty( $form ) ) {
221
+				$form = get_post($args[0]);
222
+				if (empty($form)) {
223 223
 					break;
224 224
 				}
225 225
 
226
-				if ( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) {
226
+				if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) {
227 227
 					$caps = array();
228 228
 				}
229 229
 
@@ -250,41 +250,41 @@  discard block
 block discarded – undo
250 250
 
251 251
 		global $wp_roles;
252 252
 
253
-		if ( class_exists( 'WP_Roles' ) ) {
254
-			if ( ! isset( $wp_roles ) ) {
253
+		if (class_exists('WP_Roles')) {
254
+			if ( ! isset($wp_roles)) {
255 255
 				$wp_roles = new WP_Roles();
256 256
 			}
257 257
 		}
258 258
 
259
-		if ( is_object( $wp_roles ) ) {
259
+		if (is_object($wp_roles)) {
260 260
 			// Give Manager Capabilities.
261
-			$wp_roles->remove_cap( 'give_manager', 'view_give_reports' );
262
-			$wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' );
263
-			$wp_roles->remove_cap( 'give_manager', 'export_give_reports' );
264
-			$wp_roles->remove_cap( 'give_manager', 'manage_give_settings' );
261
+			$wp_roles->remove_cap('give_manager', 'view_give_reports');
262
+			$wp_roles->remove_cap('give_manager', 'view_give_sensitive_data');
263
+			$wp_roles->remove_cap('give_manager', 'export_give_reports');
264
+			$wp_roles->remove_cap('give_manager', 'manage_give_settings');
265 265
 
266 266
 			// Site Administrator Capabilities.
267
-			$wp_roles->remove_cap( 'administrator', 'view_give_reports' );
268
-			$wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' );
269
-			$wp_roles->remove_cap( 'administrator', 'export_give_reports' );
270
-			$wp_roles->remove_cap( 'administrator', 'manage_give_settings' );
267
+			$wp_roles->remove_cap('administrator', 'view_give_reports');
268
+			$wp_roles->remove_cap('administrator', 'view_give_sensitive_data');
269
+			$wp_roles->remove_cap('administrator', 'export_give_reports');
270
+			$wp_roles->remove_cap('administrator', 'manage_give_settings');
271 271
 
272 272
 			// Remove the Main Post Type Capabilities.
273 273
 			$capabilities = $this->get_core_caps();
274 274
 
275
-			foreach ( $capabilities as $cap_group ) {
276
-				foreach ( $cap_group as $cap ) {
277
-					$wp_roles->remove_cap( 'give_manager', $cap );
278
-					$wp_roles->remove_cap( 'administrator', $cap );
279
-					$wp_roles->remove_cap( 'give_worker', $cap );
275
+			foreach ($capabilities as $cap_group) {
276
+				foreach ($cap_group as $cap) {
277
+					$wp_roles->remove_cap('give_manager', $cap);
278
+					$wp_roles->remove_cap('administrator', $cap);
279
+					$wp_roles->remove_cap('give_worker', $cap);
280 280
 				}
281 281
 			}
282 282
 
283 283
 			/** Give Accountant Capabilities */
284
-			$wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' );
285
-			$wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' );
286
-			$wp_roles->remove_cap( 'give_accountant', 'view_give_reports' );
287
-			$wp_roles->remove_cap( 'give_accountant', 'export_give_reports' );
284
+			$wp_roles->remove_cap('give_accountant', 'edit_give_forms');
285
+			$wp_roles->remove_cap('give_accountant', 'read_private_give_forms');
286
+			$wp_roles->remove_cap('give_accountant', 'view_give_reports');
287
+			$wp_roles->remove_cap('give_accountant', 'export_give_reports');
288 288
 
289 289
 		}
290 290
 	}
Please login to merge, or discard this patch.
includes/admin/give-metabox-functions.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1283,7 +1283,7 @@
 block discarded – undo
1283 1283
  *
1284 1284
  * @param $field
1285 1285
  *
1286
- * @return string
1286
+ * @return integer
1287 1287
  */
1288 1288
 function _give_set_field_give_id_default_value( $field ) {
1289 1289
 	return 0;
Please login to merge, or discard this patch.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -645,20 +645,20 @@
 block discarded – undo
645 645
 }
646 646
 
647 647
 /**
648
-  * Output the documentation link.
649
-  *
650
-  * @since  1.8
651
-  * @param  array $field {
652
-  *     Optional. Array of customizable link attributes.
653
-  *
654
-  *     @type string             $name            Name of input field. Default ''.
655
-  *     @type string             $type            Type of input field. Default 'text'.
656
-  *     @type string             $url             Value to be passed as a link. Default 'https://givewp.com/documentation'.
657
-  *     @type string             $title           Value to be passed as text of link. Default 'Documentation'.
658
-  *     @type array              $attributes      List of attributes of input field. Default array().
659
-  *                                               for example: 'attributes' => array( 'placeholder' => '*****', 'class' => '****' )
660
-  * }
661
-  * @return void
648
+ * Output the documentation link.
649
+ *
650
+ * @since  1.8
651
+ * @param  array $field {
652
+ *     Optional. Array of customizable link attributes.
653
+ *
654
+ *     @type string             $name            Name of input field. Default ''.
655
+ *     @type string             $type            Type of input field. Default 'text'.
656
+ *     @type string             $url             Value to be passed as a link. Default 'https://givewp.com/documentation'.
657
+ *     @type string             $title           Value to be passed as text of link. Default 'Documentation'.
658
+ *     @type array              $attributes      List of attributes of input field. Default array().
659
+ *                                               for example: 'attributes' => array( 'placeholder' => '*****', 'class' => '****' )
660
+ * }
661
+ * @return void
662 662
 */
663 663
 
664 664
 function give_docs_link($field) {
Please login to merge, or discard this patch.
Spacing   +297 added lines, -297 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 9
  * @since       1.8
10 10
  */
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit; // Exit if accessed directly
13 13
 }
14 14
 
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
  *
23 23
  * @return bool|string
24 24
  */
25
-function give_is_field_callback_exist( $field ) {
26
-	return ( give_get_field_callback( $field ) ? true : false );
25
+function give_is_field_callback_exist($field) {
26
+	return (give_get_field_callback($field) ? true : false);
27 27
 }
28 28
 
29 29
 /**
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
  *
36 36
  * @return bool|string
37 37
  */
38
-function give_get_field_callback( $field ) {
38
+function give_get_field_callback($field) {
39 39
 	$func_name_prefix = 'give';
40 40
 	$func_name        = '';
41 41
 
42 42
 	// Set callback function on basis of cmb2 field name.
43
-	switch ( $field['type'] ) {
43
+	switch ($field['type']) {
44 44
 		case 'radio_inline':
45 45
 			$func_name = "{$func_name_prefix}_radio";
46 46
 			break;
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 		default:
78 78
 
79 79
 			if (
80
-				array_key_exists( 'callback', $field )
81
-				&& ! empty( $field['callback'] )
80
+				array_key_exists('callback', $field)
81
+				&& ! empty($field['callback'])
82 82
 			) {
83 83
 				$func_name = $field['callback'];
84 84
 			} else {
@@ -91,15 +91,15 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @since 1.8
93 93
 	 */
94
-	$func_name = apply_filters( 'give_get_field_callback', $func_name, $field );
94
+	$func_name = apply_filters('give_get_field_callback', $func_name, $field);
95 95
 
96 96
 	// Exit if not any function exist.
97 97
 	// Check if render callback exist or not.
98
-	if ( empty( $func_name ) ) {
98
+	if (empty($func_name)) {
99 99
 		return false;
100
-	} elseif ( is_string( $func_name ) && ! function_exists( "$func_name" ) ) {
100
+	} elseif (is_string($func_name) && ! function_exists("$func_name")) {
101 101
 		return false;
102
-	} elseif ( is_array( $func_name ) && ! method_exists( $func_name[0], "$func_name[1]" ) ) {
102
+	} elseif (is_array($func_name) && ! method_exists($func_name[0], "$func_name[1]")) {
103 103
 		return false;
104 104
 	}
105 105
 
@@ -115,36 +115,36 @@  discard block
 block discarded – undo
115 115
  *
116 116
  * @return bool
117 117
  */
118
-function give_render_field( $field ) {
118
+function give_render_field($field) {
119 119
 
120 120
 	// Check if render callback exist or not.
121
-	if ( ! ( $func_name = give_get_field_callback( $field ) ) ) {
121
+	if ( ! ($func_name = give_get_field_callback($field))) {
122 122
 		return false;
123 123
 	}
124 124
 
125 125
 	// CMB2 compatibility: Push all classes to attributes's class key
126
-	if ( empty( $field['class'] ) ) {
126
+	if (empty($field['class'])) {
127 127
 		$field['class'] = '';
128 128
 	}
129 129
 
130
-	if ( empty( $field['attributes']['class'] ) ) {
130
+	if (empty($field['attributes']['class'])) {
131 131
 		$field['attributes']['class'] = '';
132 132
 	}
133 133
 
134
-	$field['attributes']['class'] = trim( "give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}" );
135
-	unset( $field['class'] );
134
+	$field['attributes']['class'] = trim("give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}");
135
+	unset($field['class']);
136 136
 
137 137
 
138 138
 	// CMB2 compatibility: Set wrapper class if any.
139
-	if ( ! empty( $field['row_classes'] ) ) {
139
+	if ( ! empty($field['row_classes'])) {
140 140
 		$field['wrapper_class'] = $field['row_classes'];
141
-		unset( $field['row_classes'] );
141
+		unset($field['row_classes']);
142 142
 	}
143 143
 
144 144
 	// Set field params on basis of cmb2 field name.
145
-	switch ( $field['type'] ) {
145
+	switch ($field['type']) {
146 146
 		case 'radio_inline':
147
-			if ( empty( $field['wrapper_class'] ) ) {
147
+			if (empty($field['wrapper_class'])) {
148 148
 				$field['wrapper_class'] = '';
149 149
 			}
150 150
 			$field['wrapper_class'] .= ' give-inline-radio-fields';
@@ -157,15 +157,15 @@  discard block
 block discarded – undo
157 157
 		case 'text-small' :
158 158
 		case 'text_small' :
159 159
 			// CMB2 compatibility: Set field type to text.
160
-			$field['type'] = isset( $field['attributes']['type'] ) ? $field['attributes']['type'] : 'text';
160
+			$field['type'] = isset($field['attributes']['type']) ? $field['attributes']['type'] : 'text';
161 161
 
162 162
 			// CMB2 compatibility: Set data type to price.
163 163
 			if (
164
-				empty( $field['data_type'] )
165
-				&& ! empty( $field['attributes']['class'] )
164
+				empty($field['data_type'])
165
+				&& ! empty($field['attributes']['class'])
166 166
 				&& (
167
-					false !== strpos( $field['attributes']['class'], 'money' )
168
-					|| false !== strpos( $field['attributes']['class'], 'amount' )
167
+					false !== strpos($field['attributes']['class'], 'money')
168
+					|| false !== strpos($field['attributes']['class'], 'amount')
169 169
 				)
170 170
 			) {
171 171
 				$field['data_type'] = 'decimal';
@@ -184,22 +184,22 @@  discard block
 block discarded – undo
184 184
 		case 'give_default_radio_inline':
185 185
 			$field['type']    = 'radio';
186 186
 			$field['options'] = array(
187
-				'default' => __( 'Default' ),
187
+				'default' => __('Default'),
188 188
 			);
189 189
 			break;
190 190
 	}
191 191
 
192 192
 	// CMB2 compatibility: Add support to define field description by desc & description param.
193 193
 	// We encourage you to use description param.
194
-	$field['description'] = ( ! empty( $field['description'] )
194
+	$field['description'] = ( ! empty($field['description'])
195 195
 		? $field['description']
196
-		: ( ! empty( $field['desc'] ) ? $field['desc'] : '' ) );
196
+		: ( ! empty($field['desc']) ? $field['desc'] : ''));
197 197
 
198 198
 	// Call render function.
199
-	if ( is_array( $func_name ) ) {
200
-		$func_name[0]->$func_name[1]( $field );
199
+	if (is_array($func_name)) {
200
+		$func_name[0]->$func_name[1]($field);
201 201
 	} else {
202
-		$func_name( $field );
202
+		$func_name($field);
203 203
 	}
204 204
 
205 205
 	return true;
@@ -227,29 +227,29 @@  discard block
 block discarded – undo
227 227
  * }
228 228
  * @return void
229 229
  */
230
-function give_text_input( $field ) {
230
+function give_text_input($field) {
231 231
 	global $thepostid, $post;
232 232
 
233
-	$thepostid              = empty( $thepostid ) ? $post->ID : $thepostid;
234
-	$field['style']         = isset( $field['style'] ) ? $field['style'] : '';
235
-	$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
236
-	$field['value']         = give_get_field_value( $field, $thepostid );
237
-	$field['type']          = isset( $field['type'] ) ? $field['type'] : 'text';
233
+	$thepostid              = empty($thepostid) ? $post->ID : $thepostid;
234
+	$field['style']         = isset($field['style']) ? $field['style'] : '';
235
+	$field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
236
+	$field['value']         = give_get_field_value($field, $thepostid);
237
+	$field['type']          = isset($field['type']) ? $field['type'] : 'text';
238 238
 	$field['before_field']  = '';
239 239
 	$field['after_field']   = '';
240
-	$data_type              = empty( $field['data_type'] ) ? '' : $field['data_type'];
240
+	$data_type              = empty($field['data_type']) ? '' : $field['data_type'];
241 241
 
242
-	switch ( $data_type ) {
242
+	switch ($data_type) {
243 243
 		case 'price' :
244
-			$field['value'] = ( ! empty( $field['value'] ) ? give_format_amount( $field['value'] ) : $field['value'] );
244
+			$field['value'] = ( ! empty($field['value']) ? give_format_amount($field['value']) : $field['value']);
245 245
 
246
-			$field['before_field'] = ! empty( $field['before_field'] ) ? $field['before_field'] : ( give_get_option( 'currency_position', 'before' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' );
247
-			$field['after_field']  = ! empty( $field['after_field'] ) ? $field['after_field'] : ( give_get_option( 'currency_position', 'before' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' );
246
+			$field['before_field'] = ! empty($field['before_field']) ? $field['before_field'] : (give_get_option('currency_position', 'before') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '');
247
+			$field['after_field']  = ! empty($field['after_field']) ? $field['after_field'] : (give_get_option('currency_position', 'before') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '');
248 248
 			break;
249 249
 
250 250
 		case 'decimal' :
251 251
 			$field['attributes']['class'] .= ' give_input_decimal';
252
-			$field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( $field['value'] ) : $field['value'] );
252
+			$field['value'] = ( ! empty($field['value']) ? give_format_decimal($field['value']) : $field['value']);
253 253
 			break;
254 254
 
255 255
 		default :
@@ -257,20 +257,20 @@  discard block
 block discarded – undo
257 257
 	}
258 258
 
259 259
 	?>
260
-	<p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">
261
-		<label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>
260
+	<p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">
261
+		<label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label>
262 262
 		<?php echo $field['before_field']; ?>
263 263
 		<input
264
-			type="<?php echo esc_attr( $field['type'] ); ?>"
265
-			style="<?php echo esc_attr( $field['style'] ); ?>"
266
-			name="<?php echo give_get_field_name( $field ); ?>"
267
-			id="<?php echo esc_attr( $field['id'] ); ?>"
268
-			value="<?php echo esc_attr( $field['value'] ); ?>"
269
-			<?php echo give_get_custom_attributes( $field ); ?>
264
+			type="<?php echo esc_attr($field['type']); ?>"
265
+			style="<?php echo esc_attr($field['style']); ?>"
266
+			name="<?php echo give_get_field_name($field); ?>"
267
+			id="<?php echo esc_attr($field['id']); ?>"
268
+			value="<?php echo esc_attr($field['value']); ?>"
269
+			<?php echo give_get_custom_attributes($field); ?>
270 270
 		/>
271 271
 		<?php echo $field['after_field']; ?>
272 272
 	<?php
273
-	echo give_get_field_description( $field );
273
+	echo give_get_field_description($field);
274 274
 	echo '</p>';
275 275
 }
276 276
 
@@ -290,29 +290,29 @@  discard block
 block discarded – undo
290 290
  * }
291 291
  * @return void
292 292
  */
293
-function give_hidden_input( $field ) {
293
+function give_hidden_input($field) {
294 294
 	global $thepostid, $post;
295 295
 
296
-	$thepostid      = empty( $thepostid ) ? $post->ID : $thepostid;
297
-	$field['value'] = give_get_field_value( $field, $thepostid );
296
+	$thepostid      = empty($thepostid) ? $post->ID : $thepostid;
297
+	$field['value'] = give_get_field_value($field, $thepostid);
298 298
 
299 299
 	// Custom attribute handling
300 300
 	$custom_attributes = array();
301 301
 
302
-	if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) {
302
+	if ( ! empty($field['attributes']) && is_array($field['attributes'])) {
303 303
 
304
-		foreach ( $field['attributes'] as $attribute => $value ) {
305
-			$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"';
304
+		foreach ($field['attributes'] as $attribute => $value) {
305
+			$custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"';
306 306
 		}
307 307
 	}
308 308
 	?>
309 309
 
310 310
 	<input
311 311
 		type="hidden"
312
-		name="<?php echo give_get_field_name( $field ); ?>"
313
-		id="<?php echo esc_attr( $field['id'] ); ?>"
314
-		value="<?php echo esc_attr( $field['value'] ); ?>"
315
-		<?php echo give_get_custom_attributes( $field ); ?>
312
+		name="<?php echo give_get_field_name($field); ?>"
313
+		id="<?php echo esc_attr($field['id']); ?>"
314
+		value="<?php echo esc_attr($field['value']); ?>"
315
+		<?php echo give_get_custom_attributes($field); ?>
316 316
 	/>
317 317
 	<?php
318 318
 }
@@ -336,27 +336,27 @@  discard block
 block discarded – undo
336 336
  * }
337 337
  * @return void
338 338
  */
339
-function give_textarea_input( $field ) {
339
+function give_textarea_input($field) {
340 340
 	global $thepostid, $post;
341 341
 
342
-	$thepostid              = empty( $thepostid ) ? $post->ID : $thepostid;
343
-	$field['style']         = isset( $field['style'] ) ? $field['style'] : '';
344
-	$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
345
-	$field['value']         = give_get_field_value( $field, $thepostid );
342
+	$thepostid              = empty($thepostid) ? $post->ID : $thepostid;
343
+	$field['style']         = isset($field['style']) ? $field['style'] : '';
344
+	$field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
345
+	$field['value']         = give_get_field_value($field, $thepostid);
346 346
 
347 347
 	?>
348
-	<p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">
349
-		<label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>
348
+	<p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">
349
+		<label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label>
350 350
 		<textarea
351
-			style="<?php echo esc_attr( $field['style'] ); ?>"
352
-			name="<?php echo give_get_field_name( $field ); ?>"
353
-			id="<?php echo esc_attr( $field['id'] ); ?>"
351
+			style="<?php echo esc_attr($field['style']); ?>"
352
+			name="<?php echo give_get_field_name($field); ?>"
353
+			id="<?php echo esc_attr($field['id']); ?>"
354 354
 			rows="10"
355 355
 			cols="20"
356
-			<?php echo give_get_custom_attributes( $field ); ?>
357
-		><?php echo esc_textarea( $field['value'] ); ?></textarea>
356
+			<?php echo give_get_custom_attributes($field); ?>
357
+		><?php echo esc_textarea($field['value']); ?></textarea>
358 358
 	<?php
359
-	echo give_get_field_description( $field );
359
+	echo give_get_field_description($field);
360 360
 	echo '</p>';
361 361
 }
362 362
 
@@ -378,24 +378,24 @@  discard block
 block discarded – undo
378 378
  * }
379 379
  * @return void
380 380
  */
381
-function give_wysiwyg( $field ) {
381
+function give_wysiwyg($field) {
382 382
 	global $thepostid, $post;
383 383
 
384
-	$thepostid                = empty( $thepostid ) ? $post->ID : $thepostid;
385
-	$field['style']           = isset( $field['style'] ) ? $field['style'] : '';
386
-	$field['wrapper_class']   = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
387
-	$field['value']           = give_get_field_value( $field, $thepostid );
388
-	$field['unique_field_id'] = give_get_field_name( $field );
384
+	$thepostid                = empty($thepostid) ? $post->ID : $thepostid;
385
+	$field['style']           = isset($field['style']) ? $field['style'] : '';
386
+	$field['wrapper_class']   = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
387
+	$field['value']           = give_get_field_value($field, $thepostid);
388
+	$field['unique_field_id'] = give_get_field_name($field);
389 389
 	$editor_attributes        = array(
390
-		'textarea_name' => isset( $field['repeatable_field_id'] ) ? $field['repeatable_field_id'] : $field['id'],
390
+		'textarea_name' => isset($field['repeatable_field_id']) ? $field['repeatable_field_id'] : $field['id'],
391 391
 		'textarea_rows' => '10',
392
-		'editor_css'    => esc_attr( $field['style'] ),
392
+		'editor_css'    => esc_attr($field['style']),
393 393
 		'editor_class'  => $field['attributes']['class']
394 394
 	);
395
-	$data_wp_editor           = ' data-wp-editor="'. base64_encode( json_encode( array( $field['value'], $field['unique_field_id'],$editor_attributes ) ) ) .'"';
396
-	$data_wp_editor           = isset( $field['repeatable_field_id'] ) ? $data_wp_editor : '';
395
+	$data_wp_editor           = ' data-wp-editor="'.base64_encode(json_encode(array($field['value'], $field['unique_field_id'], $editor_attributes))).'"';
396
+	$data_wp_editor           = isset($field['repeatable_field_id']) ? $data_wp_editor : '';
397 397
 
398
-	echo '<div class="give-field-wrap ' . $field['unique_field_id'] . '_field ' . esc_attr( $field['wrapper_class'] ) . '"'.$data_wp_editor.'><label for="' . $field['unique_field_id'] . '">' . wp_kses_post( $field['name'] ) . '</label>';
398
+	echo '<div class="give-field-wrap '.$field['unique_field_id'].'_field '.esc_attr($field['wrapper_class']).'"'.$data_wp_editor.'><label for="'.$field['unique_field_id'].'">'.wp_kses_post($field['name']).'</label>';
399 399
 
400 400
 	wp_editor(
401 401
 		$field['value'],
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		$editor_attributes
404 404
 	);
405 405
 
406
-	echo give_get_field_description( $field );
406
+	echo give_get_field_description($field);
407 407
 	echo '</div>';
408 408
 }
409 409
 
@@ -426,29 +426,29 @@  discard block
 block discarded – undo
426 426
  * }
427 427
  * @return void
428 428
  */
429
-function give_checkbox( $field ) {
429
+function give_checkbox($field) {
430 430
 	global $thepostid, $post;
431 431
 
432
-	$thepostid              = empty( $thepostid ) ? $post->ID : $thepostid;
433
-	$field['style']         = isset( $field['style'] ) ? $field['style'] : '';
434
-	$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
435
-	$field['value']         = give_get_field_value( $field, $thepostid );
436
-	$field['cbvalue']       = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'on';
437
-	$field['name']          = isset( $field['name'] ) ? $field['name'] : $field['id'];
432
+	$thepostid              = empty($thepostid) ? $post->ID : $thepostid;
433
+	$field['style']         = isset($field['style']) ? $field['style'] : '';
434
+	$field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
435
+	$field['value']         = give_get_field_value($field, $thepostid);
436
+	$field['cbvalue']       = isset($field['cbvalue']) ? $field['cbvalue'] : 'on';
437
+	$field['name']          = isset($field['name']) ? $field['name'] : $field['id'];
438 438
 	?>
439
-	<p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">
440
-		<label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>
439
+	<p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">
440
+		<label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label>
441 441
 		<input
442 442
 			type="checkbox"
443
-			style="<?php echo esc_attr( $field['style'] ); ?>"
444
-			name="<?php echo give_get_field_name( $field ); ?>"
445
-			id="<?php echo esc_attr( $field['id'] ); ?>"
446
-			value="<?php echo esc_attr( $field['cbvalue'] ); ?>"
447
-			<?php echo checked( $field['value'], $field['cbvalue'], false ); ?>
448
-			<?php echo give_get_custom_attributes( $field ); ?>
443
+			style="<?php echo esc_attr($field['style']); ?>"
444
+			name="<?php echo give_get_field_name($field); ?>"
445
+			id="<?php echo esc_attr($field['id']); ?>"
446
+			value="<?php echo esc_attr($field['cbvalue']); ?>"
447
+			<?php echo checked($field['value'], $field['cbvalue'], false); ?>
448
+			<?php echo give_get_custom_attributes($field); ?>
449 449
 		/>
450 450
 	<?php
451
-	echo give_get_field_description( $field );
451
+	echo give_get_field_description($field);
452 452
 	echo '</p>';
453 453
 }
454 454
 
@@ -472,29 +472,29 @@  discard block
 block discarded – undo
472 472
  * }
473 473
  * @return void
474 474
  */
475
-function give_select( $field ) {
475
+function give_select($field) {
476 476
 	global $thepostid, $post;
477 477
 
478
-	$thepostid              = empty( $thepostid ) ? $post->ID : $thepostid;
479
-	$field['style']         = isset( $field['style'] ) ? $field['style'] : '';
480
-	$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
481
-	$field['value']         = give_get_field_value( $field, $thepostid );
482
-	$field['name']          = isset( $field['name'] ) ? $field['name'] : $field['id'];
478
+	$thepostid              = empty($thepostid) ? $post->ID : $thepostid;
479
+	$field['style']         = isset($field['style']) ? $field['style'] : '';
480
+	$field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
481
+	$field['value']         = give_get_field_value($field, $thepostid);
482
+	$field['name']          = isset($field['name']) ? $field['name'] : $field['id'];
483 483
 	?>
484
-	<p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">
485
-		<label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>
484
+	<p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">
485
+		<label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label>
486 486
 		<select
487
-			id="<?php echo esc_attr( $field['id'] ); ?>"
488
-			name="<?php echo give_get_field_name( $field ); ?>"
489
-			style="<?php echo esc_attr( $field['style'] ) ?>"
490
-			<?php echo give_get_custom_attributes( $field ); ?>
487
+			id="<?php echo esc_attr($field['id']); ?>"
488
+			name="<?php echo give_get_field_name($field); ?>"
489
+			style="<?php echo esc_attr($field['style']) ?>"
490
+			<?php echo give_get_custom_attributes($field); ?>
491 491
 		>
492 492
 	<?php
493
-	foreach ( $field['options'] as $key => $value ) {
494
-		echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>';
493
+	foreach ($field['options'] as $key => $value) {
494
+		echo '<option value="'.esc_attr($key).'" '.selected(esc_attr($field['value']), esc_attr($key), false).'>'.esc_html($value).'</option>';
495 495
 	}
496 496
 	echo '</select>';
497
-	echo give_get_field_description( $field );
497
+	echo give_get_field_description($field);
498 498
 	echo '</p>';
499 499
 }
500 500
 
@@ -518,32 +518,32 @@  discard block
 block discarded – undo
518 518
  * }
519 519
  * @return void
520 520
  */
521
-function give_radio( $field ) {
521
+function give_radio($field) {
522 522
 	global $thepostid, $post;
523 523
 
524
-	$thepostid              = empty( $thepostid ) ? $post->ID : $thepostid;
525
-	$field['style']         = isset( $field['style'] ) ? $field['style'] : '';
526
-	$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
527
-	$field['value']         = give_get_field_value( $field, $thepostid );
528
-	$field['name']          = isset( $field['name'] ) ? $field['name'] : $field['id'];
524
+	$thepostid              = empty($thepostid) ? $post->ID : $thepostid;
525
+	$field['style']         = isset($field['style']) ? $field['style'] : '';
526
+	$field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
527
+	$field['value']         = give_get_field_value($field, $thepostid);
528
+	$field['name']          = isset($field['name']) ? $field['name'] : $field['id'];
529 529
 
530
-	echo '<fieldset class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><span class="give-field-label">' . wp_kses_post( $field['name'] ) . '</span><legend class="screen-reader-text">' . wp_kses_post( $field['name'] ) . '</legend><ul class="give-radios">';
530
+	echo '<fieldset class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><span class="give-field-label">'.wp_kses_post($field['name']).'</span><legend class="screen-reader-text">'.wp_kses_post($field['name']).'</legend><ul class="give-radios">';
531 531
 
532
-	foreach ( $field['options'] as $key => $value ) {
532
+	foreach ($field['options'] as $key => $value) {
533 533
 
534 534
 		echo '<li><label><input
535
-				name="' . give_get_field_name( $field ) . '"
536
-				value="' . esc_attr( $key ) . '"
535
+				name="' . give_get_field_name($field).'"
536
+				value="' . esc_attr($key).'"
537 537
 				type="radio"
538
-				style="' . esc_attr( $field['style'] ) . '"
539
-				' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' '
540
-				. give_get_custom_attributes( $field ) . '
541
-				/> ' . esc_html( $value ) . '</label>
538
+				style="' . esc_attr($field['style']).'"
539
+				' . checked(esc_attr($field['value']), esc_attr($key), false).' '
540
+				. give_get_custom_attributes($field).'
541
+				/> ' . esc_html($value).'</label>
542 542
 		</li>';
543 543
 	}
544 544
 	echo '</ul>';
545 545
 
546
-	echo give_get_field_description( $field );
546
+	echo give_get_field_description($field);
547 547
 	echo '</fieldset>';
548 548
 }
549 549
 
@@ -565,27 +565,27 @@  discard block
 block discarded – undo
565 565
  * }
566 566
  * @return void
567 567
  */
568
-function give_colorpicker( $field ) {
568
+function give_colorpicker($field) {
569 569
 	global $thepostid, $post;
570 570
 
571
-	$thepostid              = empty( $thepostid ) ? $post->ID : $thepostid;
572
-	$field['style']         = isset( $field['style'] ) ? $field['style'] : '';
573
-	$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
574
-	$field['value']         = give_get_field_value( $field, $thepostid );
575
-	$field['name']          = isset( $field['name'] ) ? $field['name'] : $field['id'];
571
+	$thepostid              = empty($thepostid) ? $post->ID : $thepostid;
572
+	$field['style']         = isset($field['style']) ? $field['style'] : '';
573
+	$field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
574
+	$field['value']         = give_get_field_value($field, $thepostid);
575
+	$field['name']          = isset($field['name']) ? $field['name'] : $field['id'];
576 576
 	$field['type']          = 'text';
577 577
 	?>
578
-	<p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">
579
-		<label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>
578
+	<p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">
579
+		<label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label>
580 580
 		<input
581
-			type="<?php echo esc_attr( $field['type'] ); ?>"
582
-			style="<?php echo esc_attr( $field['style'] ); ?>"
583
-			name="<?php echo give_get_field_name( $field ); ?>"
584
-			id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr( $field['value'] ); ?>"
585
-			<?php echo give_get_custom_attributes( $field ); ?>
581
+			type="<?php echo esc_attr($field['type']); ?>"
582
+			style="<?php echo esc_attr($field['style']); ?>"
583
+			name="<?php echo give_get_field_name($field); ?>"
584
+			id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr($field['value']); ?>"
585
+			<?php echo give_get_custom_attributes($field); ?>
586 586
 		/>
587 587
 	<?php
588
-	echo give_get_field_description( $field );
588
+	echo give_get_field_description($field);
589 589
 	echo '</p>';
590 590
 }
591 591
 
@@ -598,32 +598,32 @@  discard block
 block discarded – undo
598 598
  * @param array $field
599 599
  *
600 600
  */
601
-function give_media( $field ) {
601
+function give_media($field) {
602 602
 	global $thepostid, $post;
603 603
 
604
-	$thepostid              = empty( $thepostid ) ? $post->ID : $thepostid;
605
-	$field['style']         = isset( $field['style'] ) ? $field['style'] : '';
606
-	$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
607
-	$field['value']         = give_get_field_value( $field, $thepostid );
608
-	$field['name']          = isset( $field['name'] ) ? $field['name'] : $field['id'];
604
+	$thepostid              = empty($thepostid) ? $post->ID : $thepostid;
605
+	$field['style']         = isset($field['style']) ? $field['style'] : '';
606
+	$field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
607
+	$field['value']         = give_get_field_value($field, $thepostid);
608
+	$field['name']          = isset($field['name']) ? $field['name'] : $field['id'];
609 609
 	$field['type']          = 'text';
610 610
 	$field['attributes']['class'] = "{$field['attributes']['class']} give-text-medium";
611 611
 
612 612
 	// Allow developer to save attachment ID or attachment url as metadata.
613
-	$field['fvalue']        = isset( $field['fvalue'] ) ? $field['fvalue'] : 'url';
613
+	$field['fvalue'] = isset($field['fvalue']) ? $field['fvalue'] : 'url';
614 614
 	?>
615
-	<p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">
616
-		<label for="<?php echo give_get_field_name( $field ) ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>
615
+	<p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">
616
+		<label for="<?php echo give_get_field_name($field) ?>"><?php echo wp_kses_post($field['name']); ?></label>
617 617
 		<input
618
-			name="<?php echo give_get_field_name( $field ); ?>"
619
-			id="<?php echo esc_attr( $field['id'] ); ?>"
618
+			name="<?php echo give_get_field_name($field); ?>"
619
+			id="<?php echo esc_attr($field['id']); ?>"
620 620
 			type="text"
621 621
 			value="<?php echo $field['value']; ?>"
622
-			style="<?php echo esc_attr( $field['style'] ); ?>"
622
+			style="<?php echo esc_attr($field['style']); ?>"
623 623
 			data-fvalue="<?php echo $field['fvalue']; ?>"
624
-			<?php echo give_get_custom_attributes( $field ); ?>
625
-		/>&nbsp;&nbsp;&nbsp;&nbsp;<input class="give-media-upload button" type="button" value="<?php echo esc_html__( 'Add or Upload File', 'give' ); ?>">
626
-		<?php echo give_get_field_description( $field ); ?>
624
+			<?php echo give_get_custom_attributes($field); ?>
625
+		/>&nbsp;&nbsp;&nbsp;&nbsp;<input class="give-media-upload button" type="button" value="<?php echo esc_html__('Add or Upload File', 'give'); ?>">
626
+		<?php echo give_get_field_description($field); ?>
627 627
 	</p>
628 628
 	<?php
629 629
 }
@@ -637,27 +637,27 @@  discard block
 block discarded – undo
637 637
  *
638 638
  * @return void
639 639
  */
640
-function give_default_gateway( $field ) {
640
+function give_default_gateway($field) {
641 641
 	global $thepostid, $post;
642 642
 
643 643
 	// get all active payment gateways.
644
-	$gateways         = give_get_enabled_payment_gateways( $thepostid );
644
+	$gateways         = give_get_enabled_payment_gateways($thepostid);
645 645
 	$field['options'] = array();
646 646
 
647 647
 	// Set field option value.
648
-	if( ! empty( $gateways ) ) {
649
-		foreach ( $gateways as $key => $option ) {
650
-			$field['options'][ $key ] = $option['admin_label'];
648
+	if ( ! empty($gateways)) {
649
+		foreach ($gateways as $key => $option) {
650
+			$field['options'][$key] = $option['admin_label'];
651 651
 		}
652 652
 	}
653 653
 
654 654
 	//Add a field to the Give Form admin single post view of this field
655
-	if ( is_object( $post ) && 'give_forms' === $post->post_type ) {
656
-		$field['options'] = array_merge( array( 'global' => esc_html__( 'Global Default', 'give' ) ), $field['options'] );
655
+	if (is_object($post) && 'give_forms' === $post->post_type) {
656
+		$field['options'] = array_merge(array('global' => esc_html__('Global Default', 'give')), $field['options']);
657 657
 	}
658 658
 
659 659
 	// Render select field.
660
-	give_select( $field );
660
+	give_select($field);
661 661
 }
662 662
 
663 663
 /**
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 	$field['url']   = isset($field['url']) ? $field['url'] : 'https://givewp.com/documentation';
682 682
 	$field['title'] = isset($field['title']) ? $field['title'] : 'Documentation';
683 683
 
684
-	echo '<p class="give-docs-link"><a href="' . esc_url($field['url'])
684
+	echo '<p class="give-docs-link"><a href="'.esc_url($field['url'])
685 685
 		. '" target="_blank">'
686 686
 		. sprintf(esc_html__('Need Help? See docs on "%s"'), $field['title'])
687 687
 		. '<span class="dashicons dashicons-editor-help"></span></a></p>';
@@ -699,13 +699,13 @@  discard block
 block discarded – undo
699 699
  *
700 700
  * @return mixed
701 701
  */
702
-function give_get_field_value( $field, $postid ) {
703
-	if ( isset( $field['attributes']['value'] ) ) {
702
+function give_get_field_value($field, $postid) {
703
+	if (isset($field['attributes']['value'])) {
704 704
 		return $field['attributes']['value'];
705 705
 	}
706 706
 
707 707
 	// Get value from db.
708
-	$field_value = get_post_meta( $postid, $field['id'], true );
708
+	$field_value = get_post_meta($postid, $field['id'], true);
709 709
 
710 710
 	/**
711 711
 	 * Filter the field value before apply default value.
@@ -714,11 +714,11 @@  discard block
 block discarded – undo
714 714
 	 *
715 715
 	 * @param mixed $field_value Field value.
716 716
 	 */
717
-	$field_value = apply_filters( "{$field['id']}_field_value", $field_value, $field, $postid );
717
+	$field_value = apply_filters("{$field['id']}_field_value", $field_value, $field, $postid);
718 718
 
719 719
 
720 720
 	// Set default value if no any data saved to db.
721
-	if ( ! $field_value && isset( $field['default'] ) ) {
721
+	if ( ! $field_value && isset($field['default'])) {
722 722
 		$field_value = $field['default'];
723 723
 	}
724 724
 
@@ -734,10 +734,10 @@  discard block
 block discarded – undo
734 734
  *
735 735
  * @return string
736 736
  */
737
-function give_get_field_description( $field ) {
737
+function give_get_field_description($field) {
738 738
 	$field_desc_html = '';
739
-	if ( ! empty( $field['description'] ) ) {
740
-		$field_desc_html = '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>';
739
+	if ( ! empty($field['description'])) {
740
+		$field_desc_html = '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>';
741 741
 	}
742 742
 
743 743
 	return $field_desc_html;
@@ -752,18 +752,18 @@  discard block
 block discarded – undo
752 752
  *
753 753
  * @return string
754 754
  */
755
-function give_get_custom_attributes( $field ) {
755
+function give_get_custom_attributes($field) {
756 756
 	// Custom attribute handling
757 757
 	$custom_attributes = array();
758 758
 
759
-	if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) {
759
+	if ( ! empty($field['attributes']) && is_array($field['attributes'])) {
760 760
 
761
-		foreach ( $field['attributes'] as $attribute => $value ) {
762
-			$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"';
761
+		foreach ($field['attributes'] as $attribute => $value) {
762
+			$custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"';
763 763
 		}
764 764
 	}
765 765
 
766
-	return implode( ' ', $custom_attributes );
766
+	return implode(' ', $custom_attributes);
767 767
 }
768 768
 
769 769
 /**
@@ -779,8 +779,8 @@  discard block
 block discarded – undo
779 779
  *
780 780
  * @return string
781 781
  */
782
-function give_get_repeater_field_value( $field, $field_group, $fields ) {
783
-	$field_value = ( isset( $field_group[ $field['id'] ] ) ? $field_group[ $field['id'] ] : '' );
782
+function give_get_repeater_field_value($field, $field_group, $fields) {
783
+	$field_value = (isset($field_group[$field['id']]) ? $field_group[$field['id']] : '');
784 784
 
785 785
 	/**
786 786
 	 * Filter the specific repeater field value
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 	 *
790 790
 	 * @param string $field_id
791 791
 	 */
792
-	$field_value = apply_filters( "give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields );
792
+	$field_value = apply_filters("give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields);
793 793
 
794 794
 	/**
795 795
 	 * Filter the repeater field value
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 	 *
799 799
 	 * @param string $field_id
800 800
 	 */
801
-	$field_value = apply_filters( 'give_get_repeater_field_value', $field_value, $field, $field_group, $fields );
801
+	$field_value = apply_filters('give_get_repeater_field_value', $field_value, $field, $field_group, $fields);
802 802
 
803 803
 	return $field_value;
804 804
 }
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
  *
817 817
  * @return string
818 818
  */
819
-function give_get_repeater_field_id( $field, $fields, $default = false ) {
819
+function give_get_repeater_field_id($field, $fields, $default = false) {
820 820
 	$row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}';
821 821
 
822 822
 	// Get field id.
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 	 *
830 830
 	 * @param string $field_id
831 831
 	 */
832
-	$field_id = apply_filters( "give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default );
832
+	$field_id = apply_filters("give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default);
833 833
 
834 834
 
835 835
 	/**
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
 	 *
840 840
 	 * @param string $field_id
841 841
 	 */
842
-	$field_id = apply_filters( 'give_get_repeater_field_id', $field_id, $field, $fields, $default );
842
+	$field_id = apply_filters('give_get_repeater_field_id', $field_id, $field, $fields, $default);
843 843
 
844 844
 	return $field_id;
845 845
 }
@@ -854,8 +854,8 @@  discard block
 block discarded – undo
854 854
  *
855 855
  * @return string
856 856
  */
857
-function give_get_field_name( $field ) {
858
-	$field_name = esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] );
857
+function give_get_field_name($field) {
858
+	$field_name = esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']);
859 859
 
860 860
 	/**
861 861
 	 * Filter the field name.
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 	 *
865 865
 	 * @param string $field_name
866 866
 	 */
867
-	$field_name = apply_filters( 'give_get_field_name', $field_name, $field );
867
+	$field_name = apply_filters('give_get_field_name', $field_name, $field);
868 868
 
869 869
 	return $field_name;
870 870
 }
@@ -880,38 +880,38 @@  discard block
 block discarded – undo
880 880
  *
881 881
  * @return void
882 882
  */
883
-function _give_metabox_form_data_repeater_fields( $fields ) {
883
+function _give_metabox_form_data_repeater_fields($fields) {
884 884
 	global $thepostid, $post;
885 885
 
886 886
 	// Bailout.
887
-	if ( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) {
887
+	if ( ! isset($fields['fields']) || empty($fields['fields'])) {
888 888
 		return;
889 889
 	}
890 890
 
891
-	$group_numbering = isset( $fields['options']['group_numbering'] ) ? (int) $fields['options']['group_numbering'] : 0;
892
-	$close_tabs      = isset( $fields['options']['close_tabs'] )      ? (int) $fields['options']['close_tabs']      : 0;
891
+	$group_numbering = isset($fields['options']['group_numbering']) ? (int) $fields['options']['group_numbering'] : 0;
892
+	$close_tabs      = isset($fields['options']['close_tabs']) ? (int) $fields['options']['close_tabs'] : 0;
893 893
 	?>
894 894
 	<div class="give-repeatable-field-section" id="<?php echo "{$fields['id']}_field"; ?>" data-group-numbering="<?php echo $group_numbering; ?>" data-close-tabs="<?php echo $close_tabs; ?>">
895
-		<?php if ( ! empty( $fields['name'] ) ) : ?>
895
+		<?php if ( ! empty($fields['name'])) : ?>
896 896
 			<p class="give-repeater-field-name"><?php echo $fields['name']; ?></p>
897 897
 		<?php endif; ?>
898 898
 
899
-		<?php if ( ! empty( $fields['description'] ) ) : ?>
899
+		<?php if ( ! empty($fields['description'])) : ?>
900 900
 			<p class="give-repeater-field-description"><?php echo $fields['description']; ?></p>
901 901
 		<?php endif; ?>
902 902
 
903 903
 		<table class="give-repeatable-fields-section-wrapper" cellspacing="0">
904 904
 			<?php
905
-			$repeater_field_values = get_post_meta( $thepostid, $fields['id'], true );
906
-			$header_title          = isset( $fields['options']['header_title'] )
905
+			$repeater_field_values = get_post_meta($thepostid, $fields['id'], true);
906
+			$header_title          = isset($fields['options']['header_title'])
907 907
 				? $fields['options']['header_title']
908
-				: esc_attr__( 'Group', 'give' );
908
+				: esc_attr__('Group', 'give');
909 909
 
910 910
 			$add_default_donation_field = false;
911 911
 
912 912
 			// Check if level is not created or we have to add default level.
913
-			if ( is_array( $repeater_field_values ) && ( $fields_count = count( $repeater_field_values ) ) ) {
914
-				$repeater_field_values = array_values( $repeater_field_values );
913
+			if (is_array($repeater_field_values) && ($fields_count = count($repeater_field_values))) {
914
+				$repeater_field_values = array_values($repeater_field_values);
915 915
 			} else {
916 916
 				$fields_count               = 1;
917 917
 				$add_default_donation_field = true;
@@ -924,73 +924,73 @@  discard block
 block discarded – undo
924 924
 						<div class="give-row-head give-move">
925 925
 							<button type="button" class="handlediv button-link"><span class="toggle-indicator"></span>
926 926
 							</button>
927
-							<span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-</span>
927
+							<span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-</span>
928 928
 							<h2>
929 929
 								<span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span>
930 930
 							</h2>
931 931
 						</div>
932 932
 						<div class="give-row-body">
933
-							<?php foreach ( $fields['fields'] as $field ) : ?>
934
-								<?php if ( ! give_is_field_callback_exist( $field ) ) {
933
+							<?php foreach ($fields['fields'] as $field) : ?>
934
+								<?php if ( ! give_is_field_callback_exist($field)) {
935 935
 									continue;
936 936
 								} ?>
937 937
 								<?php
938 938
 								$field['repeat']              = true;
939
-								$field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields );
940
-								$field['id']                  = str_replace( array( '[', ']' ), array(
939
+								$field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields);
940
+								$field['id']                  = str_replace(array('[', ']'), array(
941 941
 									'_',
942 942
 									'',
943
-								), $field['repeatable_field_id'] );
943
+								), $field['repeatable_field_id']);
944 944
 								?>
945
-								<?php give_render_field( $field ); ?>
945
+								<?php give_render_field($field); ?>
946 946
 							<?php endforeach; ?>
947 947
 						</div>
948 948
 					</td>
949 949
 				</tr>
950 950
 
951
-				<?php if ( ! empty( $repeater_field_values ) ) : ?>
951
+				<?php if ( ! empty($repeater_field_values)) : ?>
952 952
 					<!--Stored repeater field group-->
953
-					<?php foreach ( $repeater_field_values as $index => $field_group ) : ?>
953
+					<?php foreach ($repeater_field_values as $index => $field_group) : ?>
954 954
 						<tr class="give-row">
955 955
 							<td class="give-repeater-field-wrap give-column" colspan="2">
956 956
 								<div class="give-row-head give-move">
957 957
 									<button type="button" class="handlediv button-link">
958 958
 										<span class="toggle-indicator"></span></button>
959
-									<sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-
959
+									<sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-
960 960
 									</sapn>
961 961
 									<h2>
962 962
 										<span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span>
963 963
 									</h2>
964 964
 								</div>
965 965
 								<div class="give-row-body">
966
-									<?php foreach ( $fields['fields'] as $field ) : ?>
967
-										<?php if ( ! give_is_field_callback_exist( $field ) ) {
966
+									<?php foreach ($fields['fields'] as $field) : ?>
967
+										<?php if ( ! give_is_field_callback_exist($field)) {
968 968
 											continue;
969 969
 										} ?>
970 970
 										<?php
971 971
 										$field['repeat']              = true;
972
-										$field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, $index );
973
-										$field['attributes']['value'] = give_get_repeater_field_value( $field, $field_group, $fields );
974
-										$field['id']                  = str_replace( array( '[', ']' ), array(
972
+										$field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, $index);
973
+										$field['attributes']['value'] = give_get_repeater_field_value($field, $field_group, $fields);
974
+										$field['id']                  = str_replace(array('[', ']'), array(
975 975
 											'_',
976 976
 											'',
977
-										), $field['repeatable_field_id'] );
977
+										), $field['repeatable_field_id']);
978 978
 										?>
979
-										<?php give_render_field( $field ); ?>
979
+										<?php give_render_field($field); ?>
980 980
 									<?php endforeach; ?>
981 981
 								</div>
982 982
 							</td>
983 983
 						</tr>
984
-					<?php endforeach;; ?>
984
+					<?php endforeach; ; ?>
985 985
 
986
-				<?php elseif ( $add_default_donation_field ) : ?>
986
+				<?php elseif ($add_default_donation_field) : ?>
987 987
 					<!--Default repeater field group-->
988 988
 					<tr class="give-row">
989 989
 						<td class="give-repeater-field-wrap give-column" colspan="2">
990 990
 							<div class="give-row-head give-move">
991 991
 								<button type="button" class="handlediv button-link">
992 992
 									<span class="toggle-indicator"></span></button>
993
-								<sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-
993
+								<sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-
994 994
 								</sapn>
995 995
 								<h2>
996 996
 									<span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span>
@@ -998,19 +998,19 @@  discard block
 block discarded – undo
998 998
 							</div>
999 999
 							<div class="give-row-body">
1000 1000
 								<?php
1001
-								foreach ( $fields['fields'] as $field ) :
1002
-									if ( ! give_is_field_callback_exist( $field ) ) {
1001
+								foreach ($fields['fields'] as $field) :
1002
+									if ( ! give_is_field_callback_exist($field)) {
1003 1003
 										continue;
1004 1004
 									}
1005 1005
 
1006 1006
 									$field['repeat']              = true;
1007
-									$field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, 0 );
1008
-									$field['attributes']['value'] = apply_filters( "give_default_field_group_field_{$field['id']}_value", ( ! empty( $field['default'] ) ? $field['default'] : '' ), $field );
1009
-									$field['id']                  = str_replace( array( '[', ']' ), array(
1007
+									$field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, 0);
1008
+									$field['attributes']['value'] = apply_filters("give_default_field_group_field_{$field['id']}_value", ( ! empty($field['default']) ? $field['default'] : ''), $field);
1009
+									$field['id']                  = str_replace(array('[', ']'), array(
1010 1010
 										'_',
1011 1011
 										'',
1012
-									), $field['repeatable_field_id'] );
1013
-									give_render_field( $field );
1012
+									), $field['repeatable_field_id']);
1013
+									give_render_field($field);
1014 1014
 								endforeach;
1015 1015
 								?>
1016 1016
 							</div>
@@ -1021,9 +1021,9 @@  discard block
 block discarded – undo
1021 1021
 			<tfoot>
1022 1022
 				<tr>
1023 1023
 					<?php
1024
-					$add_row_btn_title = isset( $fields['options']['add_button'] )
1024
+					$add_row_btn_title = isset($fields['options']['add_button'])
1025 1025
 						? $add_row_btn_title = $fields['options']['add_button']
1026
-						: esc_html__( 'Add Row', 'give' );
1026
+						: esc_html__('Add Row', 'give');
1027 1027
 					?>
1028 1028
 					<td colspan="2" class="give-add-repeater-field-section-row-wrap">
1029 1029
 						<span class="button button-primary give-add-repeater-field-section-row"><?php echo $add_row_btn_title; ?></span>
@@ -1053,10 +1053,10 @@  discard block
 block discarded – undo
1053 1053
 	 *
1054 1054
 	 * @param string
1055 1055
 	 */
1056
-	$default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' );
1056
+	$default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general');
1057 1057
 
1058 1058
 	// Get current tab.
1059
-	$current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] );
1059
+	$current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']);
1060 1060
 
1061 1061
 	// Output.
1062 1062
 	return $current_tab;
@@ -1080,10 +1080,10 @@  discard block
 block discarded – undo
1080 1080
 	 *
1081 1081
 	 * @param string
1082 1082
 	 */
1083
-	$default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' );
1083
+	$default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", '');
1084 1084
 
1085 1085
 	// Get current section.
1086
-	$current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] );
1086
+	$current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']);
1087 1087
 
1088 1088
 	//Output.
1089 1089
 	return $current_section;
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
  */
1098 1098
 function give_get_current_setting_page() {
1099 1099
 	// Get current page.
1100
-	$setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : '';
1100
+	$setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : '';
1101 1101
 
1102 1102
 	//Output.
1103 1103
 	return $setting_page;
@@ -1116,13 +1116,13 @@  discard block
 block discarded – undo
1116 1116
  *
1117 1117
  * @return string
1118 1118
  */
1119
-function _give_display_content_field_value( $field_value, $field, $postid ) {
1120
-	$show_content = get_post_meta( $postid, '_give_content_option', true );
1119
+function _give_display_content_field_value($field_value, $field, $postid) {
1120
+	$show_content = get_post_meta($postid, '_give_content_option', true);
1121 1121
 
1122 1122
 	if (
1123
-		! get_post_meta( $postid, '_give_display_content', true )
1123
+		! get_post_meta($postid, '_give_display_content', true)
1124 1124
 		&& $show_content
1125
-		&& ( 'none' !== $show_content )
1125
+		&& ('none' !== $show_content)
1126 1126
 	) {
1127 1127
 		$field_value = 'enabled';
1128 1128
 	}
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 	return $field_value;
1131 1131
 }
1132 1132
 
1133
-add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 );
1133
+add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3);
1134 1134
 
1135 1135
 
1136 1136
 /**
@@ -1146,12 +1146,12 @@  discard block
 block discarded – undo
1146 1146
  *
1147 1147
  * @return string
1148 1148
  */
1149
-function _give_content_placement_field_value( $field_value, $field, $postid ) {
1150
-	$show_content = get_post_meta( $postid, '_give_content_option', true );
1149
+function _give_content_placement_field_value($field_value, $field, $postid) {
1150
+	$show_content = get_post_meta($postid, '_give_content_option', true);
1151 1151
 
1152 1152
 	if (
1153
-		! get_post_meta( $postid, '_give_content_placement', true )
1154
-		&& ( 'none' !== $show_content )
1153
+		! get_post_meta($postid, '_give_content_placement', true)
1154
+		&& ('none' !== $show_content)
1155 1155
 	) {
1156 1156
 		$field_value = $show_content;
1157 1157
 	}
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 	return $field_value;
1160 1160
 }
1161 1161
 
1162
-add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 );
1162
+add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3);
1163 1163
 
1164 1164
 
1165 1165
 /**
@@ -1175,17 +1175,17 @@  discard block
 block discarded – undo
1175 1175
  *
1176 1176
  * @return string
1177 1177
  */
1178
-function _give_terms_option_field_value( $field_value, $field, $postid ) {
1179
-	$term_option = get_post_meta( $postid, '_give_terms_option', true );
1178
+function _give_terms_option_field_value($field_value, $field, $postid) {
1179
+	$term_option = get_post_meta($postid, '_give_terms_option', true);
1180 1180
 
1181
-	if ( in_array( $term_option, array( 'none', 'yes' ) ) ) {
1182
-		$field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' );
1181
+	if (in_array($term_option, array('none', 'yes'))) {
1182
+		$field_value = ('yes' === $term_option ? 'enabled' : 'disabled');
1183 1183
 	}
1184 1184
 
1185 1185
 	return $field_value;
1186 1186
 }
1187 1187
 
1188
-add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 );
1188
+add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3);
1189 1189
 
1190 1190
 
1191 1191
 /**
@@ -1201,17 +1201,17 @@  discard block
 block discarded – undo
1201 1201
  *
1202 1202
  * @return string
1203 1203
  */
1204
-function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ) {
1205
-	$offline_donation = get_post_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true );
1204
+function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) {
1205
+	$offline_donation = get_post_meta($postid, '_give_offline_donation_enable_billing_fields_single', true);
1206 1206
 
1207
-	if ( 'on' === $offline_donation ) {
1207
+	if ('on' === $offline_donation) {
1208 1208
 		$field_value = 'enabled';
1209 1209
 	}
1210 1210
 
1211 1211
 	return $field_value;
1212 1212
 }
1213 1213
 
1214
-add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 );
1214
+add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3);
1215 1215
 
1216 1216
 
1217 1217
 /**
@@ -1227,17 +1227,17 @@  discard block
 block discarded – undo
1227 1227
  *
1228 1228
  * @return string
1229 1229
  */
1230
-function _give_custom_amount_field_value( $field_value, $field, $postid ) {
1231
-	$custom_amount = get_post_meta( $postid, '_give_custom_amount', true );
1230
+function _give_custom_amount_field_value($field_value, $field, $postid) {
1231
+	$custom_amount = get_post_meta($postid, '_give_custom_amount', true);
1232 1232
 
1233
-	if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) {
1234
-		$field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' );
1233
+	if (in_array($custom_amount, array('yes', 'no'))) {
1234
+		$field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled');
1235 1235
 	}
1236 1236
 
1237 1237
 	return $field_value;
1238 1238
 }
1239 1239
 
1240
-add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 );
1240
+add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3);
1241 1241
 
1242 1242
 
1243 1243
 /**
@@ -1253,17 +1253,17 @@  discard block
 block discarded – undo
1253 1253
  *
1254 1254
  * @return string
1255 1255
  */
1256
-function _give_goal_option_field_value( $field_value, $field, $postid ) {
1257
-	$goal_option = get_post_meta( $postid, '_give_goal_option', true );
1256
+function _give_goal_option_field_value($field_value, $field, $postid) {
1257
+	$goal_option = get_post_meta($postid, '_give_goal_option', true);
1258 1258
 
1259
-	if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) {
1260
-		$field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' );
1259
+	if (in_array($goal_option, array('yes', 'no'))) {
1260
+		$field_value = ('yes' === $goal_option ? 'enabled' : 'disabled');
1261 1261
 	}
1262 1262
 
1263 1263
 	return $field_value;
1264 1264
 }
1265 1265
 
1266
-add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 );
1266
+add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3);
1267 1267
 
1268 1268
 /**
1269 1269
  * Set value for Donation Goal --> close Form.
@@ -1278,17 +1278,17 @@  discard block
 block discarded – undo
1278 1278
  *
1279 1279
  * @return string
1280 1280
  */
1281
-function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) {
1282
-	$close_form = get_post_meta( $postid, '_give_close_form_when_goal_achieved', true );
1281
+function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) {
1282
+	$close_form = get_post_meta($postid, '_give_close_form_when_goal_achieved', true);
1283 1283
 
1284
-	if ( in_array( $close_form, array( 'yes', 'no' ) ) ) {
1285
-		$field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' );
1284
+	if (in_array($close_form, array('yes', 'no'))) {
1285
+		$field_value = ('yes' === $close_form ? 'enabled' : 'disabled');
1286 1286
 	}
1287 1287
 
1288 1288
 	return $field_value;
1289 1289
 }
1290 1290
 
1291
-add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 );
1291
+add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3);
1292 1292
 
1293 1293
 
1294 1294
 /**
@@ -1304,17 +1304,17 @@  discard block
 block discarded – undo
1304 1304
  *
1305 1305
  * @return string
1306 1306
  */
1307
-function _give_logged_in_only_value( $field_value, $field, $postid ) {
1308
-	$guest_donation = get_post_meta( $postid, '_give_logged_in_only', true );
1307
+function _give_logged_in_only_value($field_value, $field, $postid) {
1308
+	$guest_donation = get_post_meta($postid, '_give_logged_in_only', true);
1309 1309
 
1310
-	if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) {
1311
-		$field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' );
1310
+	if (in_array($guest_donation, array('yes', 'no'))) {
1311
+		$field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled');
1312 1312
 	}
1313 1313
 
1314 1314
 	return $field_value;
1315 1315
 }
1316 1316
 
1317
-add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 );
1317
+add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3);
1318 1318
 
1319 1319
 /**
1320 1320
  * Set value for Offline Donations --> Offline Donations.
@@ -1329,17 +1329,17 @@  discard block
 block discarded – undo
1329 1329
  *
1330 1330
  * @return string
1331 1331
  */
1332
-function _give_customize_offline_donations_value( $field_value, $field, $postid ) {
1333
-	$customize_offline_text = get_post_meta( $postid, '_give_customize_offline_donations', true );
1332
+function _give_customize_offline_donations_value($field_value, $field, $postid) {
1333
+	$customize_offline_text = get_post_meta($postid, '_give_customize_offline_donations', true);
1334 1334
 
1335
-	if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) {
1336
-		$field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' );
1335
+	if (in_array($customize_offline_text, array('yes', 'no'))) {
1336
+		$field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled');
1337 1337
 	}
1338 1338
 
1339 1339
 	return $field_value;
1340 1340
 }
1341 1341
 
1342
-add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 );
1342
+add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3);
1343 1343
 
1344 1344
 
1345 1345
 /**
@@ -1354,14 +1354,14 @@  discard block
 block discarded – undo
1354 1354
  *
1355 1355
  * @return mixed
1356 1356
  */
1357
-function _give_set_multi_level_repeater_field_id( $field_id, $field, $fields, $default ) {
1357
+function _give_set_multi_level_repeater_field_id($field_id, $field, $fields, $default) {
1358 1358
 	$row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}';
1359 1359
 	$field_id = "{$fields['id']}[{$row_placeholder}][{$field['id']}][level_id]";
1360 1360
 
1361 1361
 	return $field_id;
1362 1362
 }
1363 1363
 
1364
-add_filter( 'give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4 );
1364
+add_filter('give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4);
1365 1365
 
1366 1366
 /**
1367 1367
  * Set repeater field value for multi donation form.
@@ -1375,13 +1375,13 @@  discard block
 block discarded – undo
1375 1375
  *
1376 1376
  * @return mixed
1377 1377
  */
1378
-function _give_set_multi_level_repeater_field_value( $field_value, $field, $field_group, $fields ) {
1379
-	$field_value = $field_group[ $field['id'] ]['level_id'];
1378
+function _give_set_multi_level_repeater_field_value($field_value, $field, $field_group, $fields) {
1379
+	$field_value = $field_group[$field['id']]['level_id'];
1380 1380
 
1381 1381
 	return $field_value;
1382 1382
 }
1383 1383
 
1384
-add_filter( 'give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4 );
1384
+add_filter('give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4);
1385 1385
 
1386 1386
 /**
1387 1387
  * Set default value for _give_id field.
@@ -1392,11 +1392,11 @@  discard block
 block discarded – undo
1392 1392
  *
1393 1393
  * @return string
1394 1394
  */
1395
-function _give_set_field_give_id_default_value( $field ) {
1395
+function _give_set_field_give_id_default_value($field) {
1396 1396
 	return 0;
1397 1397
 }
1398 1398
 
1399
-add_filter( 'give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value' );
1399
+add_filter('give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value');
1400 1400
 
1401 1401
 /**
1402 1402
  * Set default value for _give_default field.
@@ -1407,11 +1407,11 @@  discard block
 block discarded – undo
1407 1407
  *
1408 1408
  * @return string
1409 1409
  */
1410
-function _give_set_field_give_default_default_value( $field ) {
1410
+function _give_set_field_give_default_default_value($field) {
1411 1411
 	return 'default';
1412 1412
 }
1413 1413
 
1414
-add_filter( 'give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value' );
1414
+add_filter('give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value');
1415 1415
 
1416 1416
 /**
1417 1417
  * Set repeater field editor id for field type wysiwyg.
@@ -1423,11 +1423,11 @@  discard block
 block discarded – undo
1423 1423
  *
1424 1424
  * @return string
1425 1425
  */
1426
-function give_repeater_field_set_editor_id( $field_name, $field ) {
1427
-	if ( isset( $field['repeatable_field_id'] ) &&  'wysiwyg' == $field['type'] ) {
1428
-		$field_name = '_give_repeater_' . uniqid() . '_wysiwyg';
1426
+function give_repeater_field_set_editor_id($field_name, $field) {
1427
+	if (isset($field['repeatable_field_id']) && 'wysiwyg' == $field['type']) {
1428
+		$field_name = '_give_repeater_'.uniqid().'_wysiwyg';
1429 1429
 	}
1430 1430
 
1431 1431
 	return $field_name;
1432 1432
 }
1433
-add_filter( 'give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2 );
1434 1433
\ No newline at end of file
1434
+add_filter('give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2);
1435 1435
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/shortcodes/class-shortcode-button.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
 	/**
114 114
 	 * Adds the "Donation Form" button above the TinyMCE Editor on add/edit screens.
115 115
 	 *
116
-	 * @return string|bool
116
+	 * @return false|null
117 117
 	 *
118 118
 	 * @since 1.0
119 119
 	 */
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public function __construct() {
35 35
 
36
-		if ( is_admin() ) {
37
-			add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 );
36
+		if (is_admin()) {
37
+			add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15);
38 38
 
39
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) );
40
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 );
41
-			add_action( 'media_buttons', array( $this, 'shortcode_button' ) );
39
+			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets'));
40
+			add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13);
41
+			add_action('media_buttons', array($this, 'shortcode_button'));
42 42
 		}
43 43
 
44
-		add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) );
45
-		add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) );
44
+		add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax'));
45
+		add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax'));
46 46
 	}
47 47
 
48 48
 	/**
@@ -54,15 +54,15 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @since 1.0
56 56
 	 */
57
-	public function mce_external_plugins( $plugin_array ) {
57
+	public function mce_external_plugins($plugin_array) {
58 58
 
59
-		if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
59
+		if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages')) {
60 60
 			return false;
61 61
 		}
62 62
 
63
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
63
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
64 64
 
65
-		$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'assets/js/admin/tinymce/mce-plugin' . $suffix . '.js';
65
+		$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'assets/js/admin/tinymce/mce-plugin'.$suffix.'.js';
66 66
 
67 67
 		return $plugin_array;
68 68
 	}
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function admin_enqueue_assets() {
78 78
 
79
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
79
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
80 80
 
81 81
 		wp_enqueue_script(
82 82
 			'give_shortcode',
83
-			GIVE_PLUGIN_URL . 'assets/js/admin/admin-shortcodes' . $suffix . '.js',
84
-			array( 'jquery' ),
83
+			GIVE_PLUGIN_URL.'assets/js/admin/admin-shortcodes'.$suffix.'.js',
84
+			array('jquery'),
85 85
 			GIVE_VERSION,
86 86
 			true
87 87
 		);
@@ -96,17 +96,17 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function admin_localize_scripts() {
98 98
 
99
-		if ( ! empty( self::$shortcodes ) ) {
99
+		if ( ! empty(self::$shortcodes)) {
100 100
 
101 101
 			$variables = array();
102 102
 
103
-			foreach ( self::$shortcodes as $shortcode => $values ) {
104
-				if ( ! empty( $values['required'] ) ) {
105
-					$variables[ $shortcode ] = $values['required'];
103
+			foreach (self::$shortcodes as $shortcode => $values) {
104
+				if ( ! empty($values['required'])) {
105
+					$variables[$shortcode] = $values['required'];
106 106
 				}
107 107
 			}
108 108
 
109
-			wp_localize_script( 'give_shortcode', 'scShortcodes', $variables );
109
+			wp_localize_script('give_shortcode', 'scShortcodes', $variables);
110 110
 		}
111 111
 	}
112 112
 
@@ -123,37 +123,37 @@  discard block
 block discarded – undo
123 123
 
124 124
 		// If we load wp editor by ajax then $screen will be empty which generate notice if we treat $screen as WP_Screen object.
125 125
 		// For example we are loading wp editor by ajax in repeater field.
126
-		if ( ! ( $screen instanceof WP_Screen ) ) {
126
+		if ( ! ($screen instanceof WP_Screen)) {
127 127
 			return false;
128 128
 		}
129 129
 
130
-		$shortcode_button_pages = apply_filters( 'give_shortcode_button_pages', array(
130
+		$shortcode_button_pages = apply_filters('give_shortcode_button_pages', array(
131 131
 			'post.php',
132 132
 			'page.php',
133 133
 			'post-new.php',
134 134
 			'post-edit.php',
135 135
 			'edit.php',
136 136
 			'edit.php?post_type=page',
137
-		) );
137
+		));
138 138
 
139 139
 		// Only run in admin post/page creation and edit screens
140
-		if ( in_array( $screen->parent_file, $shortcode_button_pages )
141
-		     && apply_filters( 'give_shortcode_button_condition', true )
142
-		     && ! empty( self::$shortcodes )
140
+		if (in_array($screen->parent_file, $shortcode_button_pages)
141
+		     && apply_filters('give_shortcode_button_condition', true)
142
+		     && ! empty(self::$shortcodes)
143 143
 		) {
144 144
 
145 145
 			$shortcodes = array();
146 146
 
147
-			foreach ( self::$shortcodes as $shortcode => $values ) {
147
+			foreach (self::$shortcodes as $shortcode => $values) {
148 148
 
149 149
 				/**
150 150
 				 * Filters the condition for including the current shortcode
151 151
 				 *
152 152
 				 * @since 1.0
153 153
 				 */
154
-				if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) {
154
+				if (apply_filters(sanitize_title($shortcode).'_condition', true)) {
155 155
 
156
-					$shortcodes[ $shortcode ] = sprintf(
156
+					$shortcodes[$shortcode] = sprintf(
157 157
 						'<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%s">%s</div>',
158 158
 						$shortcode,
159 159
 						$values['label'],
@@ -162,37 +162,37 @@  discard block
 block discarded – undo
162 162
 				}
163 163
 			}
164 164
 
165
-			if ( ! empty( $shortcodes ) ) {
165
+			if ( ! empty($shortcodes)) {
166 166
 
167 167
 				// check current WP version
168
-				$img = ( version_compare( get_bloginfo( 'version' ), '3.5', '<' ) )
169
-					? '<img src="' . GIVE_PLUGIN_URL . 'assets/images/give-media.png" />'
170
-					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>';
168
+				$img = (version_compare(get_bloginfo('version'), '3.5', '<'))
169
+					? '<img src="'.GIVE_PLUGIN_URL.'assets/images/give-media.png" />'
170
+					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>';
171 171
 
172
-				reset( $shortcodes );
172
+				reset($shortcodes);
173 173
 
174
-				if ( count( $shortcodes ) == 1 ) {
174
+				if (count($shortcodes) == 1) {
175 175
 
176
-					$shortcode = key( $shortcodes );
176
+					$shortcode = key($shortcodes);
177 177
 
178 178
 					printf(
179 179
 						'<button class="button sc-shortcode" data-shortcode="%s">%s</button>',
180 180
 						$shortcode,
181
-						sprintf( '%s %s %s',
181
+						sprintf('%s %s %s',
182 182
 							$img,
183
-							esc_html__( 'Insert', 'give' ),
184
-							self::$shortcodes[ $shortcode ]['label']
183
+							esc_html__('Insert', 'give'),
184
+							self::$shortcodes[$shortcode]['label']
185 185
 						)
186 186
 					);
187 187
 				} else {
188 188
 					printf(
189
-						'<div class="sc-wrap">' .
190
-						'<button class="button sc-button">%s %s</button>' .
191
-						'<div class="sc-menu mce-menu">%s</div>' .
189
+						'<div class="sc-wrap">'.
190
+						'<button class="button sc-button">%s %s</button>'.
191
+						'<div class="sc-menu mce-menu">%s</div>'.
192 192
 						'</div>',
193 193
 						$img,
194
-						esc_html__( 'Give Shortcodes', 'give' ),
195
-						implode( '', array_values( $shortcodes ) )
194
+						esc_html__('Give Shortcodes', 'give'),
195
+						implode('', array_values($shortcodes))
196 196
 					);
197 197
 				}
198 198
 			}
@@ -208,15 +208,15 @@  discard block
 block discarded – undo
208 208
 	 */
209 209
 	public function shortcode_ajax() {
210 210
 
211
-		$shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false;
211
+		$shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false;
212 212
 		$response  = false;
213 213
 
214
-		if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) {
214
+		if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) {
215 215
 
216
-			$data = self::$shortcodes[ $shortcode ];
216
+			$data = self::$shortcodes[$shortcode];
217 217
 
218
-			if ( ! empty( $data['errors'] ) ) {
219
-				$data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) );
218
+			if ( ! empty($data['errors'])) {
219
+				$data['btn_okay'] = array(esc_html__('Okay', 'give'));
220 220
 			}
221 221
 
222 222
 			$response = array(
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
 			);
229 229
 		} else {
230 230
 			// todo: handle error
231
-			error_log( print_r( 'AJAX error!', 1 ) );
231
+			error_log(print_r('AJAX error!', 1));
232 232
 		}
233 233
 
234
-		wp_send_json( $response );
234
+		wp_send_json($response);
235 235
 	}
236 236
 }
237 237
 
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -138,8 +138,8 @@
 block discarded – undo
138 138
 
139 139
 		// Only run in admin post/page creation and edit screens
140 140
 		if ( in_array( $screen->parent_file, $shortcode_button_pages )
141
-		     && apply_filters( 'give_shortcode_button_condition', true )
142
-		     && ! empty( self::$shortcodes )
141
+			 && apply_filters( 'give_shortcode_button_condition', true )
142
+			 && ! empty( self::$shortcodes )
143 143
 		) {
144 144
 
145 145
 			$shortcodes = array();
Please login to merge, or discard this patch.