Test Failed
Push — master ( 1d3b59...426730 )
by Devin
01:16
created
includes/admin/tools/export/class-core-settings-export.php 1 patch
Spacing   +7 added lines, -7 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
 
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 		give_ignore_user_abort();
43 43
 
44 44
 		nocache_headers();
45
-		header( 'Content-Type: application/json; charset=utf-8' );
46
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_core_settings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.json' );
47
-		header( 'Expires: 0' );
45
+		header('Content-Type: application/json; charset=utf-8');
46
+		header('Content-Disposition: attachment; filename='.apply_filters('give_core_settings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.json');
47
+		header('Expires: 0');
48 48
 	}
49 49
 
50 50
 	/**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @since 1.8.17
55 55
 	 */
56 56
 	public function json_core_settings_export() {
57
-		echo wp_json_encode( get_option( 'give_settings' ) );
57
+		echo wp_json_encode(get_option('give_settings'));
58 58
 	}
59 59
 
60 60
 	/**
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 	 * @since  1.8.17
65 65
 	 */
66 66
 	public function export() {
67
-		if ( ! $this->can_export() ) {
68
-			wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
67
+		if ( ! $this->can_export()) {
68
+			wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403));
69 69
 		}
70 70
 
71 71
 		// Set headers.
Please login to merge, or discard this patch.
includes/admin/tools/export/class-export.php 1 patch
Spacing   +24 added lines, -24 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
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @return bool Whether we can export or not
38 38
 	 */
39 39
 	public function can_export() {
40
-		return (bool) apply_filters( 'give_export_capability', current_user_can( 'export_give_reports' ) );
40
+		return (bool) apply_filters('give_export_capability', current_user_can('export_give_reports'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 		give_ignore_user_abort();
52 52
 
53 53
 		nocache_headers();
54
-		header( 'Content-Type: text/csv; charset=utf-8' );
55
-		header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' );
56
-		header( "Expires: 0" );
54
+		header('Content-Type: text/csv; charset=utf-8');
55
+		header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv');
56
+		header("Expires: 0");
57 57
 	}
58 58
 
59 59
 	/**
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	public function csv_cols() {
67 67
 		$cols = array(
68
-			'id'   => __( 'ID', 'give' ),
69
-			'date' => __( 'Date', 'give' )
68
+			'id'   => __('ID', 'give'),
69
+			'date' => __('Date', 'give')
70 70
 		);
71 71
 
72 72
 		return $cols;
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	public function get_csv_cols() {
83 83
 		$cols = $this->csv_cols();
84 84
 
85
-		return apply_filters( "give_export_csv_cols_{$this->export_type}", $cols );
85
+		return apply_filters("give_export_csv_cols_{$this->export_type}", $cols);
86 86
 	}
87 87
 
88 88
 	/**
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 	public function csv_cols_out() {
97 97
 		$cols = $this->get_csv_cols();
98 98
 		$i    = 1;
99
-		foreach ( $cols as $col_id => $column ) {
100
-			echo '"' . addslashes( $column ) . '"';
101
-			echo $i == count( $cols ) ? '' : ',';
102
-			$i ++;
99
+		foreach ($cols as $col_id => $column) {
100
+			echo '"'.addslashes($column).'"';
101
+			echo $i == count($cols) ? '' : ',';
102
+			$i++;
103 103
 		}
104 104
 		echo "\r\n";
105 105
 	}
@@ -116,16 +116,16 @@  discard block
 block discarded – undo
116 116
 		$data = array(
117 117
 			0 => array(
118 118
 				'id'   => '',
119
-				'data' => date( 'F j, Y' )
119
+				'data' => date('F j, Y')
120 120
 			),
121 121
 			1 => array(
122 122
 				'id'   => '',
123
-				'data' => date( 'F j, Y' )
123
+				'data' => date('F j, Y')
124 124
 			)
125 125
 		);
126 126
 
127
-		$data = apply_filters( 'give_export_get_data', $data );
128
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
127
+		$data = apply_filters('give_export_get_data', $data);
128
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
129 129
 
130 130
 		return $data;
131 131
 	}
@@ -143,14 +143,14 @@  discard block
 block discarded – undo
143 143
 		$cols = $this->get_csv_cols();
144 144
 
145 145
 		// Output each row
146
-		foreach ( $data as $row ) {
146
+		foreach ($data as $row) {
147 147
 			$i = 1;
148
-			foreach ( $row as $col_id => $column ) {
148
+			foreach ($row as $col_id => $column) {
149 149
 				// Make sure the column is valid
150
-				if ( array_key_exists( $col_id, $cols ) ) {
151
-					echo '"' . addslashes( $column ) . '"';
152
-					echo $i == count( $cols ) ? '' : ',';
153
-					$i ++;
150
+				if (array_key_exists($col_id, $cols)) {
151
+					echo '"'.addslashes($column).'"';
152
+					echo $i == count($cols) ? '' : ',';
153
+					$i++;
154 154
 				}
155 155
 			}
156 156
 			echo "\r\n";
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	 * @return void
170 170
 	 */
171 171
 	public function export() {
172
-		if ( ! $this->can_export() ) {
173
-			wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
172
+		if ( ! $this->can_export()) {
173
+			wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403));
174 174
 		}
175 175
 
176 176
 		// Set headers
Please login to merge, or discard this patch.
includes/admin/tools/export/class-export-earnings.php 1 patch
Spacing   +25 added lines, -25 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
 
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 		give_ignore_user_abort();
42 42
 
43 43
 		nocache_headers();
44
-		header( 'Content-Type: text/csv; charset=utf-8' );
45
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' );
46
-		header( "Expires: 0" );
44
+		header('Content-Type: text/csv; charset=utf-8');
45
+		header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv');
46
+		header("Expires: 0");
47 47
 
48 48
 	}
49 49
 
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 	public function csv_cols() {
58 58
 
59 59
 		$cols = array(
60
-			'date'      => __( 'Date', 'give' ),
61
-			'donations' => __( 'Donations', 'give' ),
60
+			'date'      => __('Date', 'give'),
61
+			'donations' => __('Donations', 'give'),
62 62
 			/* translators: %s: currency */
63
-			'earnings'  => sprintf( __( 'Income (%s)', 'give' ), give_currency_symbol('', true) )
63
+			'earnings'  => sprintf(__('Income (%s)', 'give'), give_currency_symbol('', true))
64 64
 		);
65 65
 
66 66
 		return $cols;
@@ -75,28 +75,28 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function get_data() {
77 77
 
78
-		$start_year  = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' );
79
-		$end_year    = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' );
80
-		$start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' );
81
-		$end_month   = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' );
78
+		$start_year  = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y');
79
+		$end_year    = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y');
80
+		$start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n');
81
+		$end_month   = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n');
82 82
 
83 83
 		$data  = array();
84 84
 		$year  = $start_year;
85 85
 		$stats = new Give_Payment_Stats;
86 86
 
87
-		while ( $year <= $end_year ) {
87
+		while ($year <= $end_year) {
88 88
 
89
-			if ( $year == $start_year && $year == $end_year ) {
89
+			if ($year == $start_year && $year == $end_year) {
90 90
 
91 91
 				$m1 = $start_month;
92 92
 				$m2 = $end_month;
93 93
 
94
-			} elseif ( $year == $start_year ) {
94
+			} elseif ($year == $start_year) {
95 95
 
96 96
 				$m1 = $start_month;
97 97
 				$m2 = 12;
98 98
 
99
-			} elseif ( $year == $end_year ) {
99
+			} elseif ($year == $end_year) {
100 100
 
101 101
 				$m1 = 1;
102 102
 				$m2 = $end_month;
@@ -108,28 +108,28 @@  discard block
 block discarded – undo
108 108
 
109 109
 			}
110 110
 
111
-			while ( $m1 <= $m2 ) {
111
+			while ($m1 <= $m2) {
112 112
 
113
-				$date1 = mktime( 0, 0, 0, $m1, 1, $year );
114
-				$date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year );
113
+				$date1 = mktime(0, 0, 0, $m1, 1, $year);
114
+				$date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year);
115 115
 
116 116
 				$data[] = array(
117
-					'date'      => date_i18n( 'F Y', $date1 ),
118
-					'donations' => $stats->get_sales( 0, $date1, $date2 ),
119
-					'earnings'  => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ), array( 'sanitize' => false ) ),
117
+					'date'      => date_i18n('F Y', $date1),
118
+					'donations' => $stats->get_sales(0, $date1, $date2),
119
+					'earnings'  => give_format_amount($stats->get_earnings(0, $date1, $date2), array('sanitize' => false)),
120 120
 				);
121 121
 
122
-				$m1 ++;
122
+				$m1++;
123 123
 
124 124
 			}
125 125
 
126 126
 
127
-			$year ++;
127
+			$year++;
128 128
 
129 129
 		}
130 130
 
131
-		$data = apply_filters( 'give_export_get_data', $data );
132
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
131
+		$data = apply_filters('give_export_get_data', $data);
132
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
133 133
 
134 134
 		return $data;
135 135
 	}
Please login to merge, or discard this patch.
includes/class-give-roles.php 1 patch
Spacing   +88 added lines, -88 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,9 +35,9 @@  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 );
39
-		add_filter( 'woocommerce_disable_admin_bar', array( $this, 'manage_admin_dashboard' ), 10, 1 );
40
-		add_filter( 'woocommerce_prevent_admin_access', array( $this, 'manage_admin_dashboard' ), 10 );
38
+		add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4);
39
+		add_filter('woocommerce_disable_admin_bar', array($this, 'manage_admin_dashboard'), 10, 1);
40
+		add_filter('woocommerce_prevent_admin_access', array($this, 'manage_admin_dashboard'), 10);
41 41
 	}
42 42
 
43 43
 	/**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @return void
52 52
 	 */
53 53
 	public function add_roles() {
54
-		add_role( 'give_manager', __( 'Give Manager', 'give' ), array(
54
+		add_role('give_manager', __('Give Manager', 'give'), array(
55 55
 			'read'                   => true,
56 56
 			'edit_posts'             => true,
57 57
 			'delete_posts'           => true,
@@ -80,25 +80,25 @@  discard block
 block discarded – undo
80 80
 			'publish_posts'          => true,
81 81
 			'read_private_pages'     => true,
82 82
 			'read_private_posts'     => true,
83
-		) );
83
+		));
84 84
 
85
-		add_role( 'give_accountant', __( 'Give Accountant', 'give' ), array(
85
+		add_role('give_accountant', __('Give Accountant', 'give'), array(
86 86
 			'read'         => true,
87 87
 			'edit_posts'   => false,
88 88
 			'delete_posts' => false,
89
-		) );
89
+		));
90 90
 
91
-		add_role( 'give_worker', __( 'Give Worker', 'give' ), array(
91
+		add_role('give_worker', __('Give Worker', 'give'), array(
92 92
 			'read'         => true,
93 93
 			'edit_posts'   => true,
94 94
 			'edit_pages'   => true,
95 95
 			'upload_files' => true,
96 96
 			'delete_posts' => false,
97
-		) );
97
+		));
98 98
 
99
-		add_role( 'give_donor', __( 'Give Donor', 'give' ), array(
99
+		add_role('give_donor', __('Give Donor', 'give'), array(
100 100
 			'read' => true,
101
-		) );
101
+		));
102 102
 
103 103
 	}
104 104
 
@@ -117,53 +117,53 @@  discard block
 block discarded – undo
117 117
 	public function add_caps() {
118 118
 		global $wp_roles;
119 119
 
120
-		if ( class_exists( 'WP_Roles' ) ) {
121
-			if ( ! isset( $wp_roles ) ) {
120
+		if (class_exists('WP_Roles')) {
121
+			if ( ! isset($wp_roles)) {
122 122
 				$wp_roles = new WP_Roles();
123 123
 			}
124 124
 		}
125 125
 
126
-		if ( is_object( $wp_roles ) ) {
127
-			$wp_roles->add_cap( 'give_manager', 'view_give_reports' );
128
-			$wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' );
129
-			$wp_roles->add_cap( 'give_manager', 'export_give_reports' );
130
-			$wp_roles->add_cap( 'give_manager', 'manage_give_settings' );
126
+		if (is_object($wp_roles)) {
127
+			$wp_roles->add_cap('give_manager', 'view_give_reports');
128
+			$wp_roles->add_cap('give_manager', 'view_give_sensitive_data');
129
+			$wp_roles->add_cap('give_manager', 'export_give_reports');
130
+			$wp_roles->add_cap('give_manager', 'manage_give_settings');
131 131
 
132
-			$wp_roles->add_cap( 'administrator', 'view_give_reports' );
133
-			$wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' );
134
-			$wp_roles->add_cap( 'administrator', 'export_give_reports' );
135
-			$wp_roles->add_cap( 'administrator', 'manage_give_settings' );
136
-			$wp_roles->add_cap( 'administrator', 'view_give_payments' );
132
+			$wp_roles->add_cap('administrator', 'view_give_reports');
133
+			$wp_roles->add_cap('administrator', 'view_give_sensitive_data');
134
+			$wp_roles->add_cap('administrator', 'export_give_reports');
135
+			$wp_roles->add_cap('administrator', 'manage_give_settings');
136
+			$wp_roles->add_cap('administrator', 'view_give_payments');
137 137
 
138 138
 			// Add the main post type capabilities.
139 139
 			$capabilities = $this->get_core_caps();
140
-			foreach ( $capabilities as $cap_group ) {
141
-				foreach ( $cap_group as $cap ) {
142
-					$wp_roles->add_cap( 'administrator', $cap );
143
-					$wp_roles->add_cap( 'give_manager', $cap );
140
+			foreach ($capabilities as $cap_group) {
141
+				foreach ($cap_group as $cap) {
142
+					$wp_roles->add_cap('administrator', $cap);
143
+					$wp_roles->add_cap('give_manager', $cap);
144 144
 				}
145 145
 			}
146 146
 
147 147
 			// Add Capabilities to Give Workers User Role.
148
-			$wp_roles->add_cap( 'give_worker', 'edit_give_payments' );
149
-			$wp_roles->add_cap( 'give_worker', 'delete_give_forms' );
150
-			$wp_roles->add_cap( 'give_worker', 'delete_others_give_forms' );
151
-			$wp_roles->add_cap( 'give_worker', 'delete_private_give_forms' );
152
-			$wp_roles->add_cap( 'give_worker', 'delete_published_give_forms' );
153
-			$wp_roles->add_cap( 'give_worker', 'edit_give_forms' );
154
-			$wp_roles->add_cap( 'give_worker', 'edit_others_give_forms' );
155
-			$wp_roles->add_cap( 'give_worker', 'edit_private_give_forms' );
156
-			$wp_roles->add_cap( 'give_worker', 'edit_published_give_forms' );
157
-			$wp_roles->add_cap( 'give_worker', 'publish_give_forms' );
158
-			$wp_roles->add_cap( 'give_worker', 'read_private_give_forms' );
148
+			$wp_roles->add_cap('give_worker', 'edit_give_payments');
149
+			$wp_roles->add_cap('give_worker', 'delete_give_forms');
150
+			$wp_roles->add_cap('give_worker', 'delete_others_give_forms');
151
+			$wp_roles->add_cap('give_worker', 'delete_private_give_forms');
152
+			$wp_roles->add_cap('give_worker', 'delete_published_give_forms');
153
+			$wp_roles->add_cap('give_worker', 'edit_give_forms');
154
+			$wp_roles->add_cap('give_worker', 'edit_others_give_forms');
155
+			$wp_roles->add_cap('give_worker', 'edit_private_give_forms');
156
+			$wp_roles->add_cap('give_worker', 'edit_published_give_forms');
157
+			$wp_roles->add_cap('give_worker', 'publish_give_forms');
158
+			$wp_roles->add_cap('give_worker', 'read_private_give_forms');
159 159
 
160 160
 			// Add Capabilities to Give Accountant User Role.
161
-			$wp_roles->add_cap( 'give_accountant', 'edit_give_forms' );
162
-			$wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' );
163
-			$wp_roles->add_cap( 'give_accountant', 'view_give_reports' );
164
-			$wp_roles->add_cap( 'give_accountant', 'export_give_reports' );
165
-			$wp_roles->add_cap( 'give_accountant', 'edit_give_payments' );
166
-			$wp_roles->add_cap( 'give_accountant', 'view_give_payments' );
161
+			$wp_roles->add_cap('give_accountant', 'edit_give_forms');
162
+			$wp_roles->add_cap('give_accountant', 'read_private_give_forms');
163
+			$wp_roles->add_cap('give_accountant', 'view_give_reports');
164
+			$wp_roles->add_cap('give_accountant', 'export_give_reports');
165
+			$wp_roles->add_cap('give_accountant', 'edit_give_payments');
166
+			$wp_roles->add_cap('give_accountant', 'view_give_payments');
167 167
 
168 168
 		}
169 169
 	}
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
 	public function get_core_caps() {
182 182
 		$capabilities = array();
183 183
 
184
-		$capability_types = array( 'give_form', 'give_payment' );
184
+		$capability_types = array('give_form', 'give_payment');
185 185
 
186
-		foreach ( $capability_types as $capability_type ) {
187
-			$capabilities[ $capability_type ] = array(
186
+		foreach ($capability_types as $capability_type) {
187
+			$capabilities[$capability_type] = array(
188 188
 				// Post type.
189 189
 				"edit_{$capability_type}",
190 190
 				"read_{$capability_type}",
@@ -230,22 +230,22 @@  discard block
 block discarded – undo
230 230
 	 *
231 231
 	 * @return array  $caps    Meta capabilities.
232 232
 	 */
233
-	public function meta_caps( $caps, $cap, $user_id, $args ) {
233
+	public function meta_caps($caps, $cap, $user_id, $args) {
234 234
 
235
-		switch ( $cap ) {
235
+		switch ($cap) {
236 236
 
237 237
 			case 'view_give_form_stats' :
238 238
 
239
-				if ( empty( $args[0] ) ) {
239
+				if (empty($args[0])) {
240 240
 					break;
241 241
 				}
242 242
 
243
-				$form = get_post( $args[0] );
244
-				if ( empty( $form ) ) {
243
+				$form = get_post($args[0]);
244
+				if (empty($form)) {
245 245
 					break;
246 246
 				}
247 247
 
248
-				if ( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) {
248
+				if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) {
249 249
 					$caps = array();
250 250
 				}
251 251
 
@@ -272,57 +272,57 @@  discard block
 block discarded – undo
272 272
 
273 273
 		global $wp_roles;
274 274
 
275
-		if ( class_exists( 'WP_Roles' ) ) {
276
-			if ( ! isset( $wp_roles ) ) {
275
+		if (class_exists('WP_Roles')) {
276
+			if ( ! isset($wp_roles)) {
277 277
 				$wp_roles = new WP_Roles();
278 278
 			}
279 279
 		}
280 280
 
281
-		if ( is_object( $wp_roles ) ) {
281
+		if (is_object($wp_roles)) {
282 282
 			// Give Manager Capabilities.
283
-			$wp_roles->remove_cap( 'give_manager', 'view_give_reports' );
284
-			$wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' );
285
-			$wp_roles->remove_cap( 'give_manager', 'export_give_reports' );
286
-			$wp_roles->remove_cap( 'give_manager', 'manage_give_settings' );
283
+			$wp_roles->remove_cap('give_manager', 'view_give_reports');
284
+			$wp_roles->remove_cap('give_manager', 'view_give_sensitive_data');
285
+			$wp_roles->remove_cap('give_manager', 'export_give_reports');
286
+			$wp_roles->remove_cap('give_manager', 'manage_give_settings');
287 287
 
288 288
 			// Site Administrator Capabilities.
289
-			$wp_roles->remove_cap( 'administrator', 'view_give_reports' );
290
-			$wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' );
291
-			$wp_roles->remove_cap( 'administrator', 'export_give_reports' );
292
-			$wp_roles->remove_cap( 'administrator', 'manage_give_settings' );
293
-			$wp_roles->remove_cap( 'administrator', 'view_give_payments' );
289
+			$wp_roles->remove_cap('administrator', 'view_give_reports');
290
+			$wp_roles->remove_cap('administrator', 'view_give_sensitive_data');
291
+			$wp_roles->remove_cap('administrator', 'export_give_reports');
292
+			$wp_roles->remove_cap('administrator', 'manage_give_settings');
293
+			$wp_roles->remove_cap('administrator', 'view_give_payments');
294 294
 
295 295
 			// Remove the Main Post Type Capabilities.
296 296
 			$capabilities = $this->get_core_caps();
297 297
 
298
-			foreach ( $capabilities as $cap_group ) {
299
-				foreach ( $cap_group as $cap ) {
300
-					$wp_roles->remove_cap( 'give_manager', $cap );
301
-					$wp_roles->remove_cap( 'administrator', $cap );
298
+			foreach ($capabilities as $cap_group) {
299
+				foreach ($cap_group as $cap) {
300
+					$wp_roles->remove_cap('give_manager', $cap);
301
+					$wp_roles->remove_cap('administrator', $cap);
302 302
 
303 303
 				}
304 304
 			}
305 305
 
306 306
 			// Remove capabilities from the Give Worker role.
307
-			$wp_roles->remove_cap( 'give_worker', 'edit_give_payments' );
308
-			$wp_roles->remove_cap( 'give_worker', 'delete_give_forms' );
309
-			$wp_roles->remove_cap( 'give_worker', 'delete_others_give_forms' );
310
-			$wp_roles->remove_cap( 'give_worker', 'delete_private_give_forms' );
311
-			$wp_roles->remove_cap( 'give_worker', 'delete_published_give_forms' );
312
-			$wp_roles->remove_cap( 'give_worker', 'edit_give_forms' );
313
-			$wp_roles->remove_cap( 'give_worker', 'edit_others_give_forms' );
314
-			$wp_roles->remove_cap( 'give_worker', 'edit_private_give_forms' );
315
-			$wp_roles->remove_cap( 'give_worker', 'edit_published_give_forms' );
316
-			$wp_roles->remove_cap( 'give_worker', 'publish_give_forms' );
317
-			$wp_roles->remove_cap( 'give_worker', 'read_private_give_forms' );
307
+			$wp_roles->remove_cap('give_worker', 'edit_give_payments');
308
+			$wp_roles->remove_cap('give_worker', 'delete_give_forms');
309
+			$wp_roles->remove_cap('give_worker', 'delete_others_give_forms');
310
+			$wp_roles->remove_cap('give_worker', 'delete_private_give_forms');
311
+			$wp_roles->remove_cap('give_worker', 'delete_published_give_forms');
312
+			$wp_roles->remove_cap('give_worker', 'edit_give_forms');
313
+			$wp_roles->remove_cap('give_worker', 'edit_others_give_forms');
314
+			$wp_roles->remove_cap('give_worker', 'edit_private_give_forms');
315
+			$wp_roles->remove_cap('give_worker', 'edit_published_give_forms');
316
+			$wp_roles->remove_cap('give_worker', 'publish_give_forms');
317
+			$wp_roles->remove_cap('give_worker', 'read_private_give_forms');
318 318
 
319 319
 			// Remove Capabilities from Give Accountant User Role.
320
-			$wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' );
321
-			$wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' );
322
-			$wp_roles->remove_cap( 'give_accountant', 'view_give_reports' );
323
-			$wp_roles->remove_cap( 'give_accountant', 'export_give_reports' );
324
-			$wp_roles->remove_cap( 'give_accountant', 'edit_give_payments' );
325
-			$wp_roles->remove_cap( 'give_accountant', 'view_give_payments' );
320
+			$wp_roles->remove_cap('give_accountant', 'edit_give_forms');
321
+			$wp_roles->remove_cap('give_accountant', 'read_private_give_forms');
322
+			$wp_roles->remove_cap('give_accountant', 'view_give_reports');
323
+			$wp_roles->remove_cap('give_accountant', 'export_give_reports');
324
+			$wp_roles->remove_cap('give_accountant', 'edit_give_payments');
325
+			$wp_roles->remove_cap('give_accountant', 'view_give_payments');
326 326
 
327 327
 		}
328 328
 	}
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 		$current_user = wp_get_current_user();
346 346
 
347 347
 		// If user with "Give Accountant" user role is logged-in .
348
-		if ( 0 !== $current_user->ID && in_array( 'give_accountant', (array) $current_user->roles, true ) ) {
348
+		if (0 !== $current_user->ID && in_array('give_accountant', (array) $current_user->roles, true)) {
349 349
 
350 350
 			// Return false, means no prevention.
351 351
 			return false;
Please login to merge, or discard this patch.
includes/currency-functions.php 1 patch
Spacing   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
  *
21 21
  * @return string The currency code
22 22
  */
23
-function give_get_currency( $donation_or_form_id = null, $args = array() ) {
23
+function give_get_currency($donation_or_form_id = null, $args = array()) {
24 24
 
25 25
 	// Get currency from donation
26
-	if ( is_numeric( $donation_or_form_id ) && 'give_payment' === get_post_type( $donation_or_form_id ) ) {
27
-		$donation_meta = give_get_meta( $donation_or_form_id, '_give_payment_meta', true );
26
+	if (is_numeric($donation_or_form_id) && 'give_payment' === get_post_type($donation_or_form_id)) {
27
+		$donation_meta = give_get_meta($donation_or_form_id, '_give_payment_meta', true);
28 28
 
29
-		if ( ! empty( $donation_meta['currency'] ) ) {
29
+		if ( ! empty($donation_meta['currency'])) {
30 30
 			$currency = $donation_meta['currency'];
31 31
 		} else {
32
-			$currency = give_get_option( 'currency', 'USD' );
32
+			$currency = give_get_option('currency', 'USD');
33 33
 		}
34 34
 	} else {
35
-		$currency = give_get_option( 'currency', 'USD' );
35
+		$currency = give_get_option('currency', 'USD');
36 36
 	}
37 37
 
38 38
 	/**
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @since 1.0
42 42
 	 */
43
-	return apply_filters( 'give_currency', $currency, $donation_or_form_id, $args );
43
+	return apply_filters('give_currency', $currency, $donation_or_form_id, $args);
44 44
 }
45 45
 
46 46
 /**
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
  */
53 53
 function give_get_currency_position() {
54 54
 
55
-	$currency_pos = give_get_option( 'currency_position', 'before' );
55
+	$currency_pos = give_get_option('currency_position', 'before');
56 56
 
57
-	return apply_filters( 'give_currency_position', $currency_pos );
57
+	return apply_filters('give_currency_position', $currency_pos);
58 58
 }
59 59
 
60 60
 /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 function give_get_currencies_list() {
68 68
 	$currencies = array(
69 69
 		'USD' => array(
70
-			'admin_label' => __( 'US Dollars ($)', 'give' ),
70
+			'admin_label' => __('US Dollars ($)', 'give'),
71 71
 			'symbol'      => '&#36;',
72 72
 			'setting'     => array(
73 73
 				'currency_position'   => 'before',
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			),
78 78
 		),
79 79
 		'EUR' => array(
80
-			'admin_label' => __( 'Euros (€)', 'give' ),
80
+			'admin_label' => __('Euros (€)', 'give'),
81 81
 			'symbol'      => '&euro;',
82 82
 			'setting'     => array(
83 83
 				'currency_position'   => 'before',
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 			),
88 88
 		),
89 89
 		'GBP' => array(
90
-			'admin_label' => __( 'Pounds Sterling (£)', 'give' ),
90
+			'admin_label' => __('Pounds Sterling (£)', 'give'),
91 91
 			'symbol'      => '&pound;',
92 92
 			'setting'     => array(
93 93
 				'currency_position'   => 'before',
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			),
98 98
 		),
99 99
 		'AUD' => array(
100
-			'admin_label' => __( 'Australian Dollars ($)', 'give' ),
100
+			'admin_label' => __('Australian Dollars ($)', 'give'),
101 101
 			'symbol'      => '&#36;',
102 102
 			'setting'     => array(
103 103
 				'currency_position'   => 'before',
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 			),
108 108
 		),
109 109
 		'BRL' => array(
110
-			'admin_label' => __( 'Brazilian Real (R$)', 'give' ),
110
+			'admin_label' => __('Brazilian Real (R$)', 'give'),
111 111
 			'symbol'      => '&#82;&#36;',
112 112
 			'setting'     => array(
113 113
 				'currency_position'   => 'before',
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 			),
118 118
 		),
119 119
 		'CAD' => array(
120
-			'admin_label' => __( 'Canadian Dollars ($)', 'give' ),
120
+			'admin_label' => __('Canadian Dollars ($)', 'give'),
121 121
 			'symbol'      => '&#36;',
122 122
 			'setting'     => array(
123 123
 				'currency_position'   => 'before',
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 			),
128 128
 		),
129 129
 		'CZK' => array(
130
-			'admin_label' => __( 'Czech Koruna (Kč)', 'give' ),
130
+			'admin_label' => __('Czech Koruna (Kč)', 'give'),
131 131
 			'symbol'      => '&#75;&#269;',
132 132
 			'setting'     => array(
133 133
 				'currency_position'   => 'after',
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			),
138 138
 		),
139 139
 		'DKK' => array(
140
-			'admin_label' => __( 'Danish Krone (kr.)', 'give' ),
140
+			'admin_label' => __('Danish Krone (kr.)', 'give'),
141 141
 			'symbol'      => '&nbsp;kr.&nbsp;',
142 142
 			'setting'     => array(
143 143
 				'currency_position'   => 'before',
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 			),
148 148
 		),
149 149
 		'HKD' => array(
150
-			'admin_label' => __( 'Hong Kong Dollar ($)', 'give' ),
150
+			'admin_label' => __('Hong Kong Dollar ($)', 'give'),
151 151
 			'symbol'      => '&#36;',
152 152
 			'setting'     => array(
153 153
 				'currency_position'   => 'before',
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 			),
158 158
 		),
159 159
 		'HUF' => array(
160
-			'admin_label' => __( 'Hungarian Forint (Ft)', 'give' ),
160
+			'admin_label' => __('Hungarian Forint (Ft)', 'give'),
161 161
 			'symbol'      => '&#70;&#116;',
162 162
 			'setting'     => array(
163 163
 				'currency_position'   => 'after',
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 			),
168 168
 		),
169 169
 		'ILS' => array(
170
-			'admin_label' => __( 'Israeli Shekel (₪)', 'give' ),
170
+			'admin_label' => __('Israeli Shekel (₪)', 'give'),
171 171
 			'symbol'      => '&#8362;',
172 172
 			'setting'     => array(
173 173
 				'currency_position'   => 'after',
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 			),
178 178
 		),
179 179
 		'JPY' => array(
180
-			'admin_label' => __( 'Japanese Yen (¥)', 'give' ),
180
+			'admin_label' => __('Japanese Yen (¥)', 'give'),
181 181
 			'symbol'      => '&yen;',
182 182
 			'setting'     => array(
183 183
 				'currency_position'   => 'before',
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 			),
188 188
 		),
189 189
 		'MYR' => array(
190
-			'admin_label' => __( 'Malaysian Ringgits (RM)', 'give' ),
190
+			'admin_label' => __('Malaysian Ringgits (RM)', 'give'),
191 191
 			'symbol'      => '&#82;&#77;',
192 192
 			'setting'     => array(
193 193
 				'currency_position'   => 'before',
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 			),
198 198
 		),
199 199
 		'MXN' => array(
200
-			'admin_label' => __( 'Mexican Peso ($)', 'give' ),
200
+			'admin_label' => __('Mexican Peso ($)', 'give'),
201 201
 			'symbol'      => '&#36;',
202 202
 			'setting'     => array(
203 203
 				'currency_position'   => 'before',
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 			),
208 208
 		),
209 209
 		'MAD' => array(
210
-			'admin_label' => __( 'Moroccan Dirham (&#x2e;&#x62f;&#x2e;&#x645;)', 'give' ),
210
+			'admin_label' => __('Moroccan Dirham (&#x2e;&#x62f;&#x2e;&#x645;)', 'give'),
211 211
 			'symbol'      => '&#x2e;&#x62f;&#x2e;&#x645;',
212 212
 			'setting'     => array(
213 213
 				'currency_position'   => 'before',
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			),
218 218
 		),
219 219
 		'NZD' => array(
220
-			'admin_label' => __( 'New Zealand Dollar ($)', 'give' ),
220
+			'admin_label' => __('New Zealand Dollar ($)', 'give'),
221 221
 			'symbol'      => '&#36;',
222 222
 			'setting'     => array(
223 223
 				'currency_position'   => 'before',
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 			),
228 228
 		),
229 229
 		'NOK' => array(
230
-			'admin_label' => __( 'Norwegian Krone (Kr.)', 'give' ),
230
+			'admin_label' => __('Norwegian Krone (Kr.)', 'give'),
231 231
 			'symbol'      => '&#107;&#114;.',
232 232
 			'setting'     => array(
233 233
 				'currency_position'   => 'before',
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 			),
238 238
 		),
239 239
 		'PHP' => array(
240
-			'admin_label' => __( 'Philippine Pesos (₱)', 'give' ),
240
+			'admin_label' => __('Philippine Pesos (₱)', 'give'),
241 241
 			'symbol'      => '&#8369;',
242 242
 			'setting'     => array(
243 243
 				'currency_position'   => 'before',
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 			),
248 248
 		),
249 249
 		'PLN' => array(
250
-			'admin_label' => __( 'Polish Zloty (zł)', 'give' ),
250
+			'admin_label' => __('Polish Zloty (zł)', 'give'),
251 251
 			'symbol'      => '&#122;&#322;',
252 252
 			'setting'     => array(
253 253
 				'currency_position'   => 'after',
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 			),
258 258
 		),
259 259
 		'SGD' => array(
260
-			'admin_label' => __( 'Singapore Dollar ($)', 'give' ),
260
+			'admin_label' => __('Singapore Dollar ($)', 'give'),
261 261
 			'symbol'      => '&#36;',
262 262
 			'setting'     => array(
263 263
 				'currency_position'   => 'before',
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 			),
268 268
 		),
269 269
 		'KRW' => array(
270
-			'admin_label' => __( 'South Korean Won (₩)', 'give' ),
270
+			'admin_label' => __('South Korean Won (₩)', 'give'),
271 271
 			'symbol'      => '&#8361;',
272 272
 			'setting'     => array(
273 273
 				'currency_position'   => 'before',
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			),
278 278
 		),
279 279
 		'ZAR' => array(
280
-			'admin_label' => __( 'South African Rand (R)', 'give' ),
280
+			'admin_label' => __('South African Rand (R)', 'give'),
281 281
 			'symbol'      => '&#82;',
282 282
 			'setting'     => array(
283 283
 				'currency_position'   => 'before',
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 			),
288 288
 		),
289 289
 		'SEK' => array(
290
-			'admin_label' => __( 'Swedish Krona (kr)', 'give' ),
290
+			'admin_label' => __('Swedish Krona (kr)', 'give'),
291 291
 			'symbol'      => '&nbsp;kr.&nbsp;',
292 292
 			'setting'     => array(
293 293
 				'currency_position'   => 'before',
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 			),
298 298
 		),
299 299
 		'CHF' => array(
300
-			'admin_label' => __( 'Swiss Franc (Fr)', 'give' ),
300
+			'admin_label' => __('Swiss Franc (Fr)', 'give'),
301 301
 			'symbol'      => '&#70;&#114;',
302 302
 			'setting'     => array(
303 303
 				'currency_position'   => 'before',
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 			),
308 308
 		),
309 309
 		'TWD' => array(
310
-			'admin_label' => __( 'Taiwan New Dollars (NT$)', 'give' ),
310
+			'admin_label' => __('Taiwan New Dollars (NT$)', 'give'),
311 311
 			'symbol'      => '&#78;&#84;&#36;',
312 312
 			'setting'     => array(
313 313
 				'currency_position'   => 'before',
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 			),
318 318
 		),
319 319
 		'THB' => array(
320
-			'admin_label' => __( 'Thai Baht (฿)', 'give' ),
320
+			'admin_label' => __('Thai Baht (฿)', 'give'),
321 321
 			'symbol'      => '&#3647;',
322 322
 			'setting'     => array(
323 323
 				'currency_position'   => 'before',
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 			),
328 328
 		),
329 329
 		'INR' => array(
330
-			'admin_label' => __( 'Indian Rupee (₹)', 'give' ),
330
+			'admin_label' => __('Indian Rupee (₹)', 'give'),
331 331
 			'symbol'      => '&#8377;',
332 332
 			'setting'     => array(
333 333
 				'currency_position'   => 'before',
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 			),
338 338
 		),
339 339
 		'TRY' => array(
340
-			'admin_label' => __( 'Turkish Lira (₺)', 'give' ),
340
+			'admin_label' => __('Turkish Lira (₺)', 'give'),
341 341
 			'symbol'      => '&#8378;',
342 342
 			'setting'     => array(
343 343
 				'currency_position'   => 'after',
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 			),
348 348
 		),
349 349
 		'IRR' => array(
350
-			'admin_label' => __( 'Iranian Rial (﷼)', 'give' ),
350
+			'admin_label' => __('Iranian Rial (﷼)', 'give'),
351 351
 			'symbol'      => '&#xfdfc;',
352 352
 			'setting'     => array(
353 353
 				'currency_position'   => 'after',
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 			),
358 358
 		),
359 359
 		'RUB' => array(
360
-			'admin_label' => __( 'Russian Rubles (руб)', 'give' ),
360
+			'admin_label' => __('Russian Rubles (руб)', 'give'),
361 361
 			'symbol'      => '&#8381;',
362 362
 			'setting'     => array(
363 363
 				'currency_position'   => 'before',
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 			),
368 368
 		),
369 369
 		'AED' => array(
370
-			'admin_label' => __( 'United Arab Emirates dirham (د.إ)', 'give' ),
370
+			'admin_label' => __('United Arab Emirates dirham (د.إ)', 'give'),
371 371
 			'symbol'      => '&#x62f;.&#x625;',
372 372
 			'setting'     => array(
373 373
 				'currency_position'   => 'before',
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 			),
378 378
 		),
379 379
 		'AMD' => array(
380
-			'admin_label' => __( 'Armenian dram (AMD)', 'give' ),
380
+			'admin_label' => __('Armenian dram (AMD)', 'give'),
381 381
 			'symbol'      => 'AMD', // Add backward compatibility. Using AMD in place of &#1423;
382 382
 			'setting'     => array(
383 383
 				'currency_position'   => 'before',
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 			),
388 388
 		),
389 389
 		'ANG' => array(
390
-			'admin_label' => __( 'Netherlands Antillean guilder (ƒ)', 'give' ),
390
+			'admin_label' => __('Netherlands Antillean guilder (ƒ)', 'give'),
391 391
 			'symbol'      => '&#402;',
392 392
 			'setting'     => array(
393 393
 				'currency_position'   => 'before',
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 			),
398 398
 		),
399 399
 		'ARS' => array(
400
-			'admin_label' => __( 'Argentine peso ($)', 'give' ),
400
+			'admin_label' => __('Argentine peso ($)', 'give'),
401 401
 			'symbol'      => '&#36;',
402 402
 			'setting'     => array(
403 403
 				'currency_position'   => 'before',
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 			),
408 408
 		),
409 409
 		'AWG' => array(
410
-			'admin_label' => __( 'Aruban florin (ƒ)', 'give' ),
410
+			'admin_label' => __('Aruban florin (ƒ)', 'give'),
411 411
 			'symbol'      => '&#402;',
412 412
 			'setting'     => array(
413 413
 				'currency_position'   => 'before',
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 			),
418 418
 		),
419 419
 		'BAM' => array(
420
-			'admin_label' => __( 'Bosnia and Herzegovina convertible mark (KM)', 'give' ),
420
+			'admin_label' => __('Bosnia and Herzegovina convertible mark (KM)', 'give'),
421 421
 			'symbol'      => '&#75;&#77;',
422 422
 			'setting'     => array(
423 423
 				'currency_position'   => 'before',
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 			),
428 428
 		),
429 429
 		'BDT' => array(
430
-			'admin_label' => __( 'Bangladeshi taka (৳)', 'give' ),
430
+			'admin_label' => __('Bangladeshi taka (৳)', 'give'),
431 431
 			'symbol'      => '&#2547;',
432 432
 			'setting'     => array(
433 433
 				'currency_position'   => 'before',
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 			),
438 438
 		),
439 439
 		'BHD' => array(
440
-			'admin_label' => __( 'Bahraini dinar (.د.ب)', 'give' ),
440
+			'admin_label' => __('Bahraini dinar (.د.ب)', 'give'),
441 441
 			'symbol'      => '.&#x62f;.&#x628;',
442 442
 			'setting'     => array(
443 443
 				'currency_position'   => 'before',
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 			),
448 448
 		),
449 449
 		'BMD' => array(
450
-			'admin_label' => __( 'Bermudian dollar (BD$)', 'give' ),
450
+			'admin_label' => __('Bermudian dollar (BD$)', 'give'),
451 451
 			'symbol'      => '&#66;&#68;&#36;',
452 452
 			'setting'     => array(
453 453
 				'currency_position'   => 'before',
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 			),
458 458
 		),
459 459
 		'BND' => array(
460
-			'admin_label' => __( 'Brunei dollar (B$)', 'give' ),
460
+			'admin_label' => __('Brunei dollar (B$)', 'give'),
461 461
 			'symbol'      => '&#66;&#36;',
462 462
 			'setting'     => array(
463 463
 				'currency_position'   => 'before',
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 			),
468 468
 		),
469 469
 		'BOB' => array(
470
-			'admin_label' => __( 'Bolivian boliviano (Bs.)', 'give' ),
470
+			'admin_label' => __('Bolivian boliviano (Bs.)', 'give'),
471 471
 			'symbol'      => '&#66;&#115;&#46;',
472 472
 			'setting'     => array(
473 473
 				'currency_position'   => 'before',
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 			),
478 478
 		),
479 479
 		'BSD' => array(
480
-			'admin_label' => __( 'Bahamian dollar (B$)', 'give' ),
480
+			'admin_label' => __('Bahamian dollar (B$)', 'give'),
481 481
 			'symbol'      => '&#66;&#36;',
482 482
 			'setting'     => array(
483 483
 				'currency_position'   => 'before',
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 			),
488 488
 		),
489 489
 		'BWP' => array(
490
-			'admin_label' => __( 'Botswana pula (P)', 'give' ),
490
+			'admin_label' => __('Botswana pula (P)', 'give'),
491 491
 			'symbol'      => '&#80;',
492 492
 			'setting'     => array(
493 493
 				'currency_position'   => 'before',
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 			),
498 498
 		),
499 499
 		'BZD' => array(
500
-			'admin_label' => __( 'Belizean dollar (BZ$)', 'give' ),
500
+			'admin_label' => __('Belizean dollar (BZ$)', 'give'),
501 501
 			'symbol'      => '&#66;&#90;&#36;',
502 502
 			'setting'     => array(
503 503
 				'currency_position'   => 'before',
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 			),
508 508
 		),
509 509
 		'CLP' => array(
510
-			'admin_label' => __( 'Chilean peso ($)', 'give' ),
510
+			'admin_label' => __('Chilean peso ($)', 'give'),
511 511
 			'symbol'      => '&#36;',
512 512
 			'setting'     => array(
513 513
 				'currency_position'   => 'before',
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 			),
518 518
 		),
519 519
 		'CNY' => array(
520
-			'admin_label' => __( 'Chinese yuan (¥)', 'give' ),
520
+			'admin_label' => __('Chinese yuan (¥)', 'give'),
521 521
 			'symbol'      => '&yen;',
522 522
 			'setting'     => array(
523 523
 				'currency_position'   => 'before',
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 			),
528 528
 		),
529 529
 		'COP' => array(
530
-			'admin_label' => __( 'Colombian peso ($)', 'give' ),
530
+			'admin_label' => __('Colombian peso ($)', 'give'),
531 531
 			'symbol'      => '&#36;',
532 532
 			'setting'     => array(
533 533
 				'currency_position'   => 'before',
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 			),
538 538
 		),
539 539
 		'CRC' => array(
540
-			'admin_label' => __( 'Costa Rican colón (₡)', 'give' ),
540
+			'admin_label' => __('Costa Rican colón (₡)', 'give'),
541 541
 			'symbol'      => '&#8353;',
542 542
 			'setting'     => array(
543 543
 				'currency_position'   => 'before',
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 			),
548 548
 		),
549 549
 		'CUC' => array(
550
-			'admin_label' => __( 'Cuban convertible peso (₱)', 'give' ),
550
+			'admin_label' => __('Cuban convertible peso (₱)', 'give'),
551 551
 			'symbol'      => '&#8369;',
552 552
 			'setting'     => array(
553 553
 				'currency_position'   => 'before',
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 			),
558 558
 		),
559 559
 		'CUP' => array(
560
-			'admin_label' => __( 'Cuban convertible peso (₱)', 'give' ),
560
+			'admin_label' => __('Cuban convertible peso (₱)', 'give'),
561 561
 			'symbol'      => '&#8369;',
562 562
 			'setting'     => array(
563 563
 				'currency_position'   => 'before',
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 			),
568 568
 		),
569 569
 		'DOP' => array(
570
-			'admin_label' => __( 'Dominican peso (RD$)', 'give' ),
570
+			'admin_label' => __('Dominican peso (RD$)', 'give'),
571 571
 			'symbol'      => '&#82;&#68;&#36;',
572 572
 			'setting'     => array(
573 573
 				'currency_position'   => 'before',
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 			),
578 578
 		),
579 579
 		'EGP' => array(
580
-			'admin_label' => __( 'Egyptian pound (E£)', 'give' ),
580
+			'admin_label' => __('Egyptian pound (E£)', 'give'),
581 581
 			'symbol'      => '&#69;&pound;',
582 582
 			'setting'     => array(
583 583
 				'currency_position'   => 'before',
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 			),
588 588
 		),
589 589
 		'GIP' => array(
590
-			'admin_label' => __( 'Gibraltar pound (£)', 'give' ),
590
+			'admin_label' => __('Gibraltar pound (£)', 'give'),
591 591
 			'symbol'      => '&pound;',
592 592
 			'setting'     => array(
593 593
 				'currency_position'   => 'before',
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 			),
598 598
 		),
599 599
 		'GTQ' => array(
600
-			'admin_label' => __( 'Guatemalan quetzal (Q)', 'give' ),
600
+			'admin_label' => __('Guatemalan quetzal (Q)', 'give'),
601 601
 			'symbol'      => '&#81;',
602 602
 			'setting'     => array(
603 603
 				'currency_position'   => 'before',
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 			),
608 608
 		),
609 609
 		'HNL' => array(
610
-			'admin_label' => __( 'Honduran lempira (L)', 'give' ),
610
+			'admin_label' => __('Honduran lempira (L)', 'give'),
611 611
 			'symbol'      => '&#76;',
612 612
 			'setting'     => array(
613 613
 				'currency_position'   => 'before',
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 			),
618 618
 		),
619 619
 		'HRK' => array(
620
-			'admin_label' => __( 'Croatian kuna (kn)', 'give' ),
620
+			'admin_label' => __('Croatian kuna (kn)', 'give'),
621 621
 			'symbol'      => '&#107;&#110;',
622 622
 			'setting'     => array(
623 623
 				'currency_position'   => 'after',
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 			),
628 628
 		),
629 629
 		'IDR' => array(
630
-			'admin_label' => __( 'Indonesian rupiah (Rp)', 'give' ),
630
+			'admin_label' => __('Indonesian rupiah (Rp)', 'give'),
631 631
 			'symbol'      => '&#82;&#112;',
632 632
 			'setting'     => array(
633 633
 				'currency_position'   => 'before',
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 			),
638 638
 		),
639 639
 		'ISK' => array(
640
-			'admin_label' => __( 'Icelandic króna (kr)', 'give' ),
640
+			'admin_label' => __('Icelandic króna (kr)', 'give'),
641 641
 			'symbol'      => '&#107;&#114;',
642 642
 			'setting'     => array(
643 643
 				'currency_position'   => 'after',
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 			),
648 648
 		),
649 649
 		'JMD' => array(
650
-			'admin_label' => __( 'Jamaican dollar (J$)', 'give' ),
650
+			'admin_label' => __('Jamaican dollar (J$)', 'give'),
651 651
 			'symbol'      => '&#106;&#36;',
652 652
 			'setting'     => array(
653 653
 				'currency_position'   => 'before',
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 			),
658 658
 		),
659 659
 		'JOD' => array(
660
-			'admin_label' => __( 'Jordanian dinar (د.ا)', 'give' ),
660
+			'admin_label' => __('Jordanian dinar (د.ا)', 'give'),
661 661
 			'symbol'      => '&#x62f;.&#x627;',
662 662
 			'setting'     => array(
663 663
 				'currency_position'   => 'before',
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 			),
668 668
 		),
669 669
 		'KES' => array(
670
-			'admin_label' => __( 'Kenyan shilling (KSh)', 'give' ),
670
+			'admin_label' => __('Kenyan shilling (KSh)', 'give'),
671 671
 			'symbol'      => '&#75;&#83;&#104;',
672 672
 			'setting'     => array(
673 673
 				'currency_position'   => 'before',
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 			),
678 678
 		),
679 679
 		'KWD' => array(
680
-			'admin_label' => __( 'Kuwaiti dinar (د.ك)', 'give' ),
680
+			'admin_label' => __('Kuwaiti dinar (د.ك)', 'give'),
681 681
 			'symbol'      => '&#x62f;.&#x643;',
682 682
 			'setting'     => array(
683 683
 				'currency_position'   => 'before',
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 			),
688 688
 		),
689 689
 		'KYD' => array(
690
-			'admin_label' => __( 'Cayman Islands dollar (KY$)', 'give' ),
690
+			'admin_label' => __('Cayman Islands dollar (KY$)', 'give'),
691 691
 			'symbol'      => '&#75;&#89;&#36;',
692 692
 			'setting'     => array(
693 693
 				'currency_position'   => 'before',
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 			),
698 698
 		),
699 699
 		'MKD' => array(
700
-			'admin_label' => __( 'Macedonian denar (ден)', 'give' ),
700
+			'admin_label' => __('Macedonian denar (ден)', 'give'),
701 701
 			'symbol'      => '&#x434;&#x435;&#x43d;',
702 702
 			'setting'     => array(
703 703
 				'currency_position'   => 'before',
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 			),
708 708
 		),
709 709
 		'NPR' => array(
710
-			'admin_label' => __( 'Nepalese rupee (NɌs)', 'give' ),
710
+			'admin_label' => __('Nepalese rupee (NɌs)', 'give'),
711 711
 			'symbol'      => '&#8360;',
712 712
 			'setting'     => array(
713 713
 				'currency_position'   => 'before',
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 			),
718 718
 		),
719 719
 		'OMR' => array(
720
-			'admin_label' => __( 'Omani rial (ر.ع.)', 'give' ),
720
+			'admin_label' => __('Omani rial (ر.ع.)', 'give'),
721 721
 			'symbol'      => '&#x631;.&#x639;&#46;',
722 722
 			'setting'     => array(
723 723
 				'currency_position'   => 'before',
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 			),
728 728
 		),
729 729
 		'PEN' => array(
730
-			'admin_label' => __( 'Peruvian nuevo sol (S/.)', 'give' ),
730
+			'admin_label' => __('Peruvian nuevo sol (S/.)', 'give'),
731 731
 			'symbol'      => 'S/.',
732 732
 			'setting'     => array(
733 733
 				'currency_position'   => 'before',
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 			),
738 738
 		),
739 739
 		'PKR' => array(
740
-			'admin_label' => __( 'Pakistani rupee (Ɍs)', 'give' ),
740
+			'admin_label' => __('Pakistani rupee (Ɍs)', 'give'),
741 741
 			'symbol'      => '&#8360;',
742 742
 			'setting'     => array(
743 743
 				'currency_position'   => 'before',
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 			),
748 748
 		),
749 749
 		'RON' => array(
750
-			'admin_label' => __( 'Romanian leu (L)', 'give' ),
750
+			'admin_label' => __('Romanian leu (L)', 'give'),
751 751
 			'symbol'      => '&#76;',
752 752
 			'setting'     => array(
753 753
 				'currency_position'   => 'after',
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 			),
758 758
 		),
759 759
 		'SAR' => array(
760
-			'admin_label' => __( 'Saudi riyal (ر.س)', 'give' ),
760
+			'admin_label' => __('Saudi riyal (ر.س)', 'give'),
761 761
 			'symbol'      => '&#x631;.&#x633;',
762 762
 			'setting'     => array(
763 763
 				'currency_position'   => 'before',
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 			),
768 768
 		),
769 769
 		'SZL' => array(
770
-			'admin_label' => __( 'Swazi lilangeni (L)', 'give' ),
770
+			'admin_label' => __('Swazi lilangeni (L)', 'give'),
771 771
 			'symbol'      => '&#76;',
772 772
 			'setting'     => array(
773 773
 				'currency_position'   => 'before',
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 			),
778 778
 		),
779 779
 		'TOP' => array(
780
-			'admin_label' => __( 'Tongan paʻanga (T$)', 'give' ),
780
+			'admin_label' => __('Tongan paʻanga (T$)', 'give'),
781 781
 			'symbol'      => '&#84;&#36;',
782 782
 			'setting'     => array(
783 783
 				'currency_position'   => 'before',
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 			),
788 788
 		),
789 789
 		'TZS' => array(
790
-			'admin_label' => __( 'Tanzanian shilling (TSh)', 'give' ),
790
+			'admin_label' => __('Tanzanian shilling (TSh)', 'give'),
791 791
 			'symbol'      => '&#84;&#83;&#104;',
792 792
 			'setting'     => array(
793 793
 				'currency_position'   => 'before',
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 			),
798 798
 		),
799 799
 		'UAH' => array(
800
-			'admin_label' => __( 'Ukrainian hryvnia (₴)', 'give' ),
800
+			'admin_label' => __('Ukrainian hryvnia (₴)', 'give'),
801 801
 			'symbol'      => '&#8372;',
802 802
 			'setting'     => array(
803 803
 				'currency_position'   => 'before',
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
 			),
808 808
 		),
809 809
 		'UYU' => array(
810
-			'admin_label' => __( 'Uruguayan peso ($U)', 'give' ),
810
+			'admin_label' => __('Uruguayan peso ($U)', 'give'),
811 811
 			'symbol'      => '&#36;&#85;',
812 812
 			'setting'     => array(
813 813
 				'currency_position'   => 'before',
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
 			),
818 818
 		),
819 819
 		'VEF' => array(
820
-			'admin_label' => __( 'Venezuelan bolívar (Bs)', 'give' ),
820
+			'admin_label' => __('Venezuelan bolívar (Bs)', 'give'),
821 821
 			'symbol'      => '&#66;&#115;',
822 822
 			'setting'     => array(
823 823
 				'currency_position'   => 'before',
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 			),
828 828
 		),
829 829
 		'XCD' => array(
830
-			'admin_label' => __( 'East Caribbean dollar (EC$)', 'give' ),
830
+			'admin_label' => __('East Caribbean dollar (EC$)', 'give'),
831 831
 			'symbol'      => '&#69;&#67;&#36;',
832 832
 			'setting'     => array(
833 833
 				'currency_position'   => 'before',
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
 	 *
853 853
 	 * @param array $currencies
854 854
 	 */
855
-	return (array) apply_filters( 'give_currencies', $currencies );
855
+	return (array) apply_filters('give_currencies', $currencies);
856 856
 }
857 857
 
858 858
 /**
@@ -864,22 +864,22 @@  discard block
 block discarded – undo
864 864
  *
865 865
  * @return array $currencies A list of the available currencies
866 866
  */
867
-function give_get_currencies( $info = 'admin_label' ) {
867
+function give_get_currencies($info = 'admin_label') {
868 868
 
869 869
 	$currencies = give_get_currencies_list();
870 870
 
871 871
 	// Backward compatibility: handle old way of currency registration.
872 872
 	// Backward compatibility: Return desired result.
873
-	if ( ! empty( $currencies ) ) {
874
-		foreach ( $currencies as $currency_code => $currency_setting ) {
875
-			if ( is_string( $currency_setting ) ) {
876
-				$currencies[ $currency_code ] = array(
873
+	if ( ! empty($currencies)) {
874
+		foreach ($currencies as $currency_code => $currency_setting) {
875
+			if (is_string($currency_setting)) {
876
+				$currencies[$currency_code] = array(
877 877
 					'admin_label' => $currency_setting,
878 878
 				);
879 879
 			}
880 880
 
881
-			$currencies[ $currency_code ] = wp_parse_args(
882
-				$currencies[ $currency_code ],
881
+			$currencies[$currency_code] = wp_parse_args(
882
+				$currencies[$currency_code],
883 883
 				array(
884 884
 					'admin_label' => '',
885 885
 					'symbol'      => $currency_code,
@@ -888,8 +888,8 @@  discard block
 block discarded – undo
888 888
 			);
889 889
 		}
890 890
 
891
-		if ( ! empty( $info ) && is_string( $info ) && 'all' !== $info ) {
892
-			$currencies = wp_list_pluck( $currencies, $info );
891
+		if ( ! empty($info) && is_string($info) && 'all' !== $info) {
892
+			$currencies = wp_list_pluck($currencies, $info);
893 893
 		}
894 894
 	}
895 895
 
@@ -906,12 +906,12 @@  discard block
 block discarded – undo
906 906
  *
907 907
  * @return array
908 908
  */
909
-function give_currency_symbols( $decode_currencies = false ) {
910
-	$currencies = give_get_currencies( 'symbol' );
909
+function give_currency_symbols($decode_currencies = false) {
910
+	$currencies = give_get_currencies('symbol');
911 911
 
912
-	if ( $decode_currencies ) {
913
-		array_walk( $currencies, function ( &$currency_symbol ) {
914
-			$currency_symbol = html_entity_decode( $currency_symbol, ENT_COMPAT, 'UTF-8' );
912
+	if ($decode_currencies) {
913
+		array_walk($currencies, function(&$currency_symbol) {
914
+			$currency_symbol = html_entity_decode($currency_symbol, ENT_COMPAT, 'UTF-8');
915 915
 		} );
916 916
 	}
917 917
 
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 	 *
923 923
 	 * @param array $currencies
924 924
 	 */
925
-	return apply_filters( 'give_currency_symbols', $currencies );
925
+	return apply_filters('give_currency_symbols', $currencies);
926 926
 }
927 927
 
928 928
 
@@ -939,14 +939,14 @@  discard block
 block discarded – undo
939 939
  *
940 940
  * @return string           The symbol to use for the currency
941 941
  */
942
-function give_currency_symbol( $currency = '', $decode_currency = false ) {
942
+function give_currency_symbol($currency = '', $decode_currency = false) {
943 943
 
944
-	if ( empty( $currency ) ) {
944
+	if (empty($currency)) {
945 945
 		$currency = give_get_currency();
946 946
 	}
947 947
 
948
-	$currencies = give_currency_symbols( $decode_currency );
949
-	$symbol     = array_key_exists( $currency, $currencies ) ? $currencies[ $currency ] : $currency;
948
+	$currencies = give_currency_symbols($decode_currency);
949
+	$symbol     = array_key_exists($currency, $currencies) ? $currencies[$currency] : $currency;
950 950
 
951 951
 	/**
952 952
 	 * Filter the currency symbol
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 	 * @param string $symbol
957 957
 	 * @param string $currency
958 958
 	 */
959
-	return apply_filters( 'give_currency_symbol', $symbol, $currency );
959
+	return apply_filters('give_currency_symbol', $symbol, $currency);
960 960
 }
961 961
 
962 962
 
@@ -969,13 +969,13 @@  discard block
 block discarded – undo
969 969
  *
970 970
  * @return string
971 971
  */
972
-function give_get_currency_name( $currency_code ) {
972
+function give_get_currency_name($currency_code) {
973 973
 	$currency_name  = '';
974 974
 	$currency_names = give_get_currencies();
975 975
 
976
-	if ( $currency_code && array_key_exists( $currency_code, $currency_names ) ) {
977
-		$currency_name = explode( '(', $currency_names[ $currency_code ] );
978
-		$currency_name = trim( current( $currency_name ) );
976
+	if ($currency_code && array_key_exists($currency_code, $currency_names)) {
977
+		$currency_name = explode('(', $currency_names[$currency_code]);
978
+		$currency_name = trim(current($currency_name));
979 979
 	}
980 980
 
981 981
 	/**
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
 	 * @param string $currency_name
987 987
 	 * @param string $currency_code
988 988
 	 */
989
-	return apply_filters( 'give_currency_name', $currency_name, $currency_code );
989
+	return apply_filters('give_currency_name', $currency_name, $currency_code);
990 990
 }
991 991
 
992 992
 /**
@@ -999,20 +999,20 @@  discard block
 block discarded – undo
999 999
  *
1000 1000
  * @return mixed|string
1001 1001
  */
1002
-function give_currency_filter( $price = '', $args = array() ) {
1002
+function give_currency_filter($price = '', $args = array()) {
1003 1003
 
1004 1004
 	// Get functions arguments.
1005 1005
 	$func_args = func_get_args();
1006 1006
 
1007 1007
 	// Backward compatibility: modify second param to array
1008
-	if ( isset( $func_args[1] ) && is_string( $func_args[1] ) ) {
1008
+	if (isset($func_args[1]) && is_string($func_args[1])) {
1009 1009
 		$args = array(
1010
-			'currency_code'   => isset( $func_args[1] ) ? $func_args[1] : '',
1011
-			'decode_currency' => isset( $func_args[2] ) ? $func_args[2] : false,
1012
-			'form_id'         => isset( $func_args[3] ) ? $func_args[3] : '',
1010
+			'currency_code'   => isset($func_args[1]) ? $func_args[1] : '',
1011
+			'decode_currency' => isset($func_args[2]) ? $func_args[2] : false,
1012
+			'form_id'         => isset($func_args[3]) ? $func_args[3] : '',
1013 1013
 		);
1014 1014
 
1015
-		give_doing_it_wrong( __FUNCTION__, 'Pass second argument as Array.', GIVE_VERSION );
1015
+		give_doing_it_wrong(__FUNCTION__, 'Pass second argument as Array.', GIVE_VERSION);
1016 1016
 	}
1017 1017
 
1018 1018
 	// Set default values.
@@ -1025,22 +1025,22 @@  discard block
 block discarded – undo
1025 1025
 		)
1026 1026
 	);
1027 1027
 
1028
-	if ( empty( $args['currency_code'] ) || ! array_key_exists( (string) $args['currency_code'], give_get_currencies() ) ) {
1029
-		$args['currency_code'] = give_get_currency( $args['form_id'] );
1028
+	if (empty($args['currency_code']) || ! array_key_exists((string) $args['currency_code'], give_get_currencies())) {
1029
+		$args['currency_code'] = give_get_currency($args['form_id']);
1030 1030
 	}
1031 1031
 
1032
-	$args['position'] = give_get_option( 'currency_position', 'before' );
1032
+	$args['position'] = give_get_option('currency_position', 'before');
1033 1033
 
1034 1034
 	$negative = $price < 0;
1035 1035
 
1036
-	if ( $negative ) {
1036
+	if ($negative) {
1037 1037
 		// Remove proceeding "-".
1038
-		$price = substr( $price, 1 );
1038
+		$price = substr($price, 1);
1039 1039
 	}
1040 1040
 
1041
-	$args['symbol'] = give_currency_symbol( $args['currency_code'], $args['decode_currency'] );
1041
+	$args['symbol'] = give_currency_symbol($args['currency_code'], $args['decode_currency']);
1042 1042
 
1043
-	switch ( $args['currency_code'] ) :
1043
+	switch ($args['currency_code']) :
1044 1044
 		case 'GBP' :
1045 1045
 		case 'BRL' :
1046 1046
 		case 'EUR' :
@@ -1070,13 +1070,13 @@  discard block
 block discarded – undo
1070 1070
 		case 'MAD' :
1071 1071
 		case 'KRW' :
1072 1072
 		case 'ZAR' :
1073
-			$formatted = ( 'before' === $args['position'] ? $args['symbol'] . $price : $price . $args['symbol'] );
1073
+			$formatted = ('before' === $args['position'] ? $args['symbol'].$price : $price.$args['symbol']);
1074 1074
 			break;
1075 1075
 		case 'NOK':
1076
-			$formatted = ( 'before' === $args['position'] ? $args['symbol'] . ' ' . $price : $price . ' ' . $args['symbol'] );
1076
+			$formatted = ('before' === $args['position'] ? $args['symbol'].' '.$price : $price.' '.$args['symbol']);
1077 1077
 			break;
1078 1078
 		default:
1079
-			$formatted = ( 'before' === $args['position'] ? $args['symbol'] . ' ' . $price : $price . ' ' . $args['symbol'] );
1079
+			$formatted = ('before' === $args['position'] ? $args['symbol'].' '.$price : $price.' '.$args['symbol']);
1080 1080
 			break;
1081 1081
 	endswitch;
1082 1082
 
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 	 *
1086 1086
 	 * @since 1.8.17
1087 1087
 	 */
1088
-	$formatted = apply_filters( 'give_currency_filter', $formatted, $args, $price );
1088
+	$formatted = apply_filters('give_currency_filter', $formatted, $args, $price);
1089 1089
 
1090 1090
 	/**
1091 1091
 	 * Filter formatted amount with currency
@@ -1099,16 +1099,16 @@  discard block
 block discarded – undo
1099 1099
 	 *           filter name will be give_usd_currency_filter_after
1100 1100
 	 */
1101 1101
 	$formatted = apply_filters(
1102
-		'give_' . strtolower( $args['currency_code'] ) . "_currency_filter_{$args['position']}",
1102
+		'give_'.strtolower($args['currency_code'])."_currency_filter_{$args['position']}",
1103 1103
 		$formatted,
1104 1104
 		$args['currency_code'],
1105 1105
 		$price,
1106 1106
 		$args
1107 1107
 	);
1108 1108
 
1109
-	if ( $negative ) {
1109
+	if ($negative) {
1110 1110
 		// Prepend the minus sign before the currency sign.
1111
-		$formatted = '-' . $formatted;
1111
+		$formatted = '-'.$formatted;
1112 1112
 	}
1113 1113
 
1114 1114
 	return $formatted;
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
  *
1126 1126
  * @return bool
1127 1127
  */
1128
-function give_is_zero_based_currency( $currency = '' ) {
1128
+function give_is_zero_based_currency($currency = '') {
1129 1129
 	$zero_based_currency = array(
1130 1130
 		'PYG', // Paraguayan Guarani.
1131 1131
 		'GNF', // Guinean Franc.
@@ -1145,12 +1145,12 @@  discard block
 block discarded – undo
1145 1145
 	);
1146 1146
 
1147 1147
 	// Set default currency.
1148
-	if ( empty( $currency ) ) {
1148
+	if (empty($currency)) {
1149 1149
 		$currency = give_get_currency();
1150 1150
 	}
1151 1151
 
1152 1152
 	// Check for Zero Based Currency.
1153
-	if ( in_array( $currency, $zero_based_currency ) ) {
1153
+	if (in_array($currency, $zero_based_currency)) {
1154 1154
 		return true;
1155 1155
 	}
1156 1156
 
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
  *
1166 1166
  * @return bool
1167 1167
  */
1168
-function give_is_right_to_left_supported_currency( $currency = '' ) {
1168
+function give_is_right_to_left_supported_currency($currency = '') {
1169 1169
 	$zero_based_currency = apply_filters(
1170 1170
 		'give_right_to_left_supported_currency',
1171 1171
 		array(
@@ -1181,12 +1181,12 @@  discard block
 block discarded – undo
1181 1181
 	);
1182 1182
 
1183 1183
 	// Set default currency.
1184
-	if ( empty( $currency ) ) {
1184
+	if (empty($currency)) {
1185 1185
 		$currency = give_get_currency();
1186 1186
 	}
1187 1187
 
1188 1188
 	// Check for Zero Based Currency.
1189
-	if ( in_array( $currency, $zero_based_currency ) ) {
1189
+	if (in_array($currency, $zero_based_currency)) {
1190 1190
 		return true;
1191 1191
 	}
1192 1192
 
Please login to merge, or discard this patch.
templates/shortcode-profile-editor.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -182,7 +182,9 @@
 block discarded – undo
182 182
 	?>
183 183
 
184 184
 	<?php
185
-else:
185
+else {
186
+	:
186 187
 	_e( 'You need to login to edit your profile.', 'give' );
188
+}
187 189
 	echo give_login_form();
188 190
 endif;
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -7,22 +7,22 @@  discard block
 block discarded – undo
7 7
  * @copyright    Copyright (c) 2016, WordImpress
8 8
  * @license      https://opensource.org/licenses/gpl-license GNU Public License
9 9
  */
10
-$current_user     = wp_get_current_user();
10
+$current_user = wp_get_current_user();
11 11
 
12
-if ( is_user_logged_in() ):
12
+if (is_user_logged_in()):
13 13
 	$user_id = get_current_user_id();
14
-	$first_name   = get_user_meta( $user_id, 'first_name', true );
15
-	$last_name    = get_user_meta( $user_id, 'last_name', true );
14
+	$first_name   = get_user_meta($user_id, 'first_name', true);
15
+	$last_name    = get_user_meta($user_id, 'last_name', true);
16 16
 	$display_name = $current_user->display_name;
17
-	$address      = give_get_donor_address( $user_id, array( 'address_type' => 'personal' ) );
17
+	$address      = give_get_donor_address($user_id, array('address_type' => 'personal'));
18 18
 
19
-	if ( isset( $_GET['updated'] ) && $_GET['updated'] == true && ! give_get_errors() ): ?>
19
+	if (isset($_GET['updated']) && $_GET['updated'] == true && ! give_get_errors()): ?>
20 20
 		<p class="give_success">
21
-			<strong><?php esc_html_e( 'Success:', 'give' ); ?></strong> <?php esc_html_e( 'Your profile has been updated.', 'give' ); ?>
21
+			<strong><?php esc_html_e('Success:', 'give'); ?></strong> <?php esc_html_e('Your profile has been updated.', 'give'); ?>
22 22
 		</p>
23 23
 	<?php endif; ?>
24 24
 
25
-	<?php Give()->notices->render_frontend_notices( 0 ); ?>
25
+	<?php Give()->notices->render_frontend_notices(0); ?>
26 26
 
27 27
 	<?php
28 28
 	/**
@@ -32,42 +32,42 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @since 1.0
34 34
 	 */
35
-	do_action( 'give_profile_editor_before' );
35
+	do_action('give_profile_editor_before');
36 36
 	?>
37 37
 
38 38
 	<form id="give_profile_editor_form" class="give-form" action="<?php echo give_get_current_page_url(); ?>" method="post">
39 39
 
40 40
 		<fieldset>
41
-			<legend id="give_profile_name_label"><?php _e( 'Profile', 'give' ); ?></legend>
41
+			<legend id="give_profile_name_label"><?php _e('Profile', 'give'); ?></legend>
42 42
 
43
-			<h3 id="give_personal_information_label" class="give-section-break"><?php _e( 'Change your Name', 'give' ); ?></h3>
43
+			<h3 id="give_personal_information_label" class="give-section-break"><?php _e('Change your Name', 'give'); ?></h3>
44 44
 
45 45
 			<p id="give_profile_first_name_wrap" class="form-row form-row-first form-row-responsive">
46 46
 				<label for="give_first_name">
47
-					<?php _e( 'First Name', 'give' ); ?>
47
+					<?php _e('First Name', 'give'); ?>
48 48
 					<span class="give-required-indicator  ">*</span>
49 49
 				</label>
50
-				<input name="give_first_name" id="give_first_name" class="text give-input" type="text" value="<?php echo esc_attr( $first_name ); ?>"/>
50
+				<input name="give_first_name" id="give_first_name" class="text give-input" type="text" value="<?php echo esc_attr($first_name); ?>"/>
51 51
 			</p>
52 52
 
53 53
 			<p id="give_profile_last_name_wrap" class="form-row form-row-last form-row-responsive">
54
-				<label for="give_last_name"><?php _e( 'Last Name', 'give' ); ?></label>
55
-				<input name="give_last_name" id="give_last_name" class="text give-input" type="text" value="<?php echo esc_attr( $last_name ); ?>"/>
54
+				<label for="give_last_name"><?php _e('Last Name', 'give'); ?></label>
55
+				<input name="give_last_name" id="give_last_name" class="text give-input" type="text" value="<?php echo esc_attr($last_name); ?>"/>
56 56
 			</p>
57 57
 
58 58
 			<p id="give_profile_display_name_wrap" class="form-row form-row-first form-row-responsive">
59
-				<label for="give_display_name"><?php _e( 'Display Name', 'give' ); ?></label>
59
+				<label for="give_display_name"><?php _e('Display Name', 'give'); ?></label>
60 60
 				<select name="give_display_name" id="give_display_name" class="select give-select">
61
-					<?php if ( ! empty( $current_user->first_name ) ): ?>
62
-						<option <?php selected( $display_name, $current_user->first_name ); ?> value="<?php echo esc_attr( $current_user->first_name ); ?>"><?php echo esc_html( $current_user->first_name ); ?></option>
61
+					<?php if ( ! empty($current_user->first_name)): ?>
62
+						<option <?php selected($display_name, $current_user->first_name); ?> value="<?php echo esc_attr($current_user->first_name); ?>"><?php echo esc_html($current_user->first_name); ?></option>
63 63
 					<?php endif; ?>
64
-					<option <?php selected( $display_name, $current_user->user_nicename ); ?> value="<?php echo esc_attr( $current_user->user_nicename ); ?>"><?php echo esc_html( $current_user->user_nicename ); ?></option>
65
-					<?php if ( ! empty( $current_user->last_name ) ): ?>
66
-						<option <?php selected( $display_name, $current_user->last_name ); ?> value="<?php echo esc_attr( $current_user->last_name ); ?>"><?php echo esc_html( $current_user->last_name ); ?></option>
64
+					<option <?php selected($display_name, $current_user->user_nicename); ?> value="<?php echo esc_attr($current_user->user_nicename); ?>"><?php echo esc_html($current_user->user_nicename); ?></option>
65
+					<?php if ( ! empty($current_user->last_name)): ?>
66
+						<option <?php selected($display_name, $current_user->last_name); ?> value="<?php echo esc_attr($current_user->last_name); ?>"><?php echo esc_html($current_user->last_name); ?></option>
67 67
 					<?php endif; ?>
68
-					<?php if ( ! empty( $current_user->first_name ) && ! empty( $current_user->last_name ) ): ?>
69
-						<option <?php selected( $display_name, $current_user->first_name . ' ' . $current_user->last_name ); ?> value="<?php echo esc_attr( $current_user->first_name . ' ' . $current_user->last_name ); ?>"><?php echo esc_html( $current_user->first_name . ' ' . $current_user->last_name ); ?></option>
70
-						<option <?php selected( $display_name, $current_user->last_name . ' ' . $current_user->first_name ); ?> value="<?php echo esc_attr( $current_user->last_name . ' ' . $current_user->first_name ); ?>"><?php echo esc_html( $current_user->last_name . ' ' . $current_user->first_name ); ?></option>
68
+					<?php if ( ! empty($current_user->first_name) && ! empty($current_user->last_name)): ?>
69
+						<option <?php selected($display_name, $current_user->first_name.' '.$current_user->last_name); ?> value="<?php echo esc_attr($current_user->first_name.' '.$current_user->last_name); ?>"><?php echo esc_html($current_user->first_name.' '.$current_user->last_name); ?></option>
70
+						<option <?php selected($display_name, $current_user->last_name.' '.$current_user->first_name); ?> value="<?php echo esc_attr($current_user->last_name.' '.$current_user->first_name); ?>"><?php echo esc_html($current_user->last_name.' '.$current_user->first_name); ?></option>
71 71
 					<?php endif; ?>
72 72
 				</select>
73 73
 				<?php
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 				 *
79 79
 				 * @since 1.0
80 80
 				 */
81
-				do_action( 'give_profile_editor_name' );
81
+				do_action('give_profile_editor_name');
82 82
 				?>
83 83
 			</p>
84 84
 
@@ -90,15 +90,15 @@  discard block
 block discarded – undo
90 90
 			 *
91 91
 			 * @since 1.0
92 92
 			 */
93
-			do_action( 'give_profile_editor_after_name' );
93
+			do_action('give_profile_editor_after_name');
94 94
 			?>
95 95
 
96 96
 			<p class="form-row form-row-last form-row-responsive">
97 97
 				<label for="give_email">
98
-					<?php _e( 'Email Address', 'give' ); ?>
98
+					<?php _e('Email Address', 'give'); ?>
99 99
 					<span class="give-required-indicator  ">*</span>
100 100
 				</label>
101
-				<input name="give_email" id="give_email" class="text give-input required" type="email" value="<?php echo esc_attr( $current_user->user_email ); ?>" required aria-required="true"/>
101
+				<input name="give_email" id="give_email" class="text give-input required" type="email" value="<?php echo esc_attr($current_user->user_email); ?>" required aria-required="true"/>
102 102
 				<?php
103 103
 				/**
104 104
 				 * Fires in the profile editor shortcode, to the email section.
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 				 *
108 108
 				 * @since 1.0
109 109
 				 */
110
-				do_action( 'give_profile_editor_email' );
110
+				do_action('give_profile_editor_email');
111 111
 				?>
112 112
 			</p>
113 113
 
@@ -119,19 +119,19 @@  discard block
 block discarded – undo
119 119
 			 *
120 120
 			 * @since 1.0
121 121
 			 */
122
-			do_action( 'give_profile_editor_after_email' );
122
+			do_action('give_profile_editor_after_email');
123 123
 			?>
124 124
 
125
-			<h3 id="give_profile_password_label" class="give-section-break"><?php _e( 'Change your Password', 'give' ); ?></h3>
125
+			<h3 id="give_profile_password_label" class="give-section-break"><?php _e('Change your Password', 'give'); ?></h3>
126 126
 
127 127
 			<div id="give_profile_password_wrap" class="give-clearfix">
128 128
 				<p id="give_profile_password_wrap_1" class="form-row form-row-first form-row-responsive">
129
-					<label for="give_new_user_pass1"><?php _e( 'New Password', 'give' ); ?></label>
129
+					<label for="give_new_user_pass1"><?php _e('New Password', 'give'); ?></label>
130 130
 					<input name="give_new_user_pass1" id="give_new_user_pass1" class="password give-input" type="password"/>
131 131
 				</p>
132 132
 
133 133
 				<p id="give_profile_password_wrap_2" class="form-row form-row-last form-row-responsive">
134
-					<label for="give_new_user_pass2"><?php _e( 'Re-enter Password', 'give' ); ?></label>
134
+					<label for="give_new_user_pass2"><?php _e('Re-enter Password', 'give'); ?></label>
135 135
 					<input name="give_new_user_pass2" id="give_new_user_pass2" class="password give-input" type="password"/>
136 136
 					<?php
137 137
 					/**
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
 					 *
142 142
 					 * @since 1.0
143 143
 					 */
144
-					do_action( 'give_profile_editor_password' );
144
+					do_action('give_profile_editor_password');
145 145
 					?>
146 146
 				</p>
147 147
 			</div>
148 148
 
149
-			<p class="give_password_change_notice"><?php _e( 'Please note after changing your password, you must log back in.', 'give' ); ?></p>
149
+			<p class="give_password_change_notice"><?php _e('Please note after changing your password, you must log back in.', 'give'); ?></p>
150 150
 
151 151
 			<?php
152 152
 			/**
@@ -156,14 +156,14 @@  discard block
 block discarded – undo
156 156
 			 *
157 157
 			 * @since 1.0
158 158
 			 */
159
-			do_action( 'give_profile_editor_after_password' );
159
+			do_action('give_profile_editor_after_password');
160 160
 			?>
161 161
 
162 162
 			<p id="give_profile_submit_wrap">
163
-				<input type="hidden" name="give_profile_editor_nonce" value="<?php echo wp_create_nonce( 'give-profile-editor-nonce' ); ?>"/>
163
+				<input type="hidden" name="give_profile_editor_nonce" value="<?php echo wp_create_nonce('give-profile-editor-nonce'); ?>"/>
164 164
 				<input type="hidden" name="give_action" value="edit_user_profile"/>
165
-				<input type="hidden" name="give_redirect" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/>
166
-				<input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" class="give_submit" value="<?php _e( 'Save Changes', 'give' ); ?>"/>
165
+				<input type="hidden" name="give_redirect" value="<?php echo esc_url(give_get_current_page_url()); ?>"/>
166
+				<input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" class="give_submit" value="<?php _e('Save Changes', 'give'); ?>"/>
167 167
 			</p>
168 168
 
169 169
 		</fieldset>
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @since 1.0
180 180
 	 */
181
-	do_action( 'give_profile_editor_after' );
181
+	do_action('give_profile_editor_after');
182 182
 	?>
183 183
 
184 184
 	<?php
185 185
 else:
186
-	_e( 'You need to login to edit your profile.', 'give' );
186
+	_e('You need to login to edit your profile.', 'give');
187 187
 	echo give_login_form();
188 188
 endif;
Please login to merge, or discard this patch.
includes/admin/admin-actions.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @since 1.8
42 42
  *
43
- * @return bool
43
+ * @return false|null
44 44
  */
45 45
 function give_redirect_to_clean_url_admin_pages() {
46 46
 	// Give admin pages.
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
  * @access public
993 993
  * @since  2.0
994 994
  *
995
- * @return bool
995
+ * @return false|null
996 996
  */
997 997
 function give_update_donor_name_on_user_update( $user_id = 0 ) {
998 998
 
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
  * @param  int          $user_id       User ID.
1033 1033
  * @param  WP_User|bool $old_user_data User data.
1034 1034
  *
1035
- * @return bool
1035
+ * @return false|null
1036 1036
  */
1037 1037
 function give_update_donor_email_on_user_update( $user_id = 0, $old_user_data = false ) {
1038 1038
 
Please login to merge, or discard this patch.
Spacing   +279 added lines, -285 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
 
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
  * @since 1.8
21 21
  */
22 22
 function give_load_wp_editor() {
23
-	if ( ! isset( $_POST['wp_editor'] ) ) {
23
+	if ( ! isset($_POST['wp_editor'])) {
24 24
 		die();
25 25
 	}
26 26
 
27
-	$wp_editor                     = json_decode( base64_decode( $_POST['wp_editor'] ), true );
27
+	$wp_editor                     = json_decode(base64_decode($_POST['wp_editor']), true);
28 28
 	$wp_editor[2]['textarea_name'] = $_POST['textarea_name'];
29 29
 
30
-	wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] );
30
+	wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]);
31 31
 
32 32
 	die();
33 33
 }
34 34
 
35
-add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' );
35
+add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor');
36 36
 
37 37
 
38 38
 /**
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 	);
53 53
 
54 54
 	// Get current page.
55
-	$current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : '';
55
+	$current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : '';
56 56
 
57 57
 	// Bailout.
58 58
 	if (
59
-		empty( $current_page )
60
-		|| empty( $_GET['_wp_http_referer'] )
61
-		|| ! in_array( $current_page, $give_pages )
59
+		empty($current_page)
60
+		|| empty($_GET['_wp_http_referer'])
61
+		|| ! in_array($current_page, $give_pages)
62 62
 	) {
63 63
 		return false;
64 64
 	}
@@ -68,21 +68,21 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @since 1.8
70 70
 	 */
71
-	$redirect = apply_filters( "give_validate_{$current_page}", true );
71
+	$redirect = apply_filters("give_validate_{$current_page}", true);
72 72
 
73
-	if ( $redirect ) {
73
+	if ($redirect) {
74 74
 		// Redirect.
75 75
 		wp_redirect(
76 76
 			remove_query_arg(
77
-				array( '_wp_http_referer', '_wpnonce' ),
78
-				wp_unslash( $_SERVER['REQUEST_URI'] )
77
+				array('_wp_http_referer', '_wpnonce'),
78
+				wp_unslash($_SERVER['REQUEST_URI'])
79 79
 			)
80 80
 		);
81 81
 		exit;
82 82
 	}
83 83
 }
84 84
 
85
-add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' );
85
+add_action('admin_init', 'give_redirect_to_clean_url_admin_pages');
86 86
 
87 87
 
88 88
 /**
@@ -96,25 +96,25 @@  discard block
 block discarded – undo
96 96
  */
97 97
 function give_hide_outdated_php_notice() {
98 98
 
99
-	if ( ! isset( $_POST['_give_hide_outdated_php_notices_shortly'] ) ) {
99
+	if ( ! isset($_POST['_give_hide_outdated_php_notices_shortly'])) {
100 100
 		give_die();
101 101
 	}
102 102
 
103 103
 	// Transient key name.
104 104
 	$transient_key = "_give_hide_outdated_php_notices_shortly";
105 105
 
106
-	if ( Give_Cache::get( $transient_key, true ) ) {
106
+	if (Give_Cache::get($transient_key, true)) {
107 107
 		return;
108 108
 	}
109 109
 
110 110
 	// Hide notice for 24 hours.
111
-	Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true );
111
+	Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true);
112 112
 
113 113
 	give_die();
114 114
 
115 115
 }
116 116
 
117
-add_action( 'wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice' );
117
+add_action('wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice');
118 118
 
119 119
 /**
120 120
  * Register admin notices.
@@ -123,27 +123,27 @@  discard block
 block discarded – undo
123 123
  */
124 124
 function _give_register_admin_notices() {
125 125
 	// Bailout.
126
-	if ( ! is_admin() ) {
126
+	if ( ! is_admin()) {
127 127
 		return;
128 128
 	}
129 129
 
130 130
 	// Bulk action notices.
131 131
 	if (
132
-		isset( $_GET['action'] ) &&
133
-		! empty( $_GET['action'] )
132
+		isset($_GET['action']) &&
133
+		! empty($_GET['action'])
134 134
 	) {
135 135
 
136 136
 		// Add payment bulk notice.
137 137
 		if (
138
-			current_user_can( 'edit_give_payments' ) &&
139
-			isset( $_GET['payment'] ) &&
140
-			! empty( $_GET['payment'] )
138
+			current_user_can('edit_give_payments') &&
139
+			isset($_GET['payment']) &&
140
+			! empty($_GET['payment'])
141 141
 		) {
142
-			$payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0;
142
+			$payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0;
143 143
 
144
-			switch ( $_GET['action'] ) {
144
+			switch ($_GET['action']) {
145 145
 				case 'delete':
146
-					Give()->notices->register_notice( array(
146
+					Give()->notices->register_notice(array(
147 147
 						'id'          => 'bulk_action_delete',
148 148
 						'type'        => 'updated',
149 149
 						'description' => sprintf(
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
 							),
156 156
 							$payment_count ),
157 157
 						'show'        => true,
158
-					) );
158
+					));
159 159
 
160 160
 					break;
161 161
 
162 162
 				case 'resend-receipt':
163
-					Give()->notices->register_notice( array(
163
+					Give()->notices->register_notice(array(
164 164
 						'id'          => 'bulk_action_resend_receipt',
165 165
 						'type'        => 'updated',
166 166
 						'description' => sprintf(
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 							$payment_count
174 174
 						),
175 175
 						'show'        => true,
176
-					) );
176
+					));
177 177
 					break;
178 178
 
179 179
 				case 'set-status-publish' :
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 				case 'set-status-cancelled' :
186 186
 				case 'set-status-abandoned' :
187 187
 				case 'set-status-preapproval' :
188
-					Give()->notices->register_notice( array(
188
+					Give()->notices->register_notice(array(
189 189
 						'id'          => 'bulk_action_status_change',
190 190
 						'type'        => 'updated',
191 191
 						'description' => _n(
@@ -195,251 +195,251 @@  discard block
 block discarded – undo
195 195
 							'give'
196 196
 						),
197 197
 						'show'        => true,
198
-					) );
198
+					));
199 199
 					break;
200 200
 			}
201 201
 		}
202 202
 	}
203 203
 
204 204
 	// Add give message notices.
205
-	if ( ! empty( $_GET['give-message'] ) ) {
205
+	if ( ! empty($_GET['give-message'])) {
206 206
 		// Donation reports errors.
207
-		if ( current_user_can( 'view_give_reports' ) ) {
208
-			switch ( $_GET['give-message'] ) {
207
+		if (current_user_can('view_give_reports')) {
208
+			switch ($_GET['give-message']) {
209 209
 				case 'donation_deleted' :
210
-					Give()->notices->register_notice( array(
210
+					Give()->notices->register_notice(array(
211 211
 						'id'          => 'give-donation-deleted',
212 212
 						'type'        => 'updated',
213
-						'description' => __( 'The donation has been deleted.', 'give' ),
213
+						'description' => __('The donation has been deleted.', 'give'),
214 214
 						'show'        => true,
215
-					) );
215
+					));
216 216
 					break;
217 217
 				case 'email_sent' :
218
-					Give()->notices->register_notice( array(
218
+					Give()->notices->register_notice(array(
219 219
 						'id'          => 'give-payment-sent',
220 220
 						'type'        => 'updated',
221
-						'description' => __( 'The donation receipt has been resent.', 'give' ),
221
+						'description' => __('The donation receipt has been resent.', 'give'),
222 222
 						'show'        => true,
223
-					) );
223
+					));
224 224
 					break;
225 225
 				case 'refreshed-reports' :
226
-					Give()->notices->register_notice( array(
226
+					Give()->notices->register_notice(array(
227 227
 						'id'          => 'give-refreshed-reports',
228 228
 						'type'        => 'updated',
229
-						'description' => __( 'The reports cache has been cleared.', 'give' ),
229
+						'description' => __('The reports cache has been cleared.', 'give'),
230 230
 						'show'        => true,
231
-					) );
231
+					));
232 232
 					break;
233 233
 				case 'donation-note-deleted' :
234
-					Give()->notices->register_notice( array(
234
+					Give()->notices->register_notice(array(
235 235
 						'id'          => 'give-donation-note-deleted',
236 236
 						'type'        => 'updated',
237
-						'description' => __( 'The donation note has been deleted.', 'give' ),
237
+						'description' => __('The donation note has been deleted.', 'give'),
238 238
 						'show'        => true,
239
-					) );
239
+					));
240 240
 					break;
241 241
 			}
242 242
 		}
243 243
 
244 244
 		// Give settings notices and errors.
245
-		if ( current_user_can( 'manage_give_settings' ) ) {
246
-			switch ( $_GET['give-message'] ) {
245
+		if (current_user_can('manage_give_settings')) {
246
+			switch ($_GET['give-message']) {
247 247
 				case 'settings-imported' :
248
-					Give()->notices->register_notice( array(
248
+					Give()->notices->register_notice(array(
249 249
 						'id'          => 'give-settings-imported',
250 250
 						'type'        => 'updated',
251
-						'description' => __( 'The settings have been imported.', 'give' ),
251
+						'description' => __('The settings have been imported.', 'give'),
252 252
 						'show'        => true,
253
-					) );
253
+					));
254 254
 					break;
255 255
 				case 'api-key-generated' :
256
-					Give()->notices->register_notice( array(
256
+					Give()->notices->register_notice(array(
257 257
 						'id'          => 'give-api-key-generated',
258 258
 						'type'        => 'updated',
259
-						'description' => __( 'API keys have been generated.', 'give' ),
259
+						'description' => __('API keys have been generated.', 'give'),
260 260
 						'show'        => true,
261
-					) );
261
+					));
262 262
 					break;
263 263
 				case 'api-key-exists' :
264
-					Give()->notices->register_notice( array(
264
+					Give()->notices->register_notice(array(
265 265
 						'id'          => 'give-api-key-exists',
266 266
 						'type'        => 'updated',
267
-						'description' => __( 'The specified user already has API keys.', 'give' ),
267
+						'description' => __('The specified user already has API keys.', 'give'),
268 268
 						'show'        => true,
269
-					) );
269
+					));
270 270
 					break;
271 271
 				case 'api-key-regenerated' :
272
-					Give()->notices->register_notice( array(
272
+					Give()->notices->register_notice(array(
273 273
 						'id'          => 'give-api-key-regenerated',
274 274
 						'type'        => 'updated',
275
-						'description' => __( 'API keys have been regenerated.', 'give' ),
275
+						'description' => __('API keys have been regenerated.', 'give'),
276 276
 						'show'        => true,
277
-					) );
277
+					));
278 278
 					break;
279 279
 				case 'api-key-revoked' :
280
-					Give()->notices->register_notice( array(
280
+					Give()->notices->register_notice(array(
281 281
 						'id'          => 'give-api-key-revoked',
282 282
 						'type'        => 'updated',
283
-						'description' => __( 'API keys have been revoked.', 'give' ),
283
+						'description' => __('API keys have been revoked.', 'give'),
284 284
 						'show'        => true,
285
-					) );
285
+					));
286 286
 					break;
287 287
 				case 'sent-test-email' :
288
-					Give()->notices->register_notice( array(
288
+					Give()->notices->register_notice(array(
289 289
 						'id'          => 'give-sent-test-email',
290 290
 						'type'        => 'updated',
291
-						'description' => __( 'The test email has been sent.', 'give' ),
291
+						'description' => __('The test email has been sent.', 'give'),
292 292
 						'show'        => true,
293
-					) );
293
+					));
294 294
 					break;
295 295
 				case 'matched-success-failure-page':
296
-					Give()->notices->register_notice( array(
296
+					Give()->notices->register_notice(array(
297 297
 						'id'          => 'give-matched-success-failure-page',
298 298
 						'type'        => 'updated',
299
-						'description' => __( 'You cannot set the success and failed pages to the same page', 'give' ),
299
+						'description' => __('You cannot set the success and failed pages to the same page', 'give'),
300 300
 						'show'        => true,
301
-					) );
301
+					));
302 302
 					break;
303 303
 			}
304 304
 		}
305 305
 		// Payments errors.
306
-		if ( current_user_can( 'edit_give_payments' ) ) {
307
-			switch ( $_GET['give-message'] ) {
306
+		if (current_user_can('edit_give_payments')) {
307
+			switch ($_GET['give-message']) {
308 308
 				case 'note-added' :
309
-					Give()->notices->register_notice( array(
309
+					Give()->notices->register_notice(array(
310 310
 						'id'          => 'give-note-added',
311 311
 						'type'        => 'updated',
312
-						'description' => __( 'The donation note has been added.', 'give' ),
312
+						'description' => __('The donation note has been added.', 'give'),
313 313
 						'show'        => true,
314
-					) );
314
+					));
315 315
 					break;
316 316
 				case 'payment-updated' :
317
-					Give()->notices->register_notice( array(
317
+					Give()->notices->register_notice(array(
318 318
 						'id'          => 'give-payment-updated',
319 319
 						'type'        => 'updated',
320
-						'description' => __( 'The donation has been updated.', 'give' ),
320
+						'description' => __('The donation has been updated.', 'give'),
321 321
 						'show'        => true,
322
-					) );
322
+					));
323 323
 					break;
324 324
 			}
325 325
 		}
326 326
 
327 327
 		// Donor Notices.
328
-		if ( current_user_can( 'edit_give_payments' ) ) {
329
-			switch ( $_GET['give-message'] ) {
328
+		if (current_user_can('edit_give_payments')) {
329
+			switch ($_GET['give-message']) {
330 330
 				case 'donor-deleted' :
331
-					Give()->notices->register_notice( array(
331
+					Give()->notices->register_notice(array(
332 332
 						'id'          => 'give-donor-deleted',
333 333
 						'type'        => 'updated',
334
-						'description' => __( 'The selected donor(s) has been deleted.', 'give' ),
334
+						'description' => __('The selected donor(s) has been deleted.', 'give'),
335 335
 						'show'        => true,
336
-					) );
336
+					));
337 337
 					break;
338 338
 
339 339
 				case 'donor-donations-deleted' :
340
-					Give()->notices->register_notice( array(
340
+					Give()->notices->register_notice(array(
341 341
 						'id'          => 'give-donor-donations-deleted',
342 342
 						'type'        => 'updated',
343
-						'description' => __( 'The selected donor(s) and its associated donations has been deleted.', 'give' ),
343
+						'description' => __('The selected donor(s) and its associated donations has been deleted.', 'give'),
344 344
 						'show'        => true,
345
-					) );
345
+					));
346 346
 					break;
347 347
 
348 348
 				case 'confirm-delete-donor' :
349
-					Give()->notices->register_notice( array(
349
+					Give()->notices->register_notice(array(
350 350
 						'id'          => 'give-confirm-delete-donor',
351 351
 						'type'        => 'updated',
352
-						'description' => __( 'You must confirm to delete the selected donor(s).', 'give' ),
352
+						'description' => __('You must confirm to delete the selected donor(s).', 'give'),
353 353
 						'show'        => true,
354
-					) );
354
+					));
355 355
 					break;
356 356
 
357 357
 				case 'invalid-donor-id' :
358
-					Give()->notices->register_notice( array(
358
+					Give()->notices->register_notice(array(
359 359
 						'id'          => 'give-invalid-donor-id',
360 360
 						'type'        => 'updated',
361
-						'description' => __( 'Invalid Donor ID.', 'give' ),
361
+						'description' => __('Invalid Donor ID.', 'give'),
362 362
 						'show'        => true,
363
-					) );
363
+					));
364 364
 					break;
365 365
 
366 366
 				case 'donor-delete-failed' :
367
-					Give()->notices->register_notice( array(
367
+					Give()->notices->register_notice(array(
368 368
 						'id'          => 'give-donor-delete-failed',
369 369
 						'type'        => 'error',
370
-						'description' => __( 'Unable to delete selected donor(s).', 'give' ),
370
+						'description' => __('Unable to delete selected donor(s).', 'give'),
371 371
 						'show'        => true,
372
-					) );
372
+					));
373 373
 					break;
374 374
 
375 375
 				case 'email-added' :
376
-					Give()->notices->register_notice( array(
376
+					Give()->notices->register_notice(array(
377 377
 						'id'          => 'give-donor-email-added',
378 378
 						'type'        => 'updated',
379
-						'description' => __( 'Donor email added.', 'give' ),
379
+						'description' => __('Donor email added.', 'give'),
380 380
 						'show'        => true,
381
-					) );
381
+					));
382 382
 					break;
383 383
 
384 384
 				case 'email-removed' :
385
-					Give()->notices->register_notice( array(
385
+					Give()->notices->register_notice(array(
386 386
 						'id'          => 'give-donor-email-removed',
387 387
 						'type'        => 'updated',
388
-						'description' => __( 'Donor email removed.', 'give' ),
388
+						'description' => __('Donor email removed.', 'give'),
389 389
 						'show'        => true,
390
-					) );
390
+					));
391 391
 					break;
392 392
 
393 393
 				case 'email-remove-failed' :
394
-					Give()->notices->register_notice( array(
394
+					Give()->notices->register_notice(array(
395 395
 						'id'          => 'give-donor-email-remove-failed',
396 396
 						'type'        => 'updated',
397
-						'description' => __( 'Failed to remove donor email.', 'give' ),
397
+						'description' => __('Failed to remove donor email.', 'give'),
398 398
 						'show'        => true,
399
-					) );
399
+					));
400 400
 					break;
401 401
 
402 402
 				case 'primary-email-updated' :
403
-					Give()->notices->register_notice( array(
403
+					Give()->notices->register_notice(array(
404 404
 						'id'          => 'give-donor-primary-email-updated',
405 405
 						'type'        => 'updated',
406
-						'description' => __( 'Primary email updated for donor.', 'give' ),
406
+						'description' => __('Primary email updated for donor.', 'give'),
407 407
 						'show'        => true,
408
-					) );
408
+					));
409 409
 					break;
410 410
 
411 411
 				case 'primary-email-failed' :
412
-					Give()->notices->register_notice( array(
412
+					Give()->notices->register_notice(array(
413 413
 						'id'          => 'give-donor-primary-email-failed',
414 414
 						'type'        => 'updated',
415
-						'description' => __( 'Failed to set primary email.', 'give' ),
415
+						'description' => __('Failed to set primary email.', 'give'),
416 416
 						'show'        => true,
417
-					) );
417
+					));
418 418
 					break;
419 419
 
420 420
 				case 'reconnect-user' :
421
-					Give()->notices->register_notice( array(
421
+					Give()->notices->register_notice(array(
422 422
 						'id'          => 'give-donor-reconnect-user',
423 423
 						'type'        => 'updated',
424
-						'description' => __( 'User has been successfully connected with Donor.', 'give' ),
424
+						'description' => __('User has been successfully connected with Donor.', 'give'),
425 425
 						'show'        => true,
426
-					) );
426
+					));
427 427
 					break;
428 428
 
429 429
 				case 'profile-updated' :
430
-					Give()->notices->register_notice( array(
430
+					Give()->notices->register_notice(array(
431 431
 						'id'          => 'give-donor-profile-updated',
432 432
 						'type'        => 'updated',
433
-						'description' => __( 'Donor information updated successfully.', 'give' ),
433
+						'description' => __('Donor information updated successfully.', 'give'),
434 434
 						'show'        => true,
435
-					) );
435
+					));
436 436
 					break;
437 437
 			}
438 438
 		}
439 439
 	}
440 440
 }
441 441
 
442
-add_action( 'admin_notices', '_give_register_admin_notices', - 1 );
442
+add_action('admin_notices', '_give_register_admin_notices', - 1);
443 443
 
444 444
 
445 445
 /**
@@ -449,31 +449,30 @@  discard block
 block discarded – undo
449 449
  *
450 450
  * @return bool
451 451
  */
452
-function _give_show_test_mode_notice_in_admin_bar( $wp_admin_bar ) {
453
-	$is_test_mode = ! empty( $_POST['test_mode'] ) ?
454
-		give_is_setting_enabled( $_POST['test_mode'] ) :
455
-		give_is_test_mode();
452
+function _give_show_test_mode_notice_in_admin_bar($wp_admin_bar) {
453
+	$is_test_mode = ! empty($_POST['test_mode']) ?
454
+		give_is_setting_enabled($_POST['test_mode']) : give_is_test_mode();
456 455
 
457 456
 	if (
458
-		! current_user_can( 'view_give_reports' ) ||
457
+		! current_user_can('view_give_reports') ||
459 458
 		! $is_test_mode
460 459
 	) {
461 460
 		return false;
462 461
 	}
463 462
 
464 463
 	// Add the main site admin menu item.
465
-	$wp_admin_bar->add_menu( array(
464
+	$wp_admin_bar->add_menu(array(
466 465
 		'id'     => 'give-test-notice',
467
-		'href'   => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ),
466
+		'href'   => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'),
468 467
 		'parent' => 'top-secondary',
469
-		'title'  => __( 'Give Test Mode Active', 'give' ),
470
-		'meta'   => array( 'class' => 'give-test-mode-active' ),
471
-	) );
468
+		'title'  => __('Give Test Mode Active', 'give'),
469
+		'meta'   => array('class' => 'give-test-mode-active'),
470
+	));
472 471
 
473 472
 	return true;
474 473
 }
475 474
 
476
-add_action( 'admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1 );
475
+add_action('admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1);
477 476
 
478 477
 /**
479 478
  * Add Link to Import page in from donation archive and donation single page
@@ -482,12 +481,12 @@  discard block
 block discarded – undo
482 481
  */
483 482
 function give_import_page_link_callback() {
484 483
 	?>
485
-	<a href="<?php echo esc_url( give_import_page_url() ); ?>"
486
-	   class="page-import-action page-title-action"><?php _e( 'Import Donations', 'give' ); ?></a>
484
+	<a href="<?php echo esc_url(give_import_page_url()); ?>"
485
+	   class="page-import-action page-title-action"><?php _e('Import Donations', 'give'); ?></a>
487 486
 
488 487
 	<?php
489 488
 	// Check if view donation single page only.
490
-	if ( ! empty( $_REQUEST['view'] ) && 'view-payment-details' === (string) give_clean( $_REQUEST['view'] ) && 'give-payment-history' === give_clean( $_REQUEST['page'] ) ) {
489
+	if ( ! empty($_REQUEST['view']) && 'view-payment-details' === (string) give_clean($_REQUEST['view']) && 'give-payment-history' === give_clean($_REQUEST['page'])) {
491 490
 		?>
492 491
 		<style type="text/css">
493 492
 			.wrap #transaction-details-heading {
@@ -498,7 +497,7 @@  discard block
 block discarded – undo
498 497
 	}
499 498
 }
500 499
 
501
-add_action( 'give_payments_page_top', 'give_import_page_link_callback', 11 );
500
+add_action('give_payments_page_top', 'give_import_page_link_callback', 11);
502 501
 
503 502
 /**
504 503
  * Load donation import ajax callback
@@ -510,9 +509,9 @@  discard block
 block discarded – undo
510 509
  */
511 510
 function give_donation_import_callback() {
512 511
 	$import_setting = array();
513
-	$fields         = isset( $_POST['fields'] ) ? $_POST['fields'] : null;
512
+	$fields         = isset($_POST['fields']) ? $_POST['fields'] : null;
514 513
 
515
-	parse_str( $fields );
514
+	parse_str($fields);
516 515
 
517 516
 	$import_setting['create_user'] = $create_user;
518 517
 	$import_setting['mode']        = $mode;
@@ -521,57 +520,57 @@  discard block
 block discarded – undo
521 520
 	$import_setting['delete_csv']  = $delete_csv;
522 521
 
523 522
 	// Parent key id.
524
-	$main_key = maybe_unserialize( $main_key );
525
-
526
-	$current    = absint( $_REQUEST['current'] );
527
-	$total_ajax = absint( $_REQUEST['total_ajax'] );
528
-	$start      = absint( $_REQUEST['start'] );
529
-	$end        = absint( $_REQUEST['end'] );
530
-	$next       = absint( $_REQUEST['next'] );
531
-	$total      = absint( $_REQUEST['total'] );
532
-	$per_page   = absint( $_REQUEST['per_page'] );
533
-	if ( empty( $delimiter ) ) {
523
+	$main_key = maybe_unserialize($main_key);
524
+
525
+	$current    = absint($_REQUEST['current']);
526
+	$total_ajax = absint($_REQUEST['total_ajax']);
527
+	$start      = absint($_REQUEST['start']);
528
+	$end        = absint($_REQUEST['end']);
529
+	$next       = absint($_REQUEST['next']);
530
+	$total      = absint($_REQUEST['total']);
531
+	$per_page   = absint($_REQUEST['per_page']);
532
+	if (empty($delimiter)) {
534 533
 		$delimiter = ',';
535 534
 	}
536 535
 
537 536
 	// Processing done here.
538
-	$raw_data = give_get_donation_data_from_csv( $csv, $start, $end, $delimiter );
539
-	$raw_key  = maybe_unserialize( $mapto );
537
+	$raw_data = give_get_donation_data_from_csv($csv, $start, $end, $delimiter);
538
+	$raw_key  = maybe_unserialize($mapto);
540 539
 
541 540
 	// Prevent normal emails.
542
-	remove_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 );
543
-	remove_action( 'give_insert_user', 'give_new_user_notification', 10 );
544
-	remove_action( 'give_insert_payment', 'give_payment_save_page_data' );
545
-
546
-	$current_key  = $start;
547
-	foreach ( $raw_data as $row_data ) {
548
-		$import_setting['donation_key']  = $current_key;
549
-		give_save_import_donation_to_db( $raw_key, $row_data, $main_key, $import_setting );
541
+	remove_action('give_complete_donation', 'give_trigger_donation_receipt', 999);
542
+	remove_action('give_insert_user', 'give_new_user_notification', 10);
543
+	remove_action('give_insert_payment', 'give_payment_save_page_data');
544
+
545
+	$current_key = $start;
546
+	foreach ($raw_data as $row_data) {
547
+		$import_setting['donation_key'] = $current_key;
548
+		give_save_import_donation_to_db($raw_key, $row_data, $main_key, $import_setting);
550 549
 		$current_key++;
551 550
 	}
552 551
 
553 552
 	// Check if function exists or not.
554
-	if ( function_exists( 'give_payment_save_page_data' ) ) {
555
-		add_action( 'give_insert_payment', 'give_payment_save_page_data' );
553
+	if (function_exists('give_payment_save_page_data')) {
554
+		add_action('give_insert_payment', 'give_payment_save_page_data');
556 555
 	}
557
-	add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 );
558
-	add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 );
556
+	add_action('give_insert_user', 'give_new_user_notification', 10, 2);
557
+	add_action('give_complete_donation', 'give_trigger_donation_receipt', 999);
559 558
 
560
-	if ( $next == false ) {
559
+	if ($next == false) {
561 560
 		$json_data = array(
562 561
 			'success' => true,
563
-			'message' => __( 'All donation uploaded successfully!', 'give' ),
562
+			'message' => __('All donation uploaded successfully!', 'give'),
564 563
 		);
565 564
 	} else {
566 565
 		$index_start = $start;
567 566
 		$index_end   = $end;
568 567
 		$last        = false;
569 568
 		$next        = true;
570
-		if ( $next ) {
569
+		if ($next) {
571 570
 			$index_start = $index_start + $per_page;
572
-			$index_end   = $per_page + ( $index_start - 1 );
571
+			$index_end   = $per_page + ($index_start - 1);
573 572
 		}
574
-		if ( $index_end >= $total ) {
573
+		if ($index_end >= $total) {
575 574
 			$index_end = $total;
576 575
 			$last      = true;
577 576
 		}
@@ -585,27 +584,27 @@  discard block
 block discarded – undo
585 584
 		);
586 585
 	}
587 586
 
588
-	$url              = give_import_page_url( array(
587
+	$url = give_import_page_url(array(
589 588
 		'step'          => '4',
590 589
 		'importer-type' => 'import_donations',
591 590
 		'csv'           => $csv,
592 591
 		'total'         => $total,
593 592
 		'delete_csv'    => $import_setting['delete_csv'],
594
-		'success'       => ( isset( $json_data['success'] ) ? $json_data['success'] : '' ),
595
-	) );
593
+		'success'       => (isset($json_data['success']) ? $json_data['success'] : ''),
594
+	));
596 595
 	$json_data['url'] = $url;
597 596
 
598
-	$current ++;
597
+	$current++;
599 598
 	$json_data['current'] = $current;
600 599
 
601
-	$percentage              = ( 100 / ( $total_ajax + 1 ) ) * $current;
600
+	$percentage              = (100 / ($total_ajax + 1)) * $current;
602 601
 	$json_data['percentage'] = $percentage;
603 602
 
604
-	$json_data = apply_filters( 'give_import_ajax_responces', $json_data, $fields );
605
-	wp_die( json_encode( $json_data ) );
603
+	$json_data = apply_filters('give_import_ajax_responces', $json_data, $fields);
604
+	wp_die(json_encode($json_data));
606 605
 }
607 606
 
608
-add_action( 'wp_ajax_give_donation_import', 'give_donation_import_callback' );
607
+add_action('wp_ajax_give_donation_import', 'give_donation_import_callback');
609 608
 
610 609
 /**
611 610
  * Load core settings import ajax callback
@@ -617,8 +616,8 @@  discard block
 block discarded – undo
617 616
  */
618 617
 
619 618
 function give_core_settings_import_callback() {
620
-	$fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null;
621
-	parse_str( $fields, $fields );
619
+	$fields = isset($_POST['fields']) ? $_POST['fields'] : null;
620
+	parse_str($fields, $fields);
622 621
 
623 622
 	$json_data['success'] = false;
624 623
 
@@ -633,22 +632,22 @@  discard block
 block discarded – undo
633 632
 	 *
634 633
 	 * @return array $fields
635 634
 	 */
636
-	$fields = (array) apply_filters( 'give_import_core_settings_fields', $fields );
635
+	$fields = (array) apply_filters('give_import_core_settings_fields', $fields);
637 636
 
638
-	$file_name = ( ! empty( $fields['file_name'] ) ? give_clean( $fields['file_name'] ) : false );
637
+	$file_name = ( ! empty($fields['file_name']) ? give_clean($fields['file_name']) : false);
639 638
 
640
-	if ( ! empty( $file_name ) ) {
641
-		$type = ( ! empty( $fields['type'] ) ? give_clean( $fields['type'] ) : 'merge' );
639
+	if ( ! empty($file_name)) {
640
+		$type = ( ! empty($fields['type']) ? give_clean($fields['type']) : 'merge');
642 641
 
643 642
 		// Get the json data from the file and then alter it in array format
644
-		$json_string   = give_get_core_settings_json( $file_name );
645
-		$json_to_array = json_decode( $json_string, true );
643
+		$json_string   = give_get_core_settings_json($file_name);
644
+		$json_to_array = json_decode($json_string, true);
646 645
 
647 646
 		// get the current settign from the options table.
648
-		$host_give_options = get_option( 'give_settings', array() );
647
+		$host_give_options = get_option('give_settings', array());
649 648
 
650 649
 		// Save old settins for backup.
651
-		update_option( 'give_settings_old', $host_give_options );
650
+		update_option('give_settings_old', $host_give_options);
652 651
 
653 652
 		/**
654 653
 		 * Filter to Modify Core Settings that are being going to get import in options table as give settings.
@@ -664,9 +663,9 @@  discard block
 block discarded – undo
664 663
 		 *
665 664
 		 * @return array $json_to_array Setting that are being going to get imported
666 665
 		 */
667
-		$json_to_array = (array) apply_filters( 'give_import_core_settings_data', $json_to_array, $type, $host_give_options, $fields );
666
+		$json_to_array = (array) apply_filters('give_import_core_settings_data', $json_to_array, $type, $host_give_options, $fields);
668 667
 
669
-		update_option( 'give_settings', $json_to_array );
668
+		update_option('give_settings', $json_to_array);
670 669
 
671 670
 		$json_data['success'] = true;
672 671
 	}
@@ -682,16 +681,16 @@  discard block
 block discarded – undo
682 681
 	 *
683 682
 	 * @return array $url
684 683
 	 */
685
-	$json_data['url'] = give_import_page_url( (array) apply_filters( 'give_import_core_settings_success_url', array(
686
-		'step'          => ( empty( $json_data['success'] ) ? '1' : '3' ),
684
+	$json_data['url'] = give_import_page_url((array) apply_filters('give_import_core_settings_success_url', array(
685
+		'step'          => (empty($json_data['success']) ? '1' : '3'),
687 686
 		'importer-type' => 'import_core_setting',
688
-		'success'       => ( empty( $json_data['success'] ) ? '0' : '1' ),
689
-	) ) );
687
+		'success'       => (empty($json_data['success']) ? '0' : '1'),
688
+	)));
690 689
 
691
-	wp_send_json( $json_data );
690
+	wp_send_json($json_data);
692 691
 }
693 692
 
694
-add_action( 'wp_ajax_give_core_settings_import', 'give_core_settings_import_callback' );
693
+add_action('wp_ajax_give_core_settings_import', 'give_core_settings_import_callback');
695 694
 
696 695
 /**
697 696
  * Initializes blank slate content if a list table is empty.
@@ -703,7 +702,7 @@  discard block
 block discarded – undo
703 702
 	$blank_slate->init();
704 703
 }
705 704
 
706
-add_action( 'current_screen', 'give_blank_slate' );
705
+add_action('current_screen', 'give_blank_slate');
707 706
 
708 707
 /**
709 708
  * Validate Fields of User Profile
@@ -716,24 +715,24 @@  discard block
 block discarded – undo
716 715
  *
717 716
  * @return mixed
718 717
  */
719
-function give_validate_user_profile( $errors, $update, $user ) {
718
+function give_validate_user_profile($errors, $update, $user) {
720 719
 
721
-	if ( ! empty( $_POST['action'] ) && ( 'adduser' === $_POST['action'] || 'createuser' === $_POST['action'] ) ) {
720
+	if ( ! empty($_POST['action']) && ('adduser' === $_POST['action'] || 'createuser' === $_POST['action'])) {
722 721
 		return;
723 722
 	}
724 723
 
725
-	if ( ! empty( $user->ID ) ) {
726
-		$donor = Give()->donors->get_donor_by( 'user_id', $user->ID );
724
+	if ( ! empty($user->ID)) {
725
+		$donor = Give()->donors->get_donor_by('user_id', $user->ID);
727 726
 
728
-		if ( $donor ) {
727
+		if ($donor) {
729 728
 			// If Donor is attached with User, then validate first name.
730
-			if ( empty( $_POST['first_name'] ) ) {
729
+			if (empty($_POST['first_name'])) {
731 730
 				$errors->add(
732 731
 					'empty_first_name',
733 732
 					sprintf(
734 733
 						'<strong>%1$s:</strong> %2$s',
735
-						__( 'ERROR', 'give' ),
736
-						__( 'Please enter your first name.', 'give' )
734
+						__('ERROR', 'give'),
735
+						__('Please enter your first name.', 'give')
737 736
 					)
738 737
 				);
739 738
 			}
@@ -742,7 +741,7 @@  discard block
 block discarded – undo
742 741
 
743 742
 }
744 743
 
745
-add_action( 'user_profile_update_errors', 'give_validate_user_profile', 10, 3 );
744
+add_action('user_profile_update_errors', 'give_validate_user_profile', 10, 3);
746 745
 
747 746
 /**
748 747
  * Show Donor Information on User Profile Page.
@@ -751,19 +750,19 @@  discard block
 block discarded – undo
751 750
  *
752 751
  * @since 2.0
753 752
  */
754
-function give_donor_information_profile_fields( $user ) {
755
-	$donor = Give()->donors->get_donor_by( 'user_id', $user->ID );
753
+function give_donor_information_profile_fields($user) {
754
+	$donor = Give()->donors->get_donor_by('user_id', $user->ID);
756 755
 
757 756
 	// Display Donor Information, only if donor is attached with User.
758
-	if ( ! empty( $donor->user_id ) ) {
757
+	if ( ! empty($donor->user_id)) {
759 758
 		?>
760 759
 		<table class="form-table">
761 760
 			<tbody>
762 761
 			<tr>
763
-				<th scope="row"><?php _e( 'Donor', 'give' ); ?></th>
762
+				<th scope="row"><?php _e('Donor', 'give'); ?></th>
764 763
 				<td>
765
-					<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>">
766
-						<?php _e( 'View Donor Information', 'give' ); ?>
764
+					<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>">
765
+						<?php _e('View Donor Information', 'give'); ?>
767 766
 					</a>
768 767
 				</td>
769 768
 			</tr>
@@ -773,7 +772,7 @@  discard block
 block discarded – undo
773 772
 	}
774 773
 }
775 774
 
776
-add_action( 'personal_options', 'give_donor_information_profile_fields' );
775
+add_action('personal_options', 'give_donor_information_profile_fields');
777 776
 /**
778 777
  * Get Array of WP User Roles.
779 778
  *
@@ -785,8 +784,8 @@  discard block
 block discarded – undo
785 784
 	$user_roles = array();
786 785
 
787 786
 	// Loop through User Roles.
788
-	foreach ( get_editable_roles() as $role_name => $role_info ):
789
-		$user_roles[ $role_name ] = $role_info['name'];
787
+	foreach (get_editable_roles() as $role_name => $role_info):
788
+		$user_roles[$role_name] = $role_info['name'];
790 789
 	endforeach;
791 790
 
792 791
 	return $user_roles;
@@ -803,44 +802,42 @@  discard block
 block discarded – undo
803 802
 function __give_ajax_donor_manage_addresses() {
804 803
 	// Bailout.
805 804
 	if (
806
-		empty( $_POST['form'] ) ||
807
-		empty( $_POST['donorID'] )
805
+		empty($_POST['form']) ||
806
+		empty($_POST['donorID'])
808 807
 	) {
809
-		wp_send_json_error( array( 'error' => 1 ) );
808
+		wp_send_json_error(array('error' => 1));
810 809
 	}
811 810
 
812
-	$post                  = give_clean( wp_parse_args( $_POST ) );
813
-	$donorID               = absint( $post['donorID'] );
814
-	$form_data             = give_clean( wp_parse_args( $post['form'] ) );
815
-	$is_multi_address_type = ( 'billing' === $form_data['address-id'] || false !== strpos( $form_data['address-id'], '_' ) );
816
-	$address_type          = false !== strpos( $form_data['address-id'], '_' ) ?
817
-		array_shift( explode( '_', $form_data['address-id'] ) ) :
818
-		$form_data['address-id'];
819
-	$address_id            = false !== strpos( $form_data['address-id'], '_' ) ?
820
-		array_pop( explode( '_', $form_data['address-id'] ) ) :
821
-		null;
811
+	$post                  = give_clean(wp_parse_args($_POST));
812
+	$donorID               = absint($post['donorID']);
813
+	$form_data             = give_clean(wp_parse_args($post['form']));
814
+	$is_multi_address_type = ('billing' === $form_data['address-id'] || false !== strpos($form_data['address-id'], '_'));
815
+	$address_type          = false !== strpos($form_data['address-id'], '_') ?
816
+		array_shift(explode('_', $form_data['address-id'])) : $form_data['address-id'];
817
+	$address_id            = false !== strpos($form_data['address-id'], '_') ?
818
+		array_pop(explode('_', $form_data['address-id'])) : null;
822 819
 	$response_data         = array(
823 820
 		'action' => $form_data['address-action'],
824 821
 		'id'     => $form_data['address-id'],
825 822
 	);
826 823
 
827 824
 	// Security check.
828
-	if ( ! wp_verify_nonce( $form_data['_wpnonce'], 'give-manage-donor-addresses' ) ) {
829
-		wp_send_json_error( array(
825
+	if ( ! wp_verify_nonce($form_data['_wpnonce'], 'give-manage-donor-addresses')) {
826
+		wp_send_json_error(array(
830 827
 				'error'     => 1,
831 828
 				'error_msg' => wp_sprintf(
832 829
 					'<div class="notice notice-error"><p>%s</p></div>',
833
-					__( 'Error: Security issue.', 'give' )
830
+					__('Error: Security issue.', 'give')
834 831
 				)
835 832
 			)
836 833
 		);
837 834
 	}
838 835
 
839
-	$donor = new Give_Donor( $donorID );
836
+	$donor = new Give_Donor($donorID);
840 837
 
841 838
 	// Verify donor.
842
-	if ( ! $donor->id ) {
843
-		wp_send_json_error( array( 'error' => 3 ) );
839
+	if ( ! $donor->id) {
840
+		wp_send_json_error(array('error' => 3));
844 841
 	}
845 842
 
846 843
 	// Unset all data except address.
@@ -851,57 +848,55 @@  discard block
 block discarded – undo
851 848
 	);
852 849
 
853 850
 	// Process action.
854
-	switch ( $response_data['action'] ) {
851
+	switch ($response_data['action']) {
855 852
 
856 853
 		case 'add':
857
-			if ( ! $donor->add_address( "{$address_type}[]", $form_data ) ) {
858
-				wp_send_json_error( array(
854
+			if ( ! $donor->add_address("{$address_type}[]", $form_data)) {
855
+				wp_send_json_error(array(
859 856
 						'error'     => 1,
860 857
 						'error_msg' => wp_sprintf(
861 858
 							'<div class="notice notice-error"><p>%s</p></div>',
862
-							__( 'Error: Unable to save the address. Please check if address already exist.', 'give' )
859
+							__('Error: Unable to save the address. Please check if address already exist.', 'give')
863 860
 						)
864 861
 					)
865 862
 				);
866 863
 			}
867 864
 
868
-			$total_addresses = count( $donor->address[ $address_type ] );
865
+			$total_addresses = count($donor->address[$address_type]);
869 866
 
870 867
 			$address_index = $is_multi_address_type ?
871
-				$total_addresses - 1 :
872
-				$address_type;
868
+				$total_addresses - 1 : $address_type;
873 869
 
874 870
 			$address_id = $is_multi_address_type ?
875
-				end( array_keys( $donor->address[ $address_type ] ) ) :
876
-				$address_type;
871
+				end(array_keys($donor->address[$address_type])) : $address_type;
877 872
 
878 873
 			$response_data['address_html'] = __give_get_format_address(
879
-				end( $donor->address['billing'] ),
874
+				end($donor->address['billing']),
880 875
 				array(
881 876
 					// We can add only billing address from donor screen.
882 877
 					'type'  => 'billing',
883 878
 					'id'    => $address_id,
884
-					'index' => ++ $address_index,
879
+					'index' => ++$address_index,
885 880
 				)
886 881
 			);
887
-			$response_data['success_msg']  = wp_sprintf(
882
+			$response_data['success_msg'] = wp_sprintf(
888 883
 				'<div class="notice updated"><p>%s</p></div>',
889
-				__( 'Successfully added a new address to the donor.', 'give' )
884
+				__('Successfully added a new address to the donor.', 'give')
890 885
 			);
891 886
 
892
-			if ( $is_multi_address_type ) {
887
+			if ($is_multi_address_type) {
893 888
 				$response_data['id'] = "{$response_data['id']}_{$address_index}";
894 889
 			}
895 890
 
896 891
 			break;
897 892
 
898 893
 		case 'remove':
899
-			if ( ! $donor->remove_address( $response_data['id'] ) ) {
900
-				wp_send_json_error( array(
894
+			if ( ! $donor->remove_address($response_data['id'])) {
895
+				wp_send_json_error(array(
901 896
 						'error'     => 2,
902 897
 						'error_msg' => wp_sprintf(
903 898
 							'<div class="notice notice-error"><p>%s</p></div>',
904
-							__( 'Error: Unable to delete address.', 'give' )
899
+							__('Error: Unable to delete address.', 'give')
905 900
 						)
906 901
 					)
907 902
 				);
@@ -909,18 +904,18 @@  discard block
 block discarded – undo
909 904
 
910 905
 			$response_data['success_msg'] = wp_sprintf(
911 906
 				'<div class="notice updated"><p>%s</p></div>',
912
-				__( 'Successfully removed a address of donor.', 'give' )
907
+				__('Successfully removed a address of donor.', 'give')
913 908
 			);
914 909
 
915 910
 			break;
916 911
 
917 912
 		case 'update':
918
-			if ( ! $donor->update_address( $response_data['id'], $form_data ) ) {
919
-				wp_send_json_error( array(
913
+			if ( ! $donor->update_address($response_data['id'], $form_data)) {
914
+				wp_send_json_error(array(
920 915
 						'error'     => 3,
921 916
 						'error_msg' => wp_sprintf(
922 917
 							'<div class="notice notice-error"><p>%s</p></div>',
923
-							__( 'Error: Unable to update address. Please check if address already exist.', 'give' )
918
+							__('Error: Unable to update address. Please check if address already exist.', 'give')
924 919
 						)
925 920
 					)
926 921
 				);
@@ -928,26 +923,25 @@  discard block
 block discarded – undo
928 923
 
929 924
 			$response_data['address_html'] = __give_get_format_address(
930 925
 				$is_multi_address_type ?
931
-					$donor->address[ $address_type ][ $address_id ] :
932
-					$donor->address[ $address_type ],
926
+					$donor->address[$address_type][$address_id] : $donor->address[$address_type],
933 927
 				array(
934 928
 					'type'  => $address_type,
935 929
 					'id'    => $address_id,
936 930
 					'index' => $address_id,
937 931
 				)
938 932
 			);
939
-			$response_data['success_msg']  = wp_sprintf(
933
+			$response_data['success_msg'] = wp_sprintf(
940 934
 				'<div class="notice updated"><p>%s</p></div>',
941
-				__( 'Successfully updated a address of donor', 'give' )
935
+				__('Successfully updated a address of donor', 'give')
942 936
 			);
943 937
 
944 938
 			break;
945 939
 	}
946 940
 
947
-	wp_send_json_success( $response_data );
941
+	wp_send_json_success($response_data);
948 942
 }
949 943
 
950
-add_action( 'wp_ajax_donor_manage_addresses', '__give_ajax_donor_manage_addresses' );
944
+add_action('wp_ajax_donor_manage_addresses', '__give_ajax_donor_manage_addresses');
951 945
 
952 946
 /**
953 947
  * Admin donor billing address label
@@ -958,13 +952,13 @@  discard block
 block discarded – undo
958 952
  *
959 953
  * @return string
960 954
  */
961
-function __give_donor_billing_address_label( $address_label ) {
962
-	$address_label = __( 'Billing Address', 'give' );
955
+function __give_donor_billing_address_label($address_label) {
956
+	$address_label = __('Billing Address', 'give');
963 957
 
964 958
 	return $address_label;
965 959
 }
966 960
 
967
-add_action( 'give_donor_billing_address_label', '__give_donor_billing_address_label' );
961
+add_action('give_donor_billing_address_label', '__give_donor_billing_address_label');
968 962
 
969 963
 /**
970 964
  * Admin donor personal address label
@@ -975,13 +969,13 @@  discard block
 block discarded – undo
975 969
  *
976 970
  * @return string
977 971
  */
978
-function __give_donor_personal_address_label( $address_label ) {
979
-	$address_label = __( 'Personal Address', 'give' );
972
+function __give_donor_personal_address_label($address_label) {
973
+	$address_label = __('Personal Address', 'give');
980 974
 
981 975
 	return $address_label;
982 976
 }
983 977
 
984
-add_action( 'give_donor_personal_address_label', '__give_donor_personal_address_label' );
978
+add_action('give_donor_personal_address_label', '__give_donor_personal_address_label');
985 979
 
986 980
 /**
987 981
  * Update Donor Information when User Profile is updated from admin.
@@ -994,32 +988,32 @@  discard block
 block discarded – undo
994 988
  *
995 989
  * @return bool
996 990
  */
997
-function give_update_donor_name_on_user_update( $user_id = 0 ) {
991
+function give_update_donor_name_on_user_update($user_id = 0) {
998 992
 
999
-	if ( current_user_can( 'edit_user', $user_id ) ) {
993
+	if (current_user_can('edit_user', $user_id)) {
1000 994
 
1001
-		$donor = new Give_Donor( $user_id, true );
995
+		$donor = new Give_Donor($user_id, true);
1002 996
 
1003 997
 		// Bailout, if donor doesn't exists.
1004
-		if ( ! $donor ) {
998
+		if ( ! $donor) {
1005 999
 			return false;
1006 1000
 		}
1007 1001
 
1008 1002
 		// Get User First name and Last name.
1009
-		$first_name = ( $_POST['first_name'] ) ? give_clean( $_POST['first_name'] ) : get_user_meta( $user_id, 'first_name', true );
1010
-		$last_name  = ( $_POST['last_name'] ) ? give_clean( $_POST['last_name'] ) : get_user_meta( $user_id, 'last_name', true );
1011
-		$full_name  = strip_tags( wp_unslash( trim( "{$first_name} {$last_name}" ) ) );
1003
+		$first_name = ($_POST['first_name']) ? give_clean($_POST['first_name']) : get_user_meta($user_id, 'first_name', true);
1004
+		$last_name  = ($_POST['last_name']) ? give_clean($_POST['last_name']) : get_user_meta($user_id, 'last_name', true);
1005
+		$full_name  = strip_tags(wp_unslash(trim("{$first_name} {$last_name}")));
1012 1006
 
1013 1007
 		// Assign User First name and Last name to Donor.
1014
-		Give()->donors->update( $donor->id, array( 'name' => $full_name ) );
1015
-		Give()->donor_meta->update_meta( $donor->id, '_give_donor_first_name', $first_name );
1016
-		Give()->donor_meta->update_meta( $donor->id, '_give_donor_last_name', $last_name );
1008
+		Give()->donors->update($donor->id, array('name' => $full_name));
1009
+		Give()->donor_meta->update_meta($donor->id, '_give_donor_first_name', $first_name);
1010
+		Give()->donor_meta->update_meta($donor->id, '_give_donor_last_name', $last_name);
1017 1011
 
1018 1012
 	}
1019 1013
 }
1020 1014
 
1021
-add_action( 'edit_user_profile_update', 'give_update_donor_name_on_user_update', 10 );
1022
-add_action( 'personal_options_update', 'give_update_donor_name_on_user_update', 10 );
1015
+add_action('edit_user_profile_update', 'give_update_donor_name_on_user_update', 10);
1016
+add_action('personal_options_update', 'give_update_donor_name_on_user_update', 10);
1023 1017
 
1024 1018
 
1025 1019
 /**
@@ -1034,29 +1028,29 @@  discard block
 block discarded – undo
1034 1028
  *
1035 1029
  * @return bool
1036 1030
  */
1037
-function give_update_donor_email_on_user_update( $user_id = 0, $old_user_data = false ) {
1031
+function give_update_donor_email_on_user_update($user_id = 0, $old_user_data = false) {
1038 1032
 
1039
-	$donor = new Give_Donor( $user_id, true );
1033
+	$donor = new Give_Donor($user_id, true);
1040 1034
 
1041
-	if ( ! $donor ) {
1035
+	if ( ! $donor) {
1042 1036
 		return false;
1043 1037
 	}
1044 1038
 
1045
-	$user = get_userdata( $user_id );
1039
+	$user = get_userdata($user_id);
1046 1040
 
1047
-	if ( ! empty( $user ) && $user->user_email !== $donor->email ) {
1041
+	if ( ! empty($user) && $user->user_email !== $donor->email) {
1048 1042
 
1049
-		$success = Give()->donors->update( $donor->id, array( 'email' => $user->user_email ) );
1043
+		$success = Give()->donors->update($donor->id, array('email' => $user->user_email));
1050 1044
 
1051
-		if ( $success ) {
1045
+		if ($success) {
1052 1046
 			// Update some payment meta if we need to
1053
-			$payments_array = explode( ',', $donor->payment_ids );
1047
+			$payments_array = explode(',', $donor->payment_ids);
1054 1048
 
1055
-			if ( ! empty( $payments_array ) ) {
1049
+			if ( ! empty($payments_array)) {
1056 1050
 
1057
-				foreach ( $payments_array as $payment_id ) {
1051
+				foreach ($payments_array as $payment_id) {
1058 1052
 
1059
-					give_update_payment_meta( $payment_id, 'email', $user->user_email );
1053
+					give_update_payment_meta($payment_id, 'email', $user->user_email);
1060 1054
 
1061 1055
 				}
1062 1056
 
@@ -1070,7 +1064,7 @@  discard block
 block discarded – undo
1070 1064
 			 * @param  WP_User    $user  WordPress User object.
1071 1065
 			 * @param  Give_Donor $donor Give donor object.
1072 1066
 			 */
1073
-			do_action( 'give_update_donor_email_on_user_update', $user, $donor );
1067
+			do_action('give_update_donor_email_on_user_update', $user, $donor);
1074 1068
 
1075 1069
 		}
1076 1070
 
@@ -1078,4 +1072,4 @@  discard block
 block discarded – undo
1078 1072
 
1079 1073
 }
1080 1074
 
1081
-add_action( 'profile_update', 'give_update_donor_email_on_user_update', 10, 2 );
1082 1075
\ No newline at end of file
1076
+add_action('profile_update', 'give_update_donor_email_on_user_update', 10, 2);
1083 1077
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/donors/donor-functions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
  * Connect and Reconnect Donor with User profile.
90 90
  * @todo $address is unnecessary param because we are store address to user.
91 91
  *
92
- * @param object $donor      Donor Object.
92
+ * @param Give_Donor $donor      Donor Object.
93 93
  * @param array  $donor_data Donor Post Variables.
94 94
  * @param array  $address    Address Information.
95 95
  *
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 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,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array        The altered list of views.
25 25
  */
26
-function give_register_default_donor_views( $views ) {
26
+function give_register_default_donor_views($views) {
27 27
 
28 28
 	$default_views = array(
29 29
 		'overview' => 'give_donor_view',
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 		'notes'    => 'give_donor_notes_view',
32 32
 	);
33 33
 
34
-	return array_merge( $views, $default_views );
34
+	return array_merge($views, $default_views);
35 35
 
36 36
 }
37 37
 
38
-add_filter( 'give_donor_views', 'give_register_default_donor_views', 1, 1 );
38
+add_filter('give_donor_views', 'give_register_default_donor_views', 1, 1);
39 39
 
40 40
 /**
41 41
  * Register a tab for the single donor view.
@@ -46,23 +46,23 @@  discard block
 block discarded – undo
46 46
  *
47 47
  * @return array       The altered list of tabs
48 48
  */
49
-function give_register_default_donor_tabs( $tabs ) {
49
+function give_register_default_donor_tabs($tabs) {
50 50
 
51 51
 	$default_tabs = array(
52 52
 		'overview' => array(
53 53
 			'dashicon' => 'dashicons-admin-users',
54
-			'title' => __( 'Donor Profile', 'give' ),
54
+			'title' => __('Donor Profile', 'give'),
55 55
 		),
56 56
 		'notes'    => array(
57 57
 			'dashicon' => 'dashicons-admin-comments',
58
-			'title' => __( 'Donor Notes', 'give' ),
58
+			'title' => __('Donor Notes', 'give'),
59 59
 		),
60 60
 	);
61 61
 
62
-	return array_merge( $tabs, $default_tabs );
62
+	return array_merge($tabs, $default_tabs);
63 63
 }
64 64
 
65
-add_filter( 'give_donor_tabs', 'give_register_default_donor_tabs', 1, 1 );
65
+add_filter('give_donor_tabs', 'give_register_default_donor_tabs', 1, 1);
66 66
 
67 67
 /**
68 68
  * Register the Delete icon as late as possible so it's at the bottom.
@@ -73,17 +73,17 @@  discard block
 block discarded – undo
73 73
  *
74 74
  * @return array       The altered list of tabs, with 'delete' at the bottom.
75 75
  */
76
-function give_register_delete_donor_tab( $tabs ) {
76
+function give_register_delete_donor_tab($tabs) {
77 77
 
78 78
 	$tabs['delete'] = array(
79 79
 		'dashicon' => 'dashicons-trash',
80
-		'title'    => __( 'Delete Donor', 'give' ),
80
+		'title'    => __('Delete Donor', 'give'),
81 81
 	);
82 82
 
83 83
 	return $tabs;
84 84
 }
85 85
 
86
-add_filter( 'give_donor_tabs', 'give_register_delete_donor_tab', PHP_INT_MAX, 1 );
86
+add_filter('give_donor_tabs', 'give_register_delete_donor_tab', PHP_INT_MAX, 1);
87 87
 
88 88
 /**
89 89
  * Connect and Reconnect Donor with User profile.
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
  *
98 98
  * @return array
99 99
  */
100
-function give_connect_user_donor_profile( $donor, $donor_data, $address ) {
100
+function give_connect_user_donor_profile($donor, $donor_data, $address) {
101 101
 
102 102
 	$donor_id         = $donor->id;
103 103
 	$previous_user_id = $donor->user_id;
@@ -111,31 +111,31 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 * @since 1.0
113 113
 	 */
114
-	do_action( 'give_pre_edit_donor', $donor_id, $donor_data, $address );
114
+	do_action('give_pre_edit_donor', $donor_id, $donor_data, $address);
115 115
 
116 116
 	$output = array();
117 117
 
118
-	if ( $donor->update( $donor_data ) ) {
118
+	if ($donor->update($donor_data)) {
119 119
 
120 120
 		// Create and Update Donor First Name and Last Name in Meta Fields.
121
-		$donor->update_meta( '_give_donor_first_name', $donor_data['first_name'] );
122
-		$donor->update_meta( '_give_donor_last_name', $donor_data['last_name'] );
121
+		$donor->update_meta('_give_donor_first_name', $donor_data['first_name']);
122
+		$donor->update_meta('_give_donor_last_name', $donor_data['last_name']);
123 123
 
124 124
 		// Fetch disconnected user id, if exists.
125
-		$disconnected_user_id = $donor->get_meta( '_give_disconnected_user_id', true );
125
+		$disconnected_user_id = $donor->get_meta('_give_disconnected_user_id', true);
126 126
 
127 127
 		// Flag User and Donor Disconnection.
128
-		delete_user_meta( $disconnected_user_id, '_give_is_donor_disconnected' );
128
+		delete_user_meta($disconnected_user_id, '_give_is_donor_disconnected');
129 129
 
130 130
 		// Check whether the disconnected user id and the reconnected user id are same or not.
131 131
 		// If both are same then delete user id store in donor meta.
132
-		if( $donor_data['user_id'] === $disconnected_user_id ) {
133
-			delete_user_meta( $disconnected_user_id, '_give_disconnected_donor_id' );
134
-			$donor->delete_meta( '_give_disconnected_user_id' );
132
+		if ($donor_data['user_id'] === $disconnected_user_id) {
133
+			delete_user_meta($disconnected_user_id, '_give_disconnected_donor_id');
134
+			$donor->delete_meta('_give_disconnected_user_id');
135 135
 		}
136 136
 
137 137
 		$output['success']       = true;
138
-		$donor_data              = array_merge( $donor_data, $address );
138
+		$donor_data              = array_merge($donor_data, $address);
139 139
 		$output['customer_info'] = $donor_data;
140 140
 
141 141
 	} else {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 *
153 153
 	 * @since 1.0
154 154
 	 */
155
-	do_action( 'give_post_edit_donor', $donor_id, $donor_data );
155
+	do_action('give_post_edit_donor', $donor_id, $donor_data);
156 156
 
157 157
 
158 158
 	return $output;
Please login to merge, or discard this patch.
includes/admin/emails/abstract-email-notification.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -600,7 +600,7 @@
 block discarded – undo
600 600
 		 *
601 601
 		 * @param int $form_id
602 602
 		 *
603
-		 * @return array|string
603
+		 * @return string
604 604
 		 */
605 605
 		public function get_preview_email_recipient( $form_id = null ) {
606 606
 			$recipients = $this->get_recipient( $form_id );
Please login to merge, or discard this patch.
Spacing   +156 added lines, -157 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if access directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19
-if ( ! class_exists( 'Give_Email_Notification' ) ) :
19
+if ( ! class_exists('Give_Email_Notification')) :
20 20
 
21 21
 	/**
22 22
 	 * Give_Email_Notification
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
 		 *
94 94
 		 * @return Give_Email_Notification
95 95
 		 */
96
-		public static function get_instance( $email_notification_id = '' ) {
96
+		public static function get_instance($email_notification_id = '') {
97 97
 			$class = '';
98 98
 
99
-			if ( ! empty( $email_notification_id ) ) {
99
+			if ( ! empty($email_notification_id)) {
100 100
 				/* @var Give_Email_Notification $class */
101
-				foreach ( self::$singleton as $class ) {
102
-					if ( $email_notification_id === $class->config['id'] ) {
103
-						$class = get_class( $class );
101
+				foreach (self::$singleton as $class) {
102
+					if ($email_notification_id === $class->config['id']) {
103
+						$class = get_class($class);
104 104
 						break;
105 105
 					}
106 106
 				}
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 				$class = get_called_class();
109 109
 			}
110 110
 
111
-			if ( ! empty( $class ) && ( ! array_key_exists( $class, self::$singleton ) || is_null( self::$singleton[ $class ] ) ) ) {
112
-				self::$singleton[ $class ] = new $class();
111
+			if ( ! empty($class) && ( ! array_key_exists($class, self::$singleton) || is_null(self::$singleton[$class]))) {
112
+				self::$singleton[$class] = new $class();
113 113
 			}
114 114
 
115
-			return ( isset( self::$singleton[ $class ] ) ? self::$singleton[ $class ] : null );
115
+			return (isset(self::$singleton[$class]) ? self::$singleton[$class] : null);
116 116
 		}
117 117
 
118 118
 		/**
@@ -123,35 +123,35 @@  discard block
 block discarded – undo
123 123
 		 *
124 124
 		 * @param array $config
125 125
 		 */
126
-		public function load( $config ) {
126
+		public function load($config) {
127 127
 			// Set notification configuration.
128
-			$this->config = wp_parse_args( $config, $this->config );
128
+			$this->config = wp_parse_args($config, $this->config);
129 129
 
130 130
 			// Set email preview header status.
131 131
 			$this->config['has_preview_header'] = $this->config['has_preview'] && $this->config['has_preview_header'] ? true : false;
132 132
 
133 133
 			// Set email content type
134
-			$this->config['content_type'] = empty( $this->config['content_type'] ) || ! in_array( $this->config['content_type'], array(
134
+			$this->config['content_type'] = empty($this->config['content_type']) || ! in_array($this->config['content_type'], array(
135 135
 				'text/html',
136 136
 				'text/plain',
137
-			) )
137
+			))
138 138
 				? Give()->emails->get_content_type()
139 139
 				: $this->config['content_type'];
140
-			$this->config['content_type'] = give_get_option( Give_Email_Setting_Field::get_prefix( $this ) . 'email_content_type', $this->config['content_type'] );
140
+			$this->config['content_type'] = give_get_option(Give_Email_Setting_Field::get_prefix($this).'email_content_type', $this->config['content_type']);
141 141
 
142 142
 			// Set email template type.
143
-			$this->config['email_template'] = empty( $this->config['email_template'] )
144
-				? give_get_option( 'email_template' )
143
+			$this->config['email_template'] = empty($this->config['email_template'])
144
+				? give_get_option('email_template')
145 145
 				: $this->config['email_template'];
146 146
 
147 147
 			// Set recipient group name.
148
-			$this->config['recipient_group_name'] = empty( $this->config['recipient_group_name'] )
149
-				? ( ! Give_Email_Notification_Util::has_recipient_field( $this ) ? __( 'Donor', 'give' ) : '' )
148
+			$this->config['recipient_group_name'] = empty($this->config['recipient_group_name'])
149
+				? ( ! Give_Email_Notification_Util::has_recipient_field($this) ? __('Donor', 'give') : '')
150 150
 				: $this->config['recipient_group_name'];
151 151
 
152 152
 			// Non notification status editable notice.
153
-			$this->config['notices']['non-notification-status-editable'] = empty( $this->config['notices']['non-notification-status-editable'] )
154
-				? __( 'You can not edit notification status from here.', 'give' )
153
+			$this->config['notices']['non-notification-status-editable'] = empty($this->config['notices']['non-notification-status-editable'])
154
+				? __('You can not edit notification status from here.', 'give')
155 155
 				: $this->config['notices']['non-notification-status-editable'];
156 156
 
157 157
 			/**
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 			 * @param                         array                   Give_Email_Notification::config
163 163
 			 * @param Give_Email_Notification $this
164 164
 			 */
165
-			$this->config = apply_filters( 'give_email_api_notification_config', $this->config, $this );
165
+			$this->config = apply_filters('give_email_api_notification_config', $this->config, $this);
166 166
 
167 167
 			// Setup filters.
168 168
 			$this->setup_filters();
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		 */
178 178
 		private function setup_filters() {
179 179
 			// Apply filter only for current email notification section.
180
-			if ( give_get_current_setting_section() === $this->config['id'] ) {
180
+			if (give_get_current_setting_section() === $this->config['id']) {
181 181
 				// Initialize email context for email notification.
182 182
 				$this->config['email_tag_context'] = apply_filters(
183 183
 					"give_{$this->config['id']}_email_tag_context",
@@ -187,23 +187,23 @@  discard block
 block discarded – undo
187 187
 			}
188 188
 
189 189
 			// Setup setting fields.
190
-			if( $this->config['show_on_emails_setting_page'] ) {
191
-				add_filter( 'give_get_settings_emails', array( $this, 'add_setting_fields' ), 10, 2 );
190
+			if ($this->config['show_on_emails_setting_page']) {
191
+				add_filter('give_get_settings_emails', array($this, 'add_setting_fields'), 10, 2);
192 192
 			}
193 193
 
194
-			if ( $this->config['form_metabox_setting'] ) {
194
+			if ($this->config['form_metabox_setting']) {
195 195
 				add_filter(
196 196
 					'give_email_notification_options_metabox_fields',
197
-					array( $this, 'add_metabox_setting_field' ),
197
+					array($this, 'add_metabox_setting_field'),
198 198
 					10,
199 199
 					2
200 200
 				);
201 201
 			}
202 202
 
203
-			if( $this->config['has_recipient_field'] ) {
203
+			if ($this->config['has_recipient_field']) {
204 204
 				add_action(
205 205
 						"give_save__give_{$this->config['id']}_recipient",
206
-						array( $this, 'validate_form_recipient_field_value' ),
206
+						array($this, 'validate_form_recipient_field_value'),
207 207
 						10,
208 208
 						3
209 209
 				);
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 		 *
242 242
 		 * @return array
243 243
 		 */
244
-		public function add_section( $sections ) {
245
-			$sections[ $this->config['id'] ] = $this->config['label'];
244
+		public function add_section($sections) {
245
+			$sections[$this->config['id']] = $this->config['label'];
246 246
 
247 247
 			return $sections;
248 248
 		}
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		 *
257 257
 		 * @return bool
258 258
 		 */
259
-		public function hide_section( $hide_section ) {
259
+		public function hide_section($hide_section) {
260 260
 			$hide_section = true;
261 261
 
262 262
 			return $hide_section;
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
 		 *
273 273
 		 * @return  array
274 274
 		 */
275
-		public function add_setting_fields( $settings ) {
276
-			if ( $this->config['id'] === give_get_current_setting_section() ) {
275
+		public function add_setting_fields($settings) {
276
+			if ($this->config['id'] === give_get_current_setting_section()) {
277 277
 				$settings = $this->get_setting_fields();
278 278
 			}
279 279
 
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
 		 *
292 292
 		 * @return array
293 293
 		 */
294
-		public function get_setting_fields( $form_id = null ) {
295
-			return Give_Email_Setting_Field::get_setting_fields( $this, $form_id );
294
+		public function get_setting_fields($form_id = null) {
295
+			return Give_Email_Setting_Field::get_setting_fields($this, $form_id);
296 296
 		}
297 297
 
298 298
 
@@ -307,13 +307,13 @@  discard block
 block discarded – undo
307 307
 		 *
308 308
 		 * @return array
309 309
 		 */
310
-		public function add_metabox_setting_field( $settings, $form_id ) {
310
+		public function add_metabox_setting_field($settings, $form_id) {
311 311
 
312
-			if( Give_Email_Notification_Util::is_email_notification_active( $this ) ) {
312
+			if (Give_Email_Notification_Util::is_email_notification_active($this)) {
313 313
 				$settings[] = array(
314 314
 					'id'     => $this->config['id'],
315 315
 					'title'  => $this->config['label'],
316
-					'fields' => $this->get_setting_fields( $form_id ),
316
+					'fields' => $this->get_setting_fields($form_id),
317 317
 				);
318 318
 			}
319 319
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 		 *
332 332
 		 * @return array
333 333
 		 */
334
-		public function get_extra_setting_fields( $form_id = null ) {
334
+		public function get_extra_setting_fields($form_id = null) {
335 335
 			return array();
336 336
 		}
337 337
 
@@ -348,11 +348,11 @@  discard block
 block discarded – undo
348 348
 		 *
349 349
 		 * @return string|array
350 350
 		 */
351
-		public function get_recipient( $form_id = null ) {
352
-			if ( empty( $this->recipient_email ) && $this->config['has_recipient_field'] ) {
351
+		public function get_recipient($form_id = null) {
352
+			if (empty($this->recipient_email) && $this->config['has_recipient_field']) {
353 353
 				$this->recipient_email = Give_Email_Notification_Util::get_value(
354 354
 						$this,
355
-						Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'recipient',
355
+						Give_Email_Setting_Field::get_prefix($this, $form_id).'recipient',
356 356
 						$form_id
357 357
 				);
358 358
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 				 * @since 1.0
364 364
 				 * @deprecated 2.0
365 365
 				 */
366
-				$this->recipient_email = apply_filters( 'give_admin_notice_emails', $this->recipient_email, $this, $form_id );
366
+				$this->recipient_email = apply_filters('give_admin_notice_emails', $this->recipient_email, $this, $form_id);
367 367
 			}
368 368
 
369 369
 			/**
@@ -393,10 +393,10 @@  discard block
 block discarded – undo
393 393
 		 *
394 394
 		 * @return bool
395 395
 		 */
396
-		public function get_notification_status( $form_id = null ) {
397
-			$notification_status = empty( $form_id )
398
-				? give_get_option( "{$this->config['id']}_notification", $this->config['notification_status'] )
399
-				: give_get_meta( $form_id, Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'notification', true, 'global' );
396
+		public function get_notification_status($form_id = null) {
397
+			$notification_status = empty($form_id)
398
+				? give_get_option("{$this->config['id']}_notification", $this->config['notification_status'])
399
+				: give_get_meta($form_id, Give_Email_Setting_Field::get_prefix($this, $form_id).'notification', true, 'global');
400 400
 
401 401
 			/**
402 402
 			 * Filter the notification status.
@@ -421,11 +421,11 @@  discard block
 block discarded – undo
421 421
 		 *
422 422
 		 * @return string
423 423
 		 */
424
-		function get_email_subject( $form_id = null ) {
424
+		function get_email_subject($form_id = null) {
425 425
 			$subject = wp_strip_all_tags(
426 426
 				Give_Email_Notification_Util::get_value(
427 427
 					$this,
428
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
428
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
429 429
 					$form_id,
430 430
 					$this->config['default_email_subject']
431 431
 				)
@@ -454,10 +454,10 @@  discard block
 block discarded – undo
454 454
 		 *
455 455
 		 * @return string
456 456
 		 */
457
-		public function get_email_message( $form_id = null ) {
457
+		public function get_email_message($form_id = null) {
458 458
 			$message = Give_Email_Notification_Util::get_value(
459 459
 				$this,
460
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
460
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
461 461
 				$form_id,
462 462
 				$this->config['default_email_message']
463 463
 			);
@@ -486,10 +486,10 @@  discard block
 block discarded – undo
486 486
 		 *
487 487
 		 * @return string
488 488
 		 */
489
-		public function get_email_content_type( $form_id ) {
489
+		public function get_email_content_type($form_id) {
490 490
 			$content_type = Give_Email_Notification_Util::get_value(
491 491
 				$this,
492
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_content_type',
492
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_content_type',
493 493
 				$form_id,
494 494
 				$this->config['content_type']
495 495
 			);
@@ -517,15 +517,14 @@  discard block
 block discarded – undo
517 517
 		 *
518 518
 		 * @return string
519 519
 		 */
520
-		public function get_email_template( $form_id ) {
521
-			$email_template = give_get_meta( $form_id, '_give_email_template', true );
520
+		public function get_email_template($form_id) {
521
+			$email_template = give_get_meta($form_id, '_give_email_template', true);
522 522
 			$email_template = Give_Email_Notification_Util::get_value(
523 523
 				$this,
524
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) .'email_template',
524
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_template',
525 525
 				$form_id,
526
-				! empty( $email_template ) && Give_Email_Notification_Util::can_use_form_email_options( $this, $form_id ) ?
527
-					$email_template :
528
-					$this->config['email_template']
526
+				! empty($email_template) && Give_Email_Notification_Util::can_use_form_email_options($this, $form_id) ?
527
+					$email_template : $this->config['email_template']
529 528
 			);
530 529
 
531 530
 			/**
@@ -552,34 +551,34 @@  discard block
 block discarded – undo
552 551
 		 *
553 552
 		 * @return array
554 553
 		 */
555
-		public function get_allowed_email_tags( $formatted = false ) {
554
+		public function get_allowed_email_tags($formatted = false) {
556 555
 			// Get all email tags.
557 556
 			$email_tags = Give()->email_tags->get_tags();
558 557
 
559 558
 			// Skip if all email template tags context setup exit.
560
-			if ( $this->config['email_tag_context'] && 'all' !== $this->config['email_tag_context'] ) {
561
-				if ( is_array( $this->config['email_tag_context'] ) ) {
562
-					foreach ( $email_tags as $index => $email_tag ) {
563
-						if ( in_array( $email_tag['context'], $this->config['email_tag_context'] ) ) {
559
+			if ($this->config['email_tag_context'] && 'all' !== $this->config['email_tag_context']) {
560
+				if (is_array($this->config['email_tag_context'])) {
561
+					foreach ($email_tags as $index => $email_tag) {
562
+						if (in_array($email_tag['context'], $this->config['email_tag_context'])) {
564 563
 							continue;
565 564
 						}
566 565
 
567
-						unset( $email_tags[ $index ] );
566
+						unset($email_tags[$index]);
568 567
 					}
569 568
 				} else {
570
-					foreach ( $email_tags as $index => $email_tag ) {
571
-						if ( $this->config['email_tag_context'] === $email_tag['context'] ) {
569
+					foreach ($email_tags as $index => $email_tag) {
570
+						if ($this->config['email_tag_context'] === $email_tag['context']) {
572 571
 							continue;
573 572
 						}
574 573
 
575
-						unset( $email_tags[ $index ] );
574
+						unset($email_tags[$index]);
576 575
 					}
577 576
 				}
578 577
 			}
579 578
 
580
-			if ( count( $email_tags ) && $formatted ) : ob_start() ?>
579
+			if (count($email_tags) && $formatted) : ob_start() ?>
581 580
 				<div class="give-email-tags-wrap">
582
-					<?php foreach ( $email_tags as $email_tag ) : ?>
581
+					<?php foreach ($email_tags as $email_tag) : ?>
583 582
 						<span class="give_<?php echo $email_tag['tag']; ?>_tag">
584 583
 							<code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?>
585 584
 						</span>
@@ -602,8 +601,8 @@  discard block
 block discarded – undo
602 601
 		 *
603 602
 		 * @return array|string
604 603
 		 */
605
-		public function get_preview_email_recipient( $form_id = null ) {
606
-			$recipients = $this->get_recipient( $form_id );
604
+		public function get_preview_email_recipient($form_id = null) {
605
+			$recipients = $this->get_recipient($form_id);
607 606
 
608 607
 			/**
609 608
 			 * Filter the preview email recipients.
@@ -613,7 +612,7 @@  discard block
 block discarded – undo
613 612
 			 * @param string|array            $recipients List of recipients.
614 613
 			 * @param Give_Email_Notification $this
615 614
 			 */
616
-			$recipients = apply_filters( 'give_get_preview_email_recipient', $recipients, $this, $form_id );
615
+			$recipients = apply_filters('give_get_preview_email_recipient', $recipients, $this, $form_id);
617 616
 
618 617
 			return $recipients;
619 618
 		}
@@ -628,13 +627,13 @@  discard block
 block discarded – undo
628 627
 		 *
629 628
 		 * @return array
630 629
 		 */
631
-		public function get_email_attachments( $form_id = null ) {
630
+		public function get_email_attachments($form_id = null) {
632 631
 			/**
633 632
 			 * Filter the attachment.
634 633
 			 *
635 634
 			 * @since 2.0
636 635
 			 */
637
-			return apply_filters( "give_{$this->config['id']}_get_email_attachments", array(), $this, $form_id );
636
+			return apply_filters("give_{$this->config['id']}_get_email_attachments", array(), $this, $form_id);
638 637
 		}
639 638
 
640 639
 
@@ -646,37 +645,37 @@  discard block
 block discarded – undo
646 645
 		 */
647 646
 		public function send_preview_email() {
648 647
 			// Get form id
649
-			$form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null;
648
+			$form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null;
650 649
 
651 650
 			// setup email data.
652 651
 			$this->setup_email_data();
653 652
 
654 653
 			$attachments  = $this->get_email_attachments();
655
-			$message      = $this->preview_email_template_tags( $this->get_email_message( $form_id ) );
656
-			$subject      = $this->preview_email_template_tags( $this->get_email_subject( $form_id ) );
657
-			$content_type = $this->get_email_content_type( $form_id );
654
+			$message      = $this->preview_email_template_tags($this->get_email_message($form_id));
655
+			$subject      = $this->preview_email_template_tags($this->get_email_subject($form_id));
656
+			$content_type = $this->get_email_content_type($form_id);
658 657
 
659 658
 			// Setup email content type.
660
-			Give()->emails->__set( 'content_type', $content_type );
661
-			Give()->emails->__set( 'html', true );
659
+			Give()->emails->__set('content_type', $content_type);
660
+			Give()->emails->__set('html', true);
662 661
 
663 662
 			// Setup email template
664
-			Give()->emails->__set( 'template', $this->get_email_template( $form_id ) );
663
+			Give()->emails->__set('template', $this->get_email_template($form_id));
665 664
 
666 665
 			// Format plain content type email.
667
-			if ( 'text/plain' === $content_type ) {
668
-				Give()->emails->__set( 'html', false );
669
-				Give()->emails->__set( 'template', 'none' );
670
-				$message = strip_tags( $message );
666
+			if ('text/plain' === $content_type) {
667
+				Give()->emails->__set('html', false);
668
+				Give()->emails->__set('template', 'none');
669
+				$message = strip_tags($message);
671 670
 			}
672 671
 
673
-			if ( Give_Email_Notification_Util::can_use_form_email_options( $this, $form_id ) ) {
672
+			if (Give_Email_Notification_Util::can_use_form_email_options($this, $form_id)) {
674 673
 				Give()->emails->form_id      = $form_id;
675
-				Give()->emails->from_name    = give_get_meta( $form_id, '_give_from_name', true );
676
-				Give()->emails->from_address = give_get_meta( $form_id, '_give_from_email', true );
674
+				Give()->emails->from_name    = give_get_meta($form_id, '_give_from_name', true);
675
+				Give()->emails->from_address = give_get_meta($form_id, '_give_from_email', true);
677 676
 			}
678 677
 
679
-			return Give()->emails->send( $this->get_preview_email_recipient( $form_id ), $subject, $message, $attachments );
678
+			return Give()->emails->send($this->get_preview_email_recipient($form_id), $subject, $message, $attachments);
680 679
 		}
681 680
 
682 681
 
@@ -697,7 +696,7 @@  discard block
 block discarded – undo
697 696
 		 *
698 697
 		 * @return bool
699 698
 		 */
700
-		public function send_email_notification( $email_tag_args = array() ) {
699
+		public function send_email_notification($email_tag_args = array()) {
701 700
 			// Add email content type email tags.
702 701
 			$email_tag_args['email_content_type'] = $this->config['content_type'];
703 702
 
@@ -706,16 +705,16 @@  discard block
 block discarded – undo
706 705
 			 *
707 706
 			 * @since 2.0
708 707
 			 */
709
-			$email_tag_args = apply_filters( "give_{$this->config['id']}_email_tag_args", $email_tag_args, $this );
708
+			$email_tag_args = apply_filters("give_{$this->config['id']}_email_tag_args", $email_tag_args, $this);
710 709
 
711 710
 			// Get form id.
712
-			$form_id = ! empty( $email_tag_args['form_id'] )
713
-				? absint( $email_tag_args['form_id'] )
714
-				: ( ! empty( $email_tag_args['payment_id'] ) ? give_get_payment_form_id( $email_tag_args['payment_id'] ) : null );
711
+			$form_id = ! empty($email_tag_args['form_id'])
712
+				? absint($email_tag_args['form_id'])
713
+				: ( ! empty($email_tag_args['payment_id']) ? give_get_payment_form_id($email_tag_args['payment_id']) : null);
715 714
 
716 715
 
717 716
 			// Do not send email if notification is disable.
718
-			if ( ! Give_Email_Notification_Util::is_email_notification_active( $this, $form_id ) ) {
717
+			if ( ! Give_Email_Notification_Util::is_email_notification_active($this, $form_id)) {
719 718
 				return false;
720 719
 			}
721 720
 
@@ -724,41 +723,41 @@  discard block
 block discarded – undo
724 723
 			 *
725 724
 			 * @since 2.0
726 725
 			 */
727
-			do_action( "give_{$this->config['id']}_email_send_before", $this, $form_id );
726
+			do_action("give_{$this->config['id']}_email_send_before", $this, $form_id);
728 727
 
729 728
 			$attachments  = $this->get_email_attachments();
730
-			$message      = give_do_email_tags( $this->get_email_message( $form_id ), $email_tag_args );
731
-			$subject      = give_do_email_tags( $this->get_email_subject( $form_id ), $email_tag_args );
732
-			$content_type = $this->get_email_content_type( $form_id );
729
+			$message      = give_do_email_tags($this->get_email_message($form_id), $email_tag_args);
730
+			$subject      = give_do_email_tags($this->get_email_subject($form_id), $email_tag_args);
731
+			$content_type = $this->get_email_content_type($form_id);
733 732
 
734 733
 			// Setup email content type.
735
-			Give()->emails->__set( 'content_type', $content_type );
736
-			Give()->emails->__set( 'html', true );
734
+			Give()->emails->__set('content_type', $content_type);
735
+			Give()->emails->__set('html', true);
737 736
 
738 737
 			// Set email template.
739
-			Give()->emails->__set( 'template', $this->get_email_template( $form_id ) );
738
+			Give()->emails->__set('template', $this->get_email_template($form_id));
740 739
 
741
-			if ( 'text/plain' === $content_type ) {
742
-				Give()->emails->__set( 'html', false );
743
-				Give()->emails->__set( 'template', 'none' );
744
-				$message = strip_tags( $message );
740
+			if ('text/plain' === $content_type) {
741
+				Give()->emails->__set('html', false);
742
+				Give()->emails->__set('template', 'none');
743
+				$message = strip_tags($message);
745 744
 			}
746 745
 
747
-			if ( Give_Email_Notification_Util::can_use_form_email_options( $this, $form_id ) ) {
746
+			if (Give_Email_Notification_Util::can_use_form_email_options($this, $form_id)) {
748 747
 				Give()->emails->form_id      = $form_id;
749
-				Give()->emails->from_name    = give_get_meta( $form_id, '_give_from_name', true );
750
-				Give()->emails->from_address = give_get_meta( $form_id, '_give_from_email', true );
748
+				Give()->emails->from_name    = give_get_meta($form_id, '_give_from_name', true);
749
+				Give()->emails->from_address = give_get_meta($form_id, '_give_from_email', true);
751 750
 			}
752 751
 
753 752
 			// Send email.
754
-			$email_status = Give()->emails->send( $this->get_recipient( $form_id ), $subject, $message, $attachments );
753
+			$email_status = Give()->emails->send($this->get_recipient($form_id), $subject, $message, $attachments);
755 754
 
756 755
 			/**
757 756
 			 * Fire action after after email send.
758 757
 			 *
759 758
 			 * @since 2.0
760 759
 			 */
761
-			do_action( "give_{$this->config['id']}_email_send_after", $email_status, $this, $form_id );
760
+			do_action("give_{$this->config['id']}_email_send_after", $email_status, $this, $form_id);
762 761
 
763 762
 			return $email_status;
764 763
 		}
@@ -773,67 +772,67 @@  discard block
 block discarded – undo
773 772
 		 *
774 773
 		 * @return string
775 774
 		 */
776
-		public function preview_email_template_tags( $message ) {
775
+		public function preview_email_template_tags($message) {
777 776
 			// Set Payment.
778
-			$payment_id = give_check_variable( give_clean( $_GET ), 'isset_empty', 0, 'preview_id' );
779
-			$payment    = $payment_id ? new Give_Payment( $payment_id ) : new stdClass();
777
+			$payment_id = give_check_variable(give_clean($_GET), 'isset_empty', 0, 'preview_id');
778
+			$payment    = $payment_id ? new Give_Payment($payment_id) : new stdClass();
780 779
 
781 780
 			// Set donor.
782 781
 			$user_id = $payment_id
783 782
 				? $payment->user_id
784
-				: give_check_variable( give_clean( $_GET ), 'isset_empty', 0, 'user_id' );
783
+				: give_check_variable(give_clean($_GET), 'isset_empty', 0, 'user_id');
785 784
 			$user_id = $user_id ? $user_id : wp_get_current_user()->ID;
786 785
 
787 786
 			// Set receipt.
788
-			$receipt_id = strtolower( md5( uniqid() ) );
787
+			$receipt_id = strtolower(md5(uniqid()));
789 788
 
790
-			$receipt_link_url = esc_url( add_query_arg( array(
789
+			$receipt_link_url = esc_url(add_query_arg(array(
791 790
 				'payment_key' => $receipt_id,
792
-			), give_get_history_page_uri() ) );
791
+			), give_get_history_page_uri()));
793 792
 
794 793
 			$receipt_link = sprintf(
795 794
 				'<a href="%1$s">%2$s</a>',
796 795
 				$receipt_link_url,
797
-				esc_html__( 'View the receipt in your browser &raquo;', 'give' )
796
+				esc_html__('View the receipt in your browser &raquo;', 'give')
798 797
 			);
799 798
 
800 799
 			// Set default values for tags.
801 800
 			$this->config['preview_email_tags_values'] = wp_parse_args(
802 801
 				$this->config['preview_email_tags_values'],
803 802
 				array(
804
-					'name'              => give_email_tag_first_name( array(
803
+					'name'              => give_email_tag_first_name(array(
805 804
 						'payment_id' => $payment_id,
806 805
 						'user_id'    => $user_id,
807
-					) ),
808
-					'fullname'          => give_email_tag_fullname( array(
806
+					)),
807
+					'fullname'          => give_email_tag_fullname(array(
809 808
 						'payment_id' => $payment_id,
810 809
 						'user_id'    => $user_id,
811
-					) ),
812
-					'username'          => give_email_tag_username( array(
810
+					)),
811
+					'username'          => give_email_tag_username(array(
813 812
 						'payment_id' => $payment_id,
814 813
 						'user_id'    => $user_id,
815
-					) ),
816
-					'user_email'        => give_email_tag_user_email( array(
814
+					)),
815
+					'user_email'        => give_email_tag_user_email(array(
817 816
 						'payment_id' => $payment_id,
818 817
 						'user_id'    => $user_id,
819
-					) ),
820
-					'payment_total'     => $payment_id ? give_email_tag_payment_total( array( 'payment_id' => $payment_id ) ) : give_currency_filter( '10.50' ),
821
-					'amount'            => $payment_id ? give_email_tag_amount( array( 'payment_id' => $payment_id ) ) : give_currency_filter( '10.50' ),
822
-					'price'             => $payment_id ? give_email_tag_price( array( 'payment_id' => $payment_id ) ) : give_currency_filter( '10.50' ),
823
-					'payment_method'    => $payment_id ? give_email_tag_payment_method( array( 'payment_id' => $payment_id ) ) : __( 'PayPal', 'give' ),
818
+					)),
819
+					'payment_total'     => $payment_id ? give_email_tag_payment_total(array('payment_id' => $payment_id)) : give_currency_filter('10.50'),
820
+					'amount'            => $payment_id ? give_email_tag_amount(array('payment_id' => $payment_id)) : give_currency_filter('10.50'),
821
+					'price'             => $payment_id ? give_email_tag_price(array('payment_id' => $payment_id)) : give_currency_filter('10.50'),
822
+					'payment_method'    => $payment_id ? give_email_tag_payment_method(array('payment_id' => $payment_id)) : __('PayPal', 'give'),
824 823
 					'receipt_id'        => $receipt_id,
825
-					'payment_id'        => $payment_id ? $payment_id : rand( 2000, 2050 ),
824
+					'payment_id'        => $payment_id ? $payment_id : rand(2000, 2050),
826 825
 					'receipt_link_url'  => $receipt_link_url,
827 826
 					'receipt_link'      => $receipt_link,
828
-					'date'              => $payment_id ? date( give_date_format(), strtotime( $payment->date ) ) : date( give_date_format(), current_time( 'timestamp' ) ),
829
-					'donation'          => $payment_id ? give_email_tag_donation( array( 'payment_id' => $payment_id ) ) : esc_html__( 'Sample Donation Form Title', 'give' ),
830
-					'form_title'        => $payment_id ? give_email_tag_form_title( array( 'payment_id' => $payment_id ) ) : esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ),
831
-					'sitename'          => $payment_id ? give_email_tag_sitename( array( 'payment_id' => $payment_id ) ) : get_bloginfo( 'name' ),
827
+					'date'              => $payment_id ? date(give_date_format(), strtotime($payment->date)) : date(give_date_format(), current_time('timestamp')),
828
+					'donation'          => $payment_id ? give_email_tag_donation(array('payment_id' => $payment_id)) : esc_html__('Sample Donation Form Title', 'give'),
829
+					'form_title'        => $payment_id ? give_email_tag_form_title(array('payment_id' => $payment_id)) : esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'),
830
+					'sitename'          => $payment_id ? give_email_tag_sitename(array('payment_id' => $payment_id)) : get_bloginfo('name'),
832 831
 					'pdf_receipt'       => sprintf(
833 832
 						'<a href="#">%s</a>',
834
-						__( 'Download Receipt', 'give' )
833
+						__('Download Receipt', 'give')
835 834
 					),
836
-					'billing_address'   => $payment_id ? give_email_tag_billing_address( array( 'payment_id' => $payment_id ) ) : '',
835
+					'billing_address'   => $payment_id ? give_email_tag_billing_address(array('payment_id' => $payment_id)) : '',
837 836
 					'email_access_link' => sprintf(
838 837
 						'<a href="%1$s">%2$s</a>',
839 838
 						add_query_arg(
@@ -842,20 +841,20 @@  discard block
 block discarded – undo
842 841
 							),
843 842
 							give_get_history_page_uri()
844 843
 						),
845
-						__( 'View your donation history &raquo;', 'give' )
844
+						__('View your donation history &raquo;', 'give')
846 845
 					),
847
-					'reset_password_link' => $user_id ? give_email_tag_reset_password_link( array( 'user_id' => $user_id ), $payment_id ) : '',
846
+					'reset_password_link' => $user_id ? give_email_tag_reset_password_link(array('user_id' => $user_id), $payment_id) : '',
848 847
 				)
849 848
 			);
850 849
 
851 850
 			// Decode tags.
852
-			foreach ( $this->config['preview_email_tags_values'] as $preview_tag => $value ) {
853
-				if ( isset( $this->config['preview_email_tags_values'][ $preview_tag ] ) ) {
854
-					$message = str_replace( "{{$preview_tag}}", $this->config['preview_email_tags_values'][ $preview_tag ], $message );
851
+			foreach ($this->config['preview_email_tags_values'] as $preview_tag => $value) {
852
+				if (isset($this->config['preview_email_tags_values'][$preview_tag])) {
853
+					$message = str_replace("{{$preview_tag}}", $this->config['preview_email_tags_values'][$preview_tag], $message);
855 854
 				}
856 855
 			}
857 856
 
858
-			return apply_filters( 'give_email_preview_template_tags', $message );
857
+			return apply_filters('give_email_preview_template_tags', $message);
859 858
 		}
860 859
 
861 860
 		/**
@@ -880,17 +879,17 @@  discard block
 block discarded – undo
880 879
 		 * @param $post_id
881 880
 		 *
882 881
 		 */
883
-		public function validate_form_recipient_field_value( $form_meta_key, $form_meta_value, $post_id ) {
882
+		public function validate_form_recipient_field_value($form_meta_key, $form_meta_value, $post_id) {
884 883
 			// Get valid emails.
885
-			$new_form_meta_value = array_filter( $form_meta_value, function ( $value ) {
886
-				return ! empty( $value['email'] ) && is_email( $value['email'] );
884
+			$new_form_meta_value = array_filter($form_meta_value, function($value) {
885
+				return ! empty($value['email']) && is_email($value['email']);
887 886
 			} );
888 887
 
889 888
 			// Remove duplicate emails from array.
890 889
 			$email_arr = array();
891
-			foreach ( $new_form_meta_value as $index => $email ) {
892
-				if( in_array( $email['email'], $email_arr  ) ) {
893
-					unset( $new_form_meta_value[$index] );
890
+			foreach ($new_form_meta_value as $index => $email) {
891
+				if (in_array($email['email'], $email_arr)) {
892
+					unset($new_form_meta_value[$index]);
894 893
 					continue;
895 894
 				}
896 895
 
@@ -899,25 +898,25 @@  discard block
 block discarded – undo
899 898
 
900 899
 			$update = false;
901 900
 
902
-			if ( empty( $new_form_meta_value ) ) {
901
+			if (empty($new_form_meta_value)) {
903 902
 				// Set default recipient.
904 903
 				$form_meta_value = array(
905 904
 					array(
906
-						'email' => get_bloginfo( 'admin_email' )
905
+						'email' => get_bloginfo('admin_email')
907 906
 					),
908 907
 				);
909 908
 
910 909
 				$update = true;
911 910
 
912
-			} elseif ( count( $new_form_meta_value ) !== count( $form_meta_value ) ) {
911
+			} elseif (count($new_form_meta_value) !== count($form_meta_value)) {
913 912
 				// Filter recipient emails.
914 913
 				$form_meta_value = $new_form_meta_value;
915 914
 
916 915
 				$update = true;
917 916
 			}
918 917
 
919
-			if( $update ) {
920
-				give_update_meta( $post_id, $form_meta_key, $form_meta_value );
918
+			if ($update) {
919
+				give_update_meta($post_id, $form_meta_key, $form_meta_value);
921 920
 			}
922 921
 		}
923 922
 	}
Please login to merge, or discard this patch.