Test Failed
Push — master ( 7fe983...516c23 )
by Devin
08:07 queued 03:09
created
includes/class-give-db.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -165,16 +165,16 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @since  1.0
167 167
 	 * @access public
168
-     *
169
-     * @param  int    $column       Column ID.
170
-     * @param  string $column_where Column name.
171
-     * @param  string $column_value Column value.
172
-     *
168
+	 *
169
+	 * @param  int    $column       Column ID.
170
+	 * @param  string $column_where Column name.
171
+	 * @param  string $column_value Column value.
172
+	 *
173 173
 	 * @return string
174 174
 	 */
175 175
 	public function get_column_by( $column, $column_where, $column_value ) {
176
-        /* @var WPDB $wpdb */
177
-        global $wpdb;
176
+		/* @var WPDB $wpdb */
177
+		global $wpdb;
178 178
 
179 179
 		// Bailout.
180 180
 		if ( empty( $column ) || empty( $column_where ) || empty( $column_value ) ) {
@@ -191,15 +191,15 @@  discard block
 block discarded – undo
191 191
 	 *
192 192
 	 * @since  1.0
193 193
 	 * @access public
194
-     *
195
-     * @param  array  $data
196
-     * @param  string $type
197
-     *
194
+	 *
195
+	 * @param  array  $data
196
+	 * @param  string $type
197
+	 *
198 198
 	 * @return int
199 199
 	 */
200 200
 	public function insert( $data, $type = '' ) {
201
-        /* @var WPDB $wpdb */
202
-        global $wpdb;
201
+		/* @var WPDB $wpdb */
202
+		global $wpdb;
203 203
 
204 204
 		// Set default values.
205 205
 		$data = wp_parse_args( $data, $this->get_column_defaults() );
@@ -246,16 +246,16 @@  discard block
 block discarded – undo
246 246
 	 *
247 247
 	 * @since  1.0
248 248
 	 * @access public
249
-     *
250
-     * @param  int    $row_id Column ID
251
-     * @param  array  $data
252
-     * @param  string $where  Column value
253
-     *
249
+	 *
250
+	 * @param  int    $row_id Column ID
251
+	 * @param  array  $data
252
+	 * @param  string $where  Column value
253
+	 *
254 254
 	 * @return bool
255 255
 	 */
256 256
 	public function update( $row_id, $data = array(), $where = '' ) {
257
-        /* @var WPDB $wpdb */
258
-        global $wpdb;
257
+		/* @var WPDB $wpdb */
258
+		global $wpdb;
259 259
 
260 260
 		// Row ID must be positive integer
261 261
 		$row_id = absint( $row_id );
@@ -293,14 +293,14 @@  discard block
 block discarded – undo
293 293
 	 *
294 294
 	 * @since  1.0
295 295
 	 * @access public
296
-     *
297
-     * @param  int $row_id Column ID.
298
-     *
296
+	 *
297
+	 * @param  int $row_id Column ID.
298
+	 *
299 299
 	 * @return bool
300 300
 	 */
301 301
 	public function delete( $row_id = 0 ) {
302
-        /* @var WPDB $wpdb */
303
-        global $wpdb;
302
+		/* @var WPDB $wpdb */
303
+		global $wpdb;
304 304
 
305 305
 		// Row ID must be positive integer
306 306
 		$row_id = absint( $row_id );
@@ -321,13 +321,13 @@  discard block
 block discarded – undo
321 321
 	 *
322 322
 	 * @since  1.3.2
323 323
 	 * @access public
324
-     *
324
+	 *
325 325
 	 * @param  string $table The table name.
326
-     *
326
+	 *
327 327
 	 * @return bool          If the table name exists.
328 328
 	 */
329 329
 	public function table_exists( $table ) {
330
-        /* @var WPDB $wpdb */
330
+		/* @var WPDB $wpdb */
331 331
 		global $wpdb;
332 332
 
333 333
 		$table = sanitize_text_field( $table );
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 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
 
@@ -98,16 +98,16 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return object
100 100
 	 */
101
-	public function get( $row_id ) {
101
+	public function get($row_id) {
102 102
 		/* @var WPDB $wpdb */
103 103
 		global $wpdb;
104 104
 
105 105
 		// Bailout.
106
-		if ( empty( $row_id ) ) {
106
+		if (empty($row_id)) {
107 107
 			return null;
108 108
 		}
109 109
 
110
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
110
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
111 111
 	}
112 112
 
113 113
 	/**
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
 	 *
122 122
 	 * @return object
123 123
 	 */
124
-	public function get_by( $column, $row_id ) {
124
+	public function get_by($column, $row_id) {
125 125
 		/* @var WPDB $wpdb */
126 126
 		global $wpdb;
127 127
 
128 128
 		// Bailout.
129
-		if ( empty( $column ) || empty( $row_id ) ) {
129
+		if (empty($column) || empty($row_id)) {
130 130
 			return null;
131 131
 		}
132 132
 
133
-		$column = esc_sql( $column );
133
+		$column = esc_sql($column);
134 134
 
135
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
135
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id));
136 136
 	}
137 137
 
138 138
 	/**
@@ -146,18 +146,18 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @return string      Column value.
148 148
 	 */
149
-	public function get_column( $column, $row_id ) {
149
+	public function get_column($column, $row_id) {
150 150
 		/* @var WPDB $wpdb */
151 151
 		global $wpdb;
152 152
 
153 153
 		// Bailout.
154
-		if ( empty( $column ) || empty( $row_id ) ) {
154
+		if (empty($column) || empty($row_id)) {
155 155
 			return null;
156 156
 		}
157 157
 
158
-		$column = esc_sql( $column );
158
+		$column = esc_sql($column);
159 159
 
160
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
160
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
161 161
 	}
162 162
 
163 163
 	/**
@@ -172,18 +172,18 @@  discard block
 block discarded – undo
172 172
      *
173 173
 	 * @return string
174 174
 	 */
175
-	public function get_column_by( $column, $column_where, $column_value ) {
175
+	public function get_column_by($column, $column_where, $column_value) {
176 176
         /* @var WPDB $wpdb */
177 177
         global $wpdb;
178 178
 
179 179
 		// Bailout.
180
-		if ( empty( $column ) || empty( $column_where ) || empty( $column_value ) ) {
180
+		if (empty($column) || empty($column_where) || empty($column_value)) {
181 181
 			return null;
182 182
 		}
183 183
 
184
-		$column_where = esc_sql( $column_where );
185
-		$column       = esc_sql( $column );
186
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) );
184
+		$column_where = esc_sql($column_where);
185
+		$column       = esc_sql($column);
186
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value));
187 187
 	}
188 188
 
189 189
 	/**
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
      *
198 198
 	 * @return int
199 199
 	 */
200
-	public function insert( $data, $type = '' ) {
200
+	public function insert($data, $type = '') {
201 201
         /* @var WPDB $wpdb */
202 202
         global $wpdb;
203 203
 
204 204
 		// Set default values.
205
-		$data = wp_parse_args( $data, $this->get_column_defaults() );
205
+		$data = wp_parse_args($data, $this->get_column_defaults());
206 206
 
207 207
 		/**
208 208
 		 * Fires before inserting data to the database.
@@ -211,22 +211,22 @@  discard block
 block discarded – undo
211 211
 		 *
212 212
 		 * @param array $data
213 213
 		 */
214
-		do_action( "give_pre_insert_{$type}", $data );
214
+		do_action("give_pre_insert_{$type}", $data);
215 215
 
216 216
 		// Initialise column format array
217 217
 		$column_formats = $this->get_columns();
218 218
 
219 219
 		// Force fields to lower case
220
-		$data = array_change_key_case( $data );
220
+		$data = array_change_key_case($data);
221 221
 
222 222
 		// White list columns
223
-		$data = array_intersect_key( $data, $column_formats );
223
+		$data = array_intersect_key($data, $column_formats);
224 224
 
225 225
 		// Reorder $column_formats to match the order of columns given in $data
226
-		$data_keys      = array_keys( $data );
227
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
226
+		$data_keys      = array_keys($data);
227
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
228 228
 
229
-		$wpdb->insert( $this->table_name, $data, $column_formats );
229
+		$wpdb->insert($this->table_name, $data, $column_formats);
230 230
 
231 231
 		/**
232 232
 		 * Fires after inserting data to the database.
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		 * @param int   $insert_id
237 237
 		 * @param array $data
238 238
 		 */
239
-		do_action( "give_post_insert_{$type}", $wpdb->insert_id, $data );
239
+		do_action("give_post_insert_{$type}", $wpdb->insert_id, $data);
240 240
 
241 241
 		return $wpdb->insert_id;
242 242
 	}
@@ -253,18 +253,18 @@  discard block
 block discarded – undo
253 253
      *
254 254
 	 * @return bool
255 255
 	 */
256
-	public function update( $row_id, $data = array(), $where = '' ) {
256
+	public function update($row_id, $data = array(), $where = '') {
257 257
         /* @var WPDB $wpdb */
258 258
         global $wpdb;
259 259
 
260 260
 		// Row ID must be positive integer
261
-		$row_id = absint( $row_id );
261
+		$row_id = absint($row_id);
262 262
 
263
-		if ( empty( $row_id ) ) {
263
+		if (empty($row_id)) {
264 264
 			return false;
265 265
 		}
266 266
 
267
-		if ( empty( $where ) ) {
267
+		if (empty($where)) {
268 268
 			$where = $this->primary_key;
269 269
 		}
270 270
 
@@ -272,16 +272,16 @@  discard block
 block discarded – undo
272 272
 		$column_formats = $this->get_columns();
273 273
 
274 274
 		// Force fields to lower case
275
-		$data = array_change_key_case( $data );
275
+		$data = array_change_key_case($data);
276 276
 
277 277
 		// White list columns
278
-		$data = array_intersect_key( $data, $column_formats );
278
+		$data = array_intersect_key($data, $column_formats);
279 279
 
280 280
 		// Reorder $column_formats to match the order of columns given in $data
281
-		$data_keys      = array_keys( $data );
282
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
281
+		$data_keys      = array_keys($data);
282
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
283 283
 
284
-		if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) {
284
+		if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) {
285 285
 			return false;
286 286
 		}
287 287
 
@@ -298,18 +298,18 @@  discard block
 block discarded – undo
298 298
      *
299 299
 	 * @return bool
300 300
 	 */
301
-	public function delete( $row_id = 0 ) {
301
+	public function delete($row_id = 0) {
302 302
         /* @var WPDB $wpdb */
303 303
         global $wpdb;
304 304
 
305 305
 		// Row ID must be positive integer
306
-		$row_id = absint( $row_id );
306
+		$row_id = absint($row_id);
307 307
 
308
-		if ( empty( $row_id ) ) {
308
+		if (empty($row_id)) {
309 309
 			return false;
310 310
 		}
311 311
 
312
-		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
312
+		if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) {
313 313
 			return false;
314 314
 		}
315 315
 
@@ -326,13 +326,13 @@  discard block
 block discarded – undo
326 326
      *
327 327
 	 * @return bool          If the table name exists.
328 328
 	 */
329
-	public function table_exists( $table ) {
329
+	public function table_exists($table) {
330 330
         /* @var WPDB $wpdb */
331 331
 		global $wpdb;
332 332
 
333
-		$table = sanitize_text_field( $table );
333
+		$table = sanitize_text_field($table);
334 334
 
335
-		return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
335
+		return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table;
336 336
 	}
337 337
 
338 338
 	/**
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	 * @return bool Returns if the customers table was installed and upgrade routine run.
345 345
 	 */
346 346
 	public function installed() {
347
-		return $this->table_exists( $this->table_name );
347
+		return $this->table_exists($this->table_name);
348 348
 	}
349 349
 
350 350
 	/**
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 	 * @access public
355 355
 	 */
356 356
 	public function register_table() {
357
-		$current_version = get_option( $this->table_name . '_db_version' );
358
-		if ( ! $current_version || version_compare( $current_version, $this->version, '<' ) ) {
357
+		$current_version = get_option($this->table_name.'_db_version');
358
+		if ( ! $current_version || version_compare($current_version, $this->version, '<')) {
359 359
 			$this->create_table();
360 360
 		}
361 361
 	}
@@ -366,5 +366,5 @@  discard block
 block discarded – undo
366 366
 	 * @since  1.8.9
367 367
 	 * @access public
368 368
 	 */
369
-	public function create_table(){}
369
+	public function create_table() {}
370 370
 }
Please login to merge, or discard this patch.
includes/class-give-session.php 1 patch
Spacing   +76 added lines, -76 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
 
@@ -74,57 +74,57 @@  discard block
 block discarded – undo
74 74
 	public function __construct() {
75 75
 
76 76
 		$this->use_php_sessions = $this->use_php_sessions();
77
-		$this->exp_option       = give_get_option( 'session_lifetime' );
77
+		$this->exp_option       = give_get_option('session_lifetime');
78 78
 
79 79
 		// PHP Sessions.
80
-		if ( $this->use_php_sessions ) {
80
+		if ($this->use_php_sessions) {
81 81
 
82
-			if ( is_multisite() ) {
82
+			if (is_multisite()) {
83 83
 
84
-				$this->prefix = '_' . get_current_blog_id();
84
+				$this->prefix = '_'.get_current_blog_id();
85 85
 
86 86
 			}
87 87
 
88
-			add_action( 'init', array( $this, 'maybe_start_session' ), - 2 );
88
+			add_action('init', array($this, 'maybe_start_session'), - 2);
89 89
 
90 90
 		} else {
91 91
 
92
-			if ( ! $this->should_start_session() ) {
92
+			if ( ! $this->should_start_session()) {
93 93
 				return;
94 94
 			}
95 95
 
96 96
 			// Use WP_Session.
97
-			if ( ! defined( 'WP_SESSION_COOKIE' ) ) {
98
-				define( 'WP_SESSION_COOKIE', 'give_wp_session' );
97
+			if ( ! defined('WP_SESSION_COOKIE')) {
98
+				define('WP_SESSION_COOKIE', 'give_wp_session');
99 99
 			}
100 100
 
101
-			if ( ! class_exists( 'Recursive_ArrayAccess' ) ) {
102
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-recursive-arrayaccess.php';
101
+			if ( ! class_exists('Recursive_ArrayAccess')) {
102
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-recursive-arrayaccess.php';
103 103
 			}
104 104
 
105 105
 			// Include utilities class
106
-			if ( ! class_exists( 'WP_Session_Utils' ) ) {
107
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-wp-session-utils.php';
106
+			if ( ! class_exists('WP_Session_Utils')) {
107
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-wp-session-utils.php';
108 108
 			}
109
-			if ( ! class_exists( 'WP_Session' ) ) {
110
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-wp-session.php';
111
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/wp-session.php';
109
+			if ( ! class_exists('WP_Session')) {
110
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-wp-session.php';
111
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/wp-session.php';
112 112
 			}
113 113
 
114
-			add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 );
115
-			add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 );
114
+			add_filter('wp_session_expiration_variant', array($this, 'set_expiration_variant_time'), 99999);
115
+			add_filter('wp_session_expiration', array($this, 'set_expiration_time'), 99999);
116 116
 
117 117
 		}
118 118
 
119 119
 		// Init Session.
120
-		if ( empty( $this->session ) && ! $this->use_php_sessions ) {
121
-			add_action( 'plugins_loaded', array( $this, 'init' ), 9999 );
120
+		if (empty($this->session) && ! $this->use_php_sessions) {
121
+			add_action('plugins_loaded', array($this, 'init'), 9999);
122 122
 		} else {
123
-			add_action( 'init', array( $this, 'init' ), - 1 );
123
+			add_action('init', array($this, 'init'), - 1);
124 124
 		}
125 125
 
126 126
 		// Set cookie on Donation Completion page.
127
-		add_action( 'give_pre_process_donation', array( $this, 'set_session_cookies' ) );
127
+		add_action('give_pre_process_donation', array($this, 'set_session_cookies'));
128 128
 
129 129
 	}
130 130
 
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	public function init() {
142 142
 
143
-		if ( $this->use_php_sessions ) {
144
-			$this->session = isset( $_SESSION[ 'give' . $this->prefix ] ) && is_array( $_SESSION[ 'give' . $this->prefix ] ) ? $_SESSION[ 'give' . $this->prefix ] : array();
143
+		if ($this->use_php_sessions) {
144
+			$this->session = isset($_SESSION['give'.$this->prefix]) && is_array($_SESSION['give'.$this->prefix]) ? $_SESSION['give'.$this->prefix] : array();
145 145
 		} else {
146 146
 			$this->session = WP_Session::get_instance();
147 147
 		}
@@ -176,37 +176,37 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @return string|array      Session variable.
178 178
 	 */
179
-	public function get( $key ) {
180
-		$key    = sanitize_key( $key );
179
+	public function get($key) {
180
+		$key    = sanitize_key($key);
181 181
 		$return = false;
182 182
 
183
-		if ( isset( $this->session[ $key ] ) && ! empty( $this->session[ $key ] ) ) {
183
+		if (isset($this->session[$key]) && ! empty($this->session[$key])) {
184 184
 
185
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $this->session[ $key ], $matches );
186
-			if ( ! empty( $matches ) ) {
187
-				$this->set( $key, null );
185
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $this->session[$key], $matches);
186
+			if ( ! empty($matches)) {
187
+				$this->set($key, null);
188 188
 
189 189
 				return false;
190 190
 			}
191 191
 
192
-			if ( is_numeric( $this->session[ $key ] ) ) {
193
-				$return = $this->session[ $key ];
192
+			if (is_numeric($this->session[$key])) {
193
+				$return = $this->session[$key];
194 194
 			} else {
195 195
 
196
-				$maybe_json = json_decode( $this->session[ $key ] );
196
+				$maybe_json = json_decode($this->session[$key]);
197 197
 
198 198
 				// Since json_last_error is PHP 5.3+, we have to rely on a `null` value for failing to parse JSON.
199
-				if ( is_null( $maybe_json ) ) {
200
-					$is_serialized = is_serialized( $this->session[ $key ] );
201
-					if ( $is_serialized ) {
202
-						$value = @unserialize( $this->session[ $key ] );
203
-						$this->set( $key, (array) $value );
199
+				if (is_null($maybe_json)) {
200
+					$is_serialized = is_serialized($this->session[$key]);
201
+					if ($is_serialized) {
202
+						$value = @unserialize($this->session[$key]);
203
+						$this->set($key, (array) $value);
204 204
 						$return = $value;
205 205
 					} else {
206
-						$return = $this->session[ $key ];
206
+						$return = $this->session[$key];
207 207
 					}
208 208
 				} else {
209
-					$return = json_decode( $this->session[ $key ], true );
209
+					$return = json_decode($this->session[$key], true);
210 210
 				}
211 211
 
212 212
 			}
@@ -229,21 +229,21 @@  discard block
 block discarded – undo
229 229
 	 *
230 230
 	 * @return string        Session variable.
231 231
 	 */
232
-	public function set( $key, $value ) {
232
+	public function set($key, $value) {
233 233
 
234
-		$key = sanitize_key( $key );
234
+		$key = sanitize_key($key);
235 235
 
236
-		if ( is_array( $value ) ) {
237
-			$this->session[ $key ] = wp_json_encode( $value );
236
+		if (is_array($value)) {
237
+			$this->session[$key] = wp_json_encode($value);
238 238
 		} else {
239
-			$this->session[ $key ] = esc_attr( $value );
239
+			$this->session[$key] = esc_attr($value);
240 240
 		}
241 241
 
242
-		if ( $this->use_php_sessions ) {
243
-			$_SESSION[ 'give' . $this->prefix ] = $this->session;
242
+		if ($this->use_php_sessions) {
243
+			$_SESSION['give'.$this->prefix] = $this->session;
244 244
 		}
245 245
 
246
-		return $this->session[ $key ];
246
+		return $this->session[$key];
247 247
 	}
248 248
 
249 249
 	/**
@@ -258,10 +258,10 @@  discard block
 block discarded – undo
258 258
 	 * @hook
259 259
 	 */
260 260
 	public function set_session_cookies() {
261
-		if ( ! headers_sent() ) {
262
-			$lifetime = current_time( 'timestamp' ) + $this->set_expiration_time();
263
-			@setcookie( session_name(), session_id(), $lifetime, COOKIEPATH, COOKIE_DOMAIN, false );
264
-			@setcookie( session_name() . '_expiration', $lifetime, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false );
261
+		if ( ! headers_sent()) {
262
+			$lifetime = current_time('timestamp') + $this->set_expiration_time();
263
+			@setcookie(session_name(), session_id(), $lifetime, COOKIEPATH, COOKIE_DOMAIN, false);
264
+			@setcookie(session_name().'_expiration', $lifetime, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false);
265 265
 		}
266 266
 	}
267 267
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 */
278 278
 	public function set_expiration_variant_time() {
279 279
 
280
-		return ( ! empty( $this->exp_option ) ? ( intval( $this->exp_option ) - 3600 ) : 30 * 60 * 23 );
280
+		return ( ! empty($this->exp_option) ? (intval($this->exp_option) - 3600) : 30 * 60 * 23);
281 281
 	}
282 282
 
283 283
 	/**
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 */
293 293
 	public function set_expiration_time() {
294 294
 
295
-		return ( ! empty( $this->exp_option ) ? intval( $this->exp_option ) : 30 * 60 * 24 );
295
+		return ( ! empty($this->exp_option) ? intval($this->exp_option) : 30 * 60 * 24);
296 296
 	}
297 297
 
298 298
 	/**
@@ -310,21 +310,21 @@  discard block
 block discarded – undo
310 310
 		$ret = false;
311 311
 
312 312
 		// If the database variable is already set, no need to run auto detection.
313
-		$give_use_php_sessions = (bool) get_option( 'give_use_php_sessions' );
313
+		$give_use_php_sessions = (bool) get_option('give_use_php_sessions');
314 314
 
315
-		if ( ! $give_use_php_sessions ) {
315
+		if ( ! $give_use_php_sessions) {
316 316
 
317 317
 			// Attempt to detect if the server supports PHP sessions.
318
-			if ( function_exists( 'session_start' ) && ! ini_get( 'safe_mode' ) ) {
318
+			if (function_exists('session_start') && ! ini_get('safe_mode')) {
319 319
 
320
-				$this->set( 'give_use_php_sessions', 1 );
320
+				$this->set('give_use_php_sessions', 1);
321 321
 
322
-				if ( $this->get( 'give_use_php_sessions' ) ) {
322
+				if ($this->get('give_use_php_sessions')) {
323 323
 
324 324
 					$ret = true;
325 325
 
326 326
 					// Set the database option.
327
-					update_option( 'give_use_php_sessions', true );
327
+					update_option('give_use_php_sessions', true);
328 328
 
329 329
 				}
330 330
 			}
@@ -334,13 +334,13 @@  discard block
 block discarded – undo
334 334
 		}
335 335
 
336 336
 		// Enable or disable PHP Sessions based on the GIVE_USE_PHP_SESSIONS constant.
337
-		if ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ) {
337
+		if (defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS) {
338 338
 			$ret = true;
339
-		} elseif ( defined( 'GIVE_USE_PHP_SESSIONS' ) && ! GIVE_USE_PHP_SESSIONS ) {
339
+		} elseif (defined('GIVE_USE_PHP_SESSIONS') && ! GIVE_USE_PHP_SESSIONS) {
340 340
 			$ret = false;
341 341
 		}
342 342
 
343
-		return (bool) apply_filters( 'give_use_php_sessions', $ret );
343
+		return (bool) apply_filters('give_use_php_sessions', $ret);
344 344
 	}
345 345
 
346 346
 	/**
@@ -357,9 +357,9 @@  discard block
 block discarded – undo
357 357
 
358 358
 		$start_session = true;
359 359
 
360
-		if ( ! empty( $_SERVER['REQUEST_URI'] ) ) {
360
+		if ( ! empty($_SERVER['REQUEST_URI'])) {
361 361
 
362
-			$blacklist = apply_filters( 'give_session_start_uri_blacklist', array(
362
+			$blacklist = apply_filters('give_session_start_uri_blacklist', array(
363 363
 				'feed',
364 364
 				'feed',
365 365
 				'feed/rss',
@@ -367,21 +367,21 @@  discard block
 block discarded – undo
367 367
 				'feed/rdf',
368 368
 				'feed/atom',
369 369
 				'comments/feed/',
370
-			) );
371
-			$uri       = ltrim( $_SERVER['REQUEST_URI'], '/' );
372
-			$uri       = untrailingslashit( $uri );
373
-			if ( in_array( $uri, $blacklist ) ) {
370
+			));
371
+			$uri       = ltrim($_SERVER['REQUEST_URI'], '/');
372
+			$uri       = untrailingslashit($uri);
373
+			if (in_array($uri, $blacklist)) {
374 374
 				$start_session = false;
375 375
 			}
376
-			if ( false !== strpos( $uri, 'feed=' ) ) {
376
+			if (false !== strpos($uri, 'feed=')) {
377 377
 				$start_session = false;
378 378
 			}
379
-			if ( is_admin() ) {
379
+			if (is_admin()) {
380 380
 				$start_session = false;
381 381
 			}
382 382
 		}
383 383
 
384
-		return apply_filters( 'give_start_session', $start_session );
384
+		return apply_filters('give_start_session', $start_session);
385 385
 	}
386 386
 
387 387
 	/**
@@ -397,11 +397,11 @@  discard block
 block discarded – undo
397 397
 	 */
398 398
 	public function maybe_start_session() {
399 399
 
400
-		if ( ! $this->should_start_session() ) {
400
+		if ( ! $this->should_start_session()) {
401 401
 			return;
402 402
 		}
403 403
 
404
-		if ( ! session_id() && ! headers_sent() ) {
404
+		if ( ! session_id() && ! headers_sent()) {
405 405
 			session_start();
406 406
 		}
407 407
 
@@ -420,9 +420,9 @@  discard block
 block discarded – undo
420 420
 
421 421
 		$expiration = false;
422 422
 
423
-		if ( session_id() && isset( $_COOKIE[ session_name() . '_expiration' ] ) ) {
423
+		if (session_id() && isset($_COOKIE[session_name().'_expiration'])) {
424 424
 
425
-			$expiration = date( 'D, d M Y h:i:s', intval( $_COOKIE[ session_name() . '_expiration' ] ) );
425
+			$expiration = date('D, d M Y h:i:s', intval($_COOKIE[session_name().'_expiration']));
426 426
 
427 427
 		}
428 428
 
Please login to merge, or discard this patch.
includes/admin/admin-pages.php 1 patch
Spacing   +98 added lines, -98 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
 
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
 	global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_donors_page, $give_tools_page;
33 33
 
34 34
 	//Payments
35
-	$give_payment       = get_post_type_object( 'give_payment' );
36
-	$give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' );
35
+	$give_payment       = get_post_type_object('give_payment');
36
+	$give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page');
37 37
 
38 38
 	//Donors
39
-	$give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Donors', 'give' ), esc_html__( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_donors_page' );
39
+	$give_donors_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Donors', 'give'), esc_html__('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_donors_page');
40 40
 
41 41
 	//Reports`
42 42
 	$give_reports_page = add_submenu_page(
43 43
 		'edit.php?post_type=give_forms',
44
-		esc_html__( 'Donation Reports', 'give' ),
45
-		esc_html__( 'Reports', 'give' ),
44
+		esc_html__('Donation Reports', 'give'),
45
+		esc_html__('Reports', 'give'),
46 46
 		'view_give_reports',
47 47
 		'give-reports',
48 48
 		array(
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	//Settings
55 55
 	$give_settings_page = add_submenu_page(
56 56
 		'edit.php?post_type=give_forms',
57
-		esc_html__( 'Give Settings', 'give' ),
58
-		esc_html__( 'Settings', 'give' ),
57
+		esc_html__('Give Settings', 'give'),
58
+		esc_html__('Settings', 'give'),
59 59
 		'manage_give_settings',
60 60
 		'give-settings',
61 61
 		array(
@@ -65,16 +65,16 @@  discard block
 block discarded – undo
65 65
 	);
66 66
 
67 67
 	//Tools.
68
-	$give_tools_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Tools', 'give' ), esc_html__( 'Tools', 'give' ), 'manage_give_settings', 'give-tools', array(
68
+	$give_tools_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Tools', 'give'), esc_html__('Tools', 'give'), 'manage_give_settings', 'give-tools', array(
69 69
 		Give()->give_settings,
70 70
 		'output'
71
-	) );
71
+	));
72 72
 
73 73
 	//Add-ons
74
-	$give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Add-ons', 'give' ), esc_html__( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' );
74
+	$give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Add-ons', 'give'), esc_html__('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page');
75 75
 }
76 76
 
77
-add_action( 'admin_menu', 'give_add_options_links', 10 );
77
+add_action('admin_menu', 'give_add_options_links', 10);
78 78
 
79 79
 /**
80 80
  *  Determines whether the current admin page is a Give admin page.
@@ -89,224 +89,224 @@  discard block
 block discarded – undo
89 89
  *
90 90
  * @return bool True if Give admin page.
91 91
  */
92
-function give_is_admin_page( $passed_page = '', $passed_view = '' ) {
92
+function give_is_admin_page($passed_page = '', $passed_view = '') {
93 93
 
94 94
 	global $pagenow, $typenow;
95 95
 
96 96
 	$found     = false;
97
-	$post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false;
98
-	$action    = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false;
99
-	$taxonomy  = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false;
100
-	$page      = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
101
-	$view      = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false;
102
-	$tab       = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false;
103
-
104
-	switch ( $passed_page ) {
97
+	$post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false;
98
+	$action    = isset($_GET['action']) ? strtolower($_GET['action']) : false;
99
+	$taxonomy  = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false;
100
+	$page      = isset($_GET['page']) ? strtolower($_GET['page']) : false;
101
+	$view      = isset($_GET['view']) ? strtolower($_GET['view']) : false;
102
+	$tab       = isset($_GET['tab']) ? strtolower($_GET['tab']) : false;
103
+
104
+	switch ($passed_page) {
105 105
 		case 'give_forms':
106
-			switch ( $passed_view ) {
106
+			switch ($passed_view) {
107 107
 				case 'list-table':
108
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) {
108
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') {
109 109
 						$found = true;
110 110
 					}
111 111
 					break;
112 112
 				case 'edit':
113
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) {
113
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') {
114 114
 						$found = true;
115 115
 					}
116 116
 					break;
117 117
 				case 'new':
118
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) {
118
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') {
119 119
 						$found = true;
120 120
 					}
121 121
 					break;
122 122
 				default:
123
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) {
123
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) {
124 124
 						$found = true;
125 125
 					}
126 126
 					break;
127 127
 			}
128 128
 			break;
129 129
 		case 'categories':
130
-			switch ( $passed_view ) {
130
+			switch ($passed_view) {
131 131
 				case 'list-table':
132 132
 				case 'new':
133
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) {
133
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) {
134 134
 						$found = true;
135 135
 					}
136 136
 					break;
137 137
 				case 'edit':
138
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) {
138
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) {
139 139
 						$found = true;
140 140
 					}
141 141
 					break;
142 142
 				default:
143
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) {
143
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) {
144 144
 						$found = true;
145 145
 					}
146 146
 					break;
147 147
 			}
148 148
 			break;
149 149
 		case 'tags':
150
-			switch ( $passed_view ) {
150
+			switch ($passed_view) {
151 151
 				case 'list-table':
152 152
 				case 'new':
153
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) {
153
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) {
154 154
 						$found = true;
155 155
 					}
156 156
 					break;
157 157
 				case 'edit':
158
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) {
158
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) {
159 159
 						$found = true;
160 160
 					}
161 161
 					break;
162 162
 				default:
163
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) {
163
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) {
164 164
 						$found = true;
165 165
 					}
166 166
 					break;
167 167
 			}
168 168
 			break;
169 169
 		case 'payments':
170
-			switch ( $passed_view ) {
170
+			switch ($passed_view) {
171 171
 				case 'list-table':
172
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) {
172
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) {
173 173
 						$found = true;
174 174
 					}
175 175
 					break;
176 176
 				case 'edit':
177
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view ) {
177
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view) {
178 178
 						$found = true;
179 179
 					}
180 180
 					break;
181 181
 				default:
182
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) {
182
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) {
183 183
 						$found = true;
184 184
 					}
185 185
 					break;
186 186
 			}
187 187
 			break;
188 188
 		case 'reports':
189
-			switch ( $passed_view ) {
189
+			switch ($passed_view) {
190 190
 				// If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ]
191 191
 				case 'earnings':
192
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) {
192
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) {
193 193
 						$found = true;
194 194
 					}
195 195
 					break;
196 196
 				case 'donors':
197
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) {
197
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) {
198 198
 						$found = true;
199 199
 					}
200 200
 					break;
201 201
 				case 'gateways':
202
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) {
202
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) {
203 203
 						$found = true;
204 204
 					}
205 205
 					break;
206 206
 				case 'export':
207
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) {
207
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) {
208 208
 						$found = true;
209 209
 					}
210 210
 					break;
211 211
 				case 'logs':
212
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) {
212
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) {
213 213
 						$found = true;
214 214
 					}
215 215
 					break;
216 216
 				default:
217
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) {
217
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) {
218 218
 						$found = true;
219 219
 					}
220 220
 					break;
221 221
 			}
222 222
 			break;
223 223
 		case 'settings':
224
-			switch ( $passed_view ) {
224
+			switch ($passed_view) {
225 225
 				case 'general':
226
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) {
226
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) {
227 227
 						$found = true;
228 228
 					}
229 229
 					break;
230 230
 				case 'gateways':
231
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) {
231
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) {
232 232
 						$found = true;
233 233
 					}
234 234
 					break;
235 235
 				case 'emails':
236
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) {
236
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) {
237 237
 						$found = true;
238 238
 					}
239 239
 					break;
240 240
 				case 'display':
241
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) {
241
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) {
242 242
 						$found = true;
243 243
 					}
244 244
 					break;
245 245
 				case 'licenses':
246
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) {
246
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) {
247 247
 						$found = true;
248 248
 					}
249 249
 					break;
250 250
 				case 'api':
251
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) {
251
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) {
252 252
 						$found = true;
253 253
 					}
254 254
 					break;
255 255
 				case 'advanced':
256
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) {
256
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) {
257 257
 						$found = true;
258 258
 					}
259 259
 					break;
260 260
 				case 'system_info':
261
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) {
261
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) {
262 262
 						$found = true;
263 263
 					}
264 264
 					break;
265 265
 				default:
266
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) {
266
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) {
267 267
 						$found = true;
268 268
 					}
269 269
 					break;
270 270
 			}
271 271
 			break;
272 272
 		case 'addons':
273
-			if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) {
273
+			if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) {
274 274
 				$found = true;
275 275
 			}
276 276
 			break;
277 277
 		case 'donors':
278
-			switch ( $passed_view ) {
278
+			switch ($passed_view) {
279 279
 				case 'list-table':
280
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) {
280
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) {
281 281
 						$found = true;
282 282
 					}
283 283
 					break;
284 284
 				case 'overview':
285
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) {
285
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) {
286 286
 						$found = true;
287 287
 					}
288 288
 					break;
289 289
 				case 'notes':
290
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) {
290
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) {
291 291
 						$found = true;
292 292
 					}
293 293
 					break;
294 294
 				default:
295
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) {
295
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) {
296 296
 						$found = true;
297 297
 					}
298 298
 					break;
299 299
 			}
300 300
 			break;
301 301
 		case 'reports':
302
-			if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) {
302
+			if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) {
303 303
 				$found = true;
304 304
 			}
305 305
 			break;
306 306
 		default:
307 307
 			global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_donors_page, $give_tools_page;
308 308
 
309
-			$admin_pages = apply_filters( 'give_admin_pages', array(
309
+			$admin_pages = apply_filters('give_admin_pages', array(
310 310
 				$give_payments_page,
311 311
 				$give_settings_page,
312 312
 				$give_reports_page,
@@ -316,16 +316,16 @@  discard block
 block discarded – undo
316 316
 				$give_donors_page,
317 317
 				$give_tools_page,
318 318
 				'widgets.php'
319
-		) );
320
-			if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) {
319
+		));
320
+			if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) {
321 321
 				$found = true;
322
-			} elseif ( in_array( $pagenow, $admin_pages ) ) {
322
+			} elseif (in_array($pagenow, $admin_pages)) {
323 323
 				$found = true;
324 324
 			}
325 325
 			break;
326 326
 	}
327 327
 
328
-	return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view );
328
+	return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view);
329 329
 
330 330
 }
331 331
 
@@ -337,37 +337,37 @@  discard block
 block discarded – undo
337 337
  * @param  array $settings
338 338
  * @return array
339 339
  */
340
-function give_settings_page_pages( $settings ) {
341
-	include( 'abstract-admin-settings-page.php' );
342
-	include( 'settings/class-settings-cmb2-backward-compatibility.php' );
340
+function give_settings_page_pages($settings) {
341
+	include('abstract-admin-settings-page.php');
342
+	include('settings/class-settings-cmb2-backward-compatibility.php');
343 343
 
344 344
 	$settings = array(
345 345
 		// General settings.
346
-		include( 'settings/class-settings-general.php' ),
346
+		include('settings/class-settings-general.php'),
347 347
 
348 348
 		// Payment Gateways Settings.
349
-		include( 'settings/class-settings-gateways.php' ),
349
+		include('settings/class-settings-gateways.php'),
350 350
 
351 351
 		// Display settings.
352
-		include( 'settings/class-settings-display.php' ),
352
+		include('settings/class-settings-display.php'),
353 353
 
354 354
 		// Emails settings.
355
-		include( 'settings/class-settings-email.php' ),
355
+		include('settings/class-settings-email.php'),
356 356
 
357 357
 		// Addons settings.
358
-		include( 'settings/class-settings-addon.php' ),
358
+		include('settings/class-settings-addon.php'),
359 359
 
360 360
 		// License settings.
361
-		include( 'settings/class-settings-license.php' ),
361
+		include('settings/class-settings-license.php'),
362 362
 
363 363
 		// Advanced settings.
364
-		include( 'settings/class-settings-advanced.php' )
364
+		include('settings/class-settings-advanced.php')
365 365
 	);
366 366
 
367 367
 	// Output.
368 368
 	return $settings;
369 369
 }
370
-add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 );
370
+add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1);
371 371
 
372 372
 
373 373
 /**
@@ -377,28 +377,28 @@  discard block
 block discarded – undo
377 377
  * @param  array $settings
378 378
  * @return array
379 379
  */
380
-function give_reports_page_pages( $settings ) {
381
-	include( 'abstract-admin-settings-page.php' );
380
+function give_reports_page_pages($settings) {
381
+	include('abstract-admin-settings-page.php');
382 382
 
383 383
 	$settings = array(
384 384
 		// Earnings.
385
-		include( 'reports/class-earnings-report.php' ),
385
+		include('reports/class-earnings-report.php'),
386 386
 
387 387
 		// Forms.
388
-		include( 'reports/class-forms-report.php' ),
388
+		include('reports/class-forms-report.php'),
389 389
 
390 390
 		// Donors.
391
-		include( 'reports/class-donors-report.php' ),
391
+		include('reports/class-donors-report.php'),
392 392
 
393 393
 		// Gateways.
394
-		include( 'reports/class-gateways-report.php' ),
394
+		include('reports/class-gateways-report.php'),
395 395
 
396 396
 	);
397 397
 
398 398
 	// Output.
399 399
 	return $settings;
400 400
 }
401
-add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 );
401
+add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1);
402 402
 
403 403
 /**
404 404
  * Add setting tab to give-settings page
@@ -407,34 +407,34 @@  discard block
 block discarded – undo
407 407
  * @param  array $settings
408 408
  * @return array
409 409
  */
410
-function give_tools_page_pages( $settings ) {
411
-	include( 'abstract-admin-settings-page.php' );
410
+function give_tools_page_pages($settings) {
411
+	include('abstract-admin-settings-page.php');
412 412
 
413 413
 	$settings = array(
414 414
 		// System Info.
415
-		include( 'tools/class-settings-system-info.php' ),
415
+		include('tools/class-settings-system-info.php'),
416 416
 
417 417
 		// Logs.
418
-		include( 'tools/class-settings-logs.php' ),
418
+		include('tools/class-settings-logs.php'),
419 419
 
420 420
 		// API.
421
-		include( 'tools/class-settings-api.php' ),
421
+		include('tools/class-settings-api.php'),
422 422
 
423 423
 		// Data.
424
-		include( 'tools/class-settings-data.php' ),
424
+		include('tools/class-settings-data.php'),
425 425
 
426 426
 		// Export.
427
-		include( 'tools/class-settings-export.php' ),
427
+		include('tools/class-settings-export.php'),
428 428
 
429 429
 		// Import
430
-		include_once( 'tools/class-settings-import.php' ),
430
+		include_once('tools/class-settings-import.php'),
431 431
 
432 432
 	);
433 433
 
434 434
 	// Output.
435 435
 	return $settings;
436 436
 }
437
-add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 );
437
+add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1);
438 438
 
439 439
 /**
440 440
  * Set default tools page tab.
@@ -443,10 +443,10 @@  discard block
 block discarded – undo
443 443
  * @param  string $default_tab Default tab name.
444 444
  * @return string
445 445
  */
446
-function give_set_default_tab_form_tools_page( $default_tab ) {
446
+function give_set_default_tab_form_tools_page($default_tab) {
447 447
 	return 'system-info';
448 448
 }
449
-add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 );
449
+add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1);
450 450
 
451 451
 
452 452
 /**
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
  * @param  string $default_tab Default tab name.
457 457
  * @return string
458 458
  */
459
-function give_set_default_tab_form_reports_page( $default_tab ) {
459
+function give_set_default_tab_form_reports_page($default_tab) {
460 460
 	return 'earnings';
461 461
 }
462
-add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 );
463 462
\ No newline at end of file
463
+add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1);
464 464
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/upgrades/views/upgrades.php 1 patch
Spacing   +14 added lines, -14 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
 
@@ -18,30 +18,30 @@  discard block
 block discarded – undo
18 18
 ?>
19 19
 <div class="wrap" id="poststuff">
20 20
 	<div id="give-updates">
21
-		<h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1>
21
+		<h1 id="give-updates-h1"><?php esc_html_e('Give - Updates', 'give'); ?></h1>
22 22
 		<div class="give-update-panel-content">
23
-			<p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p>
23
+			<p><?php printf(__('Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give'), 'https://givewp.com/my-account/'); ?></p>
24 24
 		</div>
25 25
 
26 26
 		<?php $update_counter = 1; ?>
27 27
 
28 28
 		<?php $db_updates = $give_updates->get_db_update_count(); ?>
29
-		<?php if ( ! empty( $db_updates ) ) : ?>
30
-			<?php $db_update_url = add_query_arg( array(
29
+		<?php if ( ! empty($db_updates)) : ?>
30
+			<?php $db_update_url = add_query_arg(array(
31 31
 				'type' => 'database',
32
-			) ); ?>
32
+			)); ?>
33 33
 			<div id="give-db-updates">
34 34
 				<div class="postbox-container">
35 35
 					<div class="postbox">
36
-						<h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2>
36
+						<h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2>
37 37
 						<div class="inside">
38 38
 							<div class="panel-content">
39
-								<p><?php echo sprintf( __( 'Give needs to update the database. <a href="%s">Update now ></a>', 'give' ), $db_update_url ); ?></p>
39
+								<p><?php echo sprintf(__('Give needs to update the database. <a href="%s">Update now ></a>', 'give'), $db_update_url); ?></p>
40 40
 							</div>
41 41
 							<div class="progress-container give-hidden">
42 42
 								<p class="update-message" data-update-count="<?php echo $db_updates; ?>"
43 43
 								   data-resume-update="<?php echo $give_updates->resume_updates(); ?>">
44
-									<strong><?php echo sprintf( __( 'Update 1 of %s', 'give' ), $db_updates ); ?></strong></p>
44
+									<strong><?php echo sprintf(__('Update 1 of %s', 'give'), $db_updates); ?></strong></p>
45 45
 								<div class="progress-content"></div>
46 46
 							</div>
47 47
 						</div>
@@ -52,17 +52,17 @@  discard block
 block discarded – undo
52 52
 		<?php endif; ?>
53 53
 
54 54
 		<?php $plugin_updates = $give_updates->get_plugin_update_count(); ?>
55
-		<?php if ( ! empty( $plugin_updates ) ) : ?>
56
-			<?php $plugin_update_url = add_query_arg( array(
55
+		<?php if ( ! empty($plugin_updates)) : ?>
56
+			<?php $plugin_update_url = add_query_arg(array(
57 57
 				's' => 'Give',
58
-			), admin_url( '/plugins.php' ) ); ?>
58
+			), admin_url('/plugins.php')); ?>
59 59
 			<div id="give-plugin-updates">
60 60
 				<div class="postbox-container">
61 61
 					<div class="postbox">
62
-						<h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2>
62
+						<h2 class="hndle"><?php _e('Add-on Updates', 'give'); ?></h2>
63 63
 						<div class="inside">
64 64
 							<div class="panel-content">
65
-								<p><?php echo sprintf( __( 'There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now ></a>', 'give' ), _n( 'is', 'are', $plugin_updates, 'give' ), $plugin_updates, _n( 'add-on', 'add-ons', $plugin_updates, 'give' ), _n( 'needs', 'need', $plugin_updates, 'give' ), $plugin_update_url  ); ?></p>
65
+								<p><?php echo sprintf(__('There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now ></a>', 'give'), _n('is', 'are', $plugin_updates, 'give'), $plugin_updates, _n('add-on', 'add-ons', $plugin_updates, 'give'), _n('needs', 'need', $plugin_updates, 'give'), $plugin_update_url); ?></p>
66 66
 								<?php include_once 'plugins-update-section.php'; ?>
67 67
 							</div>
68 68
 						</div>
Please login to merge, or discard this patch.
includes/admin/upgrades/class-give-updates.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -70,24 +70,24 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @param array $args
72 72
 	 */
73
-	public function register( $args ) {
73
+	public function register($args) {
74 74
 		$args_default = array(
75 75
 			'id'       => '',
76 76
 			'version'  => '',
77 77
 			'callback' => '',
78 78
 		);
79 79
 
80
-		$args = wp_parse_args( $args, $args_default );
80
+		$args = wp_parse_args($args, $args_default);
81 81
 
82 82
 		// You can only register database upgrade.
83 83
 		$args['type'] = 'database';
84 84
 
85 85
 		// Bailout.
86
-		if ( empty( $args['id'] ) || empty( $args['version'] ) || empty( $args['callback'] ) || ! is_callable( $args['callback'] ) ) {
86
+		if (empty($args['id']) || empty($args['version']) || empty($args['callback']) || ! is_callable($args['callback'])) {
87 87
 			return;
88 88
 		}
89 89
 
90
-		$this->updates[ $args['type'] ][] = $args;
90
+		$this->updates[$args['type']][] = $args;
91 91
 	}
92 92
 
93 93
 
@@ -102,32 +102,32 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @return array
104 104
 	 */
105
-	public function get_updates( $update_type = '', $status = 'all' ) {
105
+	public function get_updates($update_type = '', $status = 'all') {
106 106
 		// return all updates.
107
-		if ( empty( $update_type ) ) {
107
+		if (empty($update_type)) {
108 108
 			return $this->updates;
109 109
 		}
110 110
 
111 111
 		// Get specific update.
112
-		$updates = ! empty( $this->updates[ $update_type ] ) ? $this->updates[ $update_type ] : array();
112
+		$updates = ! empty($this->updates[$update_type]) ? $this->updates[$update_type] : array();
113 113
 
114 114
 		// Bailout.
115
-		if ( empty( $updates ) ) {
115
+		if (empty($updates)) {
116 116
 			return $updates;
117 117
 		}
118 118
 
119
-		switch ( $status ) {
119
+		switch ($status) {
120 120
 			case 'new':
121 121
 				// Remove already completed updates.
122 122
 				$completed_updates = give_get_completed_upgrades();
123 123
 
124
-				if ( ! empty( $completed_updates ) ) {
125
-					foreach ( $updates as $index => $update ) {
126
-						if ( in_array( $update['id'], $completed_updates ) ) {
127
-							unset( $updates[ $index ] );
124
+				if ( ! empty($completed_updates)) {
125
+					foreach ($updates as $index => $update) {
126
+						if (in_array($update['id'], $completed_updates)) {
127
+							unset($updates[$index]);
128 128
 						}
129 129
 					}
130
-					$updates = array_values( $updates );
130
+					$updates = array_values($updates);
131 131
 				}
132 132
 
133 133
 				break;
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @return static
145 145
 	 */
146 146
 	static function get_instance() {
147
-		if ( is_null( self::$instance ) ) {
147
+		if (is_null(self::$instance)) {
148 148
 			self::$instance = new self();
149 149
 		}
150 150
 
@@ -162,16 +162,16 @@  discard block
 block discarded – undo
162 162
 		/**
163 163
 		 * Setup hooks.
164 164
 		 */
165
-		add_action( 'init', array( $this, '__register_upgrade' ), 9999 );
166
-		add_action( 'admin_init', array( $this, '__change_donations_label' ), 9999 );
167
-		add_action( 'admin_menu', array( $this, '__register_menu' ), 9999 );
168
-		add_action( 'give_set_upgrade_completed', array( $this, '__flush_resume_updates' ), 9999 );
169
-		add_action( 'wp_ajax_give_do_ajax_updates', array( $this, '__give_ajax_updates' ) );
165
+		add_action('init', array($this, '__register_upgrade'), 9999);
166
+		add_action('admin_init', array($this, '__change_donations_label'), 9999);
167
+		add_action('admin_menu', array($this, '__register_menu'), 9999);
168
+		add_action('give_set_upgrade_completed', array($this, '__flush_resume_updates'), 9999);
169
+		add_action('wp_ajax_give_do_ajax_updates', array($this, '__give_ajax_updates'));
170 170
 
171 171
 		/**
172 172
 		 * Load file
173 173
 		 */
174
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
174
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
175 175
 	}
176 176
 
177 177
 	/**
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
 		$addons         = give_get_plugins();
185 185
 		$plugin_updates = get_plugin_updates();
186 186
 
187
-		foreach ( $addons as $key => $info ) {
188
-			if ( 'active' != $info['Status'] || 'add-on' != $info['Type'] || empty( $plugin_updates[ $key ] ) ) {
187
+		foreach ($addons as $key => $info) {
188
+			if ('active' != $info['Status'] || 'add-on' != $info['Type'] || empty($plugin_updates[$key])) {
189 189
 				continue;
190 190
 			}
191 191
 
192
-			$this->updates['plugin'][] = array_merge( $info, (array) $plugin_updates[ $key ] );
192
+			$this->updates['plugin'][] = array_merge($info, (array) $plugin_updates[$key]);
193 193
 		}
194 194
 	}
195 195
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * @access public
202 202
 	 */
203 203
 	public function __register_upgrade() {
204
-		if ( ! is_admin() ) {
204
+		if ( ! is_admin()) {
205 205
 			return;
206 206
 		}
207 207
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		 *
211 211
 		 * @since 1.8.12
212 212
 		 */
213
-		do_action( 'give_register_updates', $this );
213
+		do_action('give_register_updates', $this);
214 214
 	}
215 215
 
216 216
 	/**
@@ -224,17 +224,17 @@  discard block
 block discarded – undo
224 224
 		global $submenu;
225 225
 
226 226
 		// Bailout.
227
-		if ( empty( $menu ) || ! $this->get_update_count() ) {
227
+		if (empty($menu) || ! $this->get_update_count()) {
228 228
 			return;
229 229
 		}
230 230
 
231
-		foreach ( $menu as $index => $menu_item ) {
232
-			if ( 'edit.php?post_type=give_forms' !== $menu_item[2] ) {
231
+		foreach ($menu as $index => $menu_item) {
232
+			if ('edit.php?post_type=give_forms' !== $menu_item[2]) {
233 233
 				continue;
234 234
 			}
235 235
 
236
-			$menu[ $index ][0] = sprintf(
237
-				__( 'Donations %s', 'give' ),
236
+			$menu[$index][0] = sprintf(
237
+				__('Donations %s', 'give'),
238 238
 				sprintf(
239 239
 					'<span class="update-plugins count-%1$d"><span class="plugin-count">%1$d</span></span>',
240 240
 					$this->get_update_count()
@@ -259,15 +259,15 @@  discard block
 block discarded – undo
259 259
 		// Bailout.
260 260
 		if ( ! $this->get_update_count()) {
261 261
 			// Show complete update message if still on update setting page.
262
-			if ( isset($_GET['page']) && 'give-updates' === $_GET['page'] ) {
262
+			if (isset($_GET['page']) && 'give-updates' === $_GET['page']) {
263 263
 				// Upgrades
264 264
 				add_submenu_page(
265 265
 					'edit.php?post_type=give_forms',
266
-					esc_html__( 'Give Updates Complete', 'give' ),
267
-					__( 'Updates', 'give' ),
266
+					esc_html__('Give Updates Complete', 'give'),
267
+					__('Updates', 'give'),
268 268
 					'manage_give_settings',
269 269
 					'give-updates',
270
-					array( $this, 'render_complete_page' )
270
+					array($this, 'render_complete_page')
271 271
 				);
272 272
 			}
273 273
 
@@ -277,15 +277,15 @@  discard block
 block discarded – undo
277 277
 		// Upgrades
278 278
 		add_submenu_page(
279 279
 			'edit.php?post_type=give_forms',
280
-			esc_html__( 'Give Updates', 'give' ),
280
+			esc_html__('Give Updates', 'give'),
281 281
 			sprintf(
282 282
 				'%1$s <span class="update-plugins count-%2$d"><span class="plugin-count">%2$d</span></span>',
283
-				__( 'Updates', 'give' ),
283
+				__('Updates', 'give'),
284 284
 				$this->get_update_count()
285 285
 			),
286 286
 			'manage_give_settings',
287 287
 			'give-updates',
288
-			array( $this, 'render_page' )
288
+			array($this, 'render_page')
289 289
 		);
290 290
 	}
291 291
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @return int
298 298
 	 */
299 299
 	public function get_db_update_count() {
300
-		return count( $this->get_updates( 'database', 'new' ) );
300
+		return count($this->get_updates('database', 'new'));
301 301
 	}
302 302
 
303 303
 	/**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 * @access public
308 308
 	 */
309 309
 	public function render_complete_page() {
310
-		include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades-complete.php';
310
+		include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades-complete.php';
311 311
 	}
312 312
 
313 313
 	/**
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 * @access public
318 318
 	 */
319 319
 	public function render_page() {
320
-		include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades.php';
320
+		include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades.php';
321 321
 	}
322 322
 
323 323
 	/**
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	 * @return int
329 329
 	 */
330 330
 	public function get_plugin_update_count() {
331
-		return count( $this->get_updates( 'plugin' ) );
331
+		return count($this->get_updates('plugin'));
332 332
 	}
333 333
 
334 334
 	/**
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 		$db_update_count     = $this->get_db_update_count();
344 344
 		$plugin_update_count = $this->get_plugin_update_count();
345 345
 
346
-		return ( $db_update_count + $plugin_update_count );
346
+		return ($db_update_count + $plugin_update_count);
347 347
 	}
348 348
 
349 349
 
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 	 * @access public
355 355
 	 */
356 356
 	public function __flush_resume_updates() {
357
-		delete_option( 'give_doing_upgrade' );
358
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
357
+		delete_option('give_doing_upgrade');
358
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
359 359
 
360 360
 		// Reset counter.
361 361
 		$this->step = $this->percentage = 0;
362
-		++ $this->update;
362
+		++$this->update;
363 363
 	}
364 364
 
365 365
 	/**
@@ -370,24 +370,24 @@  discard block
 block discarded – undo
370 370
 	 */
371 371
 	public function __give_ajax_updates() {
372 372
 		// Check permission.
373
-		if ( ! current_user_can( 'manage_give_settings' ) ) {
373
+		if ( ! current_user_can('manage_give_settings')) {
374 374
 			$this->send_ajax_response(
375 375
 				array(
376
-					'message' => esc_html__( 'You do not have permission to do Give upgrades.', 'give' ),
376
+					'message' => esc_html__('You do not have permission to do Give upgrades.', 'give'),
377 377
 				),
378 378
 				'error'
379 379
 			);
380 380
 		}
381 381
 
382 382
 		// Set params.
383
-		$this->step   = absint( $_POST['step'] );
384
-		$this->update = absint( $_POST['update'] );
383
+		$this->step   = absint($_POST['step']);
384
+		$this->update = absint($_POST['update']);
385 385
 
386 386
 		// Bailout: step and update must be positive and greater then zero.
387
-		if ( ! $this->step ) {
387
+		if ( ! $this->step) {
388 388
 			$this->send_ajax_response(
389 389
 				array(
390
-					'message'    => __( 'Please reload this page  and try again', 'give' ),
390
+					'message'    => __('Please reload this page  and try again', 'give'),
391 391
 					'heading'    => '',
392 392
 					'percentage' => 0,
393 393
 				),
@@ -396,14 +396,14 @@  discard block
 block discarded – undo
396 396
 		}
397 397
 
398 398
 		// Get updates.
399
-		$updates = $this->get_updates( 'database', 'new' );
399
+		$updates = $this->get_updates('database', 'new');
400 400
 
401 401
 		// Bailout if we do not have nay updates.
402
-		if ( empty( $updates ) ) {
402
+		if (empty($updates)) {
403 403
 			$this->send_ajax_response(
404 404
 				array(
405
-					'message'    => __( 'The database is already up to date.', 'give' ),
406
-					'heading'    => __( 'Updates Completed.', 'give' ),
405
+					'message'    => __('The database is already up to date.', 'give'),
406
+					'heading'    => __('Updates Completed.', 'give'),
407 407
 					'percentage' => 0,
408 408
 				),
409 409
 				'success'
@@ -411,26 +411,26 @@  discard block
 block discarded – undo
411 411
 		}
412 412
 
413 413
 		// Process update.
414
-		foreach ( $updates as $index => $update ) {
414
+		foreach ($updates as $index => $update) {
415 415
 			// Check if update depend upon any other update.
416
-			if ( ! empty( $update['depend'] ) && ! give_has_upgrade_completed( $update['depend'] ) ) {
416
+			if ( ! empty($update['depend']) && ! give_has_upgrade_completed($update['depend'])) {
417 417
 				continue;
418 418
 			}
419 419
 
420 420
 			// Run update.
421
-			if ( is_array( $update['callback'] ) ) {
421
+			if (is_array($update['callback'])) {
422 422
 				$update['callback'][0]->$update['callback'][1]();
423 423
 			} else {
424 424
 				$update['callback']();
425 425
 			}
426 426
 
427 427
 			// Check if current update completed or not.
428
-			if ( give_has_upgrade_completed( $update['id'] ) ) {
429
-				if ( 1 === count( $updates ) ) {
428
+			if (give_has_upgrade_completed($update['id'])) {
429
+				if (1 === count($updates)) {
430 430
 					$this->send_ajax_response(
431 431
 						array(
432
-							'message'    => __( 'Database updated successfully.', 'give' ),
433
-							'heading'    => __( 'Updates Completed.', 'give' ),
432
+							'message'    => __('Database updated successfully.', 'give'),
433
+							'heading'    => __('Updates Completed.', 'give'),
434 434
 							'percentage' => 0,
435 435
 						),
436 436
 						'success'
@@ -440,16 +440,16 @@  discard block
 block discarded – undo
440 440
 
441 441
 			$doing_upgrade_args = array(
442 442
 				'update_info' => $update,
443
-				'step'        => ++ $this->step,
443
+				'step'        => ++$this->step,
444 444
 				'update'      => $this->update,
445
-				'heading'     => sprintf( 'Update %s of {update_count}', $this->update ),
445
+				'heading'     => sprintf('Update %s of {update_count}', $this->update),
446 446
 				'percentage'  => $this->percentage,
447 447
 			);
448 448
 
449 449
 			// Cache upgrade.
450
-			update_option( 'give_doing_upgrade', $doing_upgrade_args );
450
+			update_option('give_doing_upgrade', $doing_upgrade_args);
451 451
 
452
-			$this->send_ajax_response( $doing_upgrade_args );
452
+			$this->send_ajax_response($doing_upgrade_args);
453 453
 		}// End foreach().
454 454
 	}
455 455
 
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 	 * @param        $data
463 463
 	 * @param string $type
464 464
 	 */
465
-	public function send_ajax_response( $data, $type = '' ) {
465
+	public function send_ajax_response($data, $type = '') {
466 466
 		$default = array(
467 467
 			'message'    => '',
468 468
 			'heading'    => '',
@@ -472,21 +472,21 @@  discard block
 block discarded – undo
472 472
 		);
473 473
 
474 474
 		// Set data.
475
-		$data = wp_parse_args( $data, $default );
475
+		$data = wp_parse_args($data, $default);
476 476
 
477
-		switch ( $type ) {
477
+		switch ($type) {
478 478
 			case 'success':
479
-				wp_send_json_success( $data );
479
+				wp_send_json_success($data);
480 480
 				break;
481 481
 
482 482
 			case 'error':
483
-				wp_send_json_error( $data );
483
+				wp_send_json_error($data);
484 484
 				break;
485 485
 
486 486
 			default:
487
-				wp_send_json( array(
487
+				wp_send_json(array(
488 488
 					'data' => $data,
489
-				) );
489
+				));
490 490
 				break;
491 491
 		}
492 492
 	}
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
 	public function resume_updates() {
504 504
 		$status = false;
505 505
 
506
-		if ( $update = get_option( 'give_doing_upgrade' ) ) {
507
-			$status = ! empty( $update['step'] ) ? $update['step'] : $status;
506
+		if ($update = get_option('give_doing_upgrade')) {
507
+			$status = ! empty($update['step']) ? $update['step'] : $status;
508 508
 		}
509 509
 
510 510
 		return $status;
@@ -520,12 +520,12 @@  discard block
 block discarded – undo
520 520
 	 * @param $total
521 521
 	 * @param $current_total
522 522
 	 */
523
-	public function set_percentage( $total, $current_total ) {
523
+	public function set_percentage($total, $current_total) {
524 524
 		// Set percentage.
525
-		$this->percentage = $total ? ( ( $current_total ) / $total ) * 100 : 0;
525
+		$this->percentage = $total ? (($current_total) / $total) * 100 : 0;
526 526
 
527 527
 		// Verify percentage.
528
-		$this->percentage = ( 100 < $this->percentage ) ? 100 : $this->percentage;
528
+		$this->percentage = (100 < $this->percentage) ? 100 : $this->percentage;
529 529
 	}
530 530
 }
531 531
 
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +199 added lines, -199 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
 
@@ -25,56 +25,56 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_do_automatic_upgrades() {
27 27
 	$did_upgrade  = false;
28
-	$give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) );
28
+	$give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version'));
29 29
 
30
-	if ( ! $give_version ) {
30
+	if ( ! $give_version) {
31 31
 		// 1.0 is the first version to use this option so we must add it.
32 32
 		$give_version = '1.0';
33 33
 	}
34 34
 
35
-	switch ( true ) {
35
+	switch (true) {
36 36
 
37
-		case version_compare( $give_version, '1.6', '<' ) :
37
+		case version_compare($give_version, '1.6', '<') :
38 38
 			give_v16_upgrades();
39 39
 			$did_upgrade = true;
40 40
 
41
-		case version_compare( $give_version, '1.7', '<' ) :
41
+		case version_compare($give_version, '1.7', '<') :
42 42
 			give_v17_upgrades();
43 43
 			$did_upgrade = true;
44 44
 
45
-		case version_compare( $give_version, '1.8', '<' ) :
45
+		case version_compare($give_version, '1.8', '<') :
46 46
 			give_v18_upgrades();
47 47
 			$did_upgrade = true;
48 48
 
49
-		case version_compare( $give_version, '1.8.7', '<' ) :
49
+		case version_compare($give_version, '1.8.7', '<') :
50 50
 			give_v187_upgrades();
51 51
 			$did_upgrade = true;
52 52
 
53
-		case version_compare( $give_version, '1.8.8', '<' ) :
53
+		case version_compare($give_version, '1.8.8', '<') :
54 54
 			give_v188_upgrades();
55 55
 			$did_upgrade = true;
56 56
 
57
-		case version_compare( $give_version, '1.8.9', '<' ) :
57
+		case version_compare($give_version, '1.8.9', '<') :
58 58
 			give_v189_upgrades();
59 59
 			$did_upgrade = true;
60 60
 
61
-		case version_compare( $give_version, '1.8.12', '<' ) :
61
+		case version_compare($give_version, '1.8.12', '<') :
62 62
 			give_v1812_upgrades();
63 63
 			$did_upgrade = true;
64 64
 
65
-		case version_compare( $give_version, '1.8.13', '<' ) :
65
+		case version_compare($give_version, '1.8.13', '<') :
66 66
 			give_v1813_upgrades();
67 67
 			$did_upgrade = true;
68 68
 
69 69
 	}
70 70
 
71
-	if ( $did_upgrade ) {
72
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
71
+	if ($did_upgrade) {
72
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
73 73
 	}
74 74
 }
75 75
 
76
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
77
-add_action( 'give_upgrades', 'give_do_automatic_upgrades' );
76
+add_action('admin_init', 'give_do_automatic_upgrades');
77
+add_action('give_upgrades', 'give_do_automatic_upgrades');
78 78
 
79 79
 /**
80 80
  * Display Upgrade Notices
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
  *
87 87
  * @return void
88 88
  */
89
-function give_show_upgrade_notices( $give_updates ) {
89
+function give_show_upgrade_notices($give_updates) {
90 90
 	// v1.3.2 Upgrades
91 91
 	$give_updates->register(
92 92
 		array(
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	);
153 153
 }
154 154
 
155
-add_action( 'give_register_updates', 'give_show_upgrade_notices' );
155
+add_action('give_register_updates', 'give_show_upgrade_notices');
156 156
 
157 157
 /**
158 158
  * Triggers all upgrade functions
@@ -164,29 +164,29 @@  discard block
 block discarded – undo
164 164
  */
165 165
 function give_trigger_upgrades() {
166 166
 
167
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
168
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
167
+	if ( ! current_user_can('manage_give_settings')) {
168
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
169 169
 			'response' => 403,
170
-		) );
170
+		));
171 171
 	}
172 172
 
173
-	$give_version = get_option( 'give_version' );
173
+	$give_version = get_option('give_version');
174 174
 
175
-	if ( ! $give_version ) {
175
+	if ( ! $give_version) {
176 176
 		// 1.0 is the first version to use this option so we must add it.
177 177
 		$give_version = '1.0';
178
-		add_option( 'give_version', $give_version );
178
+		add_option('give_version', $give_version);
179 179
 	}
180 180
 
181
-	update_option( 'give_version', GIVE_VERSION );
182
-	delete_option( 'give_doing_upgrade' );
181
+	update_option('give_version', GIVE_VERSION);
182
+	delete_option('give_doing_upgrade');
183 183
 
184
-	if ( DOING_AJAX ) {
185
-		die( 'complete' );
184
+	if (DOING_AJAX) {
185
+		die('complete');
186 186
 	} // End if().
187 187
 }
188 188
 
189
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
189
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
190 190
 
191 191
 
192 192
 /**
@@ -202,24 +202,24 @@  discard block
 block discarded – undo
202 202
 	/* @var Give_Updates $give_updates */
203 203
 	$give_updates = Give_Updates::get_instance();
204 204
 
205
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
206
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
205
+	if ( ! current_user_can('manage_give_settings')) {
206
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
207 207
 			'response' => 403,
208
-		) );
208
+		));
209 209
 	}
210 210
 
211
-	ignore_user_abort( true );
211
+	ignore_user_abort(true);
212 212
 
213
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
214
-		@set_time_limit( 0 );
213
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
214
+		@set_time_limit(0);
215 215
 	}
216 216
 
217 217
 	// UPDATE DB METAKEYS.
218 218
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
219
-	$query = $wpdb->query( $sql );
219
+	$query = $wpdb->query($sql);
220 220
 
221 221
 	$give_updates->percentage = 100;
222
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
222
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
223 223
 }
224 224
 
225 225
 
@@ -243,24 +243,24 @@  discard block
 block discarded – undo
243 243
 	$where  .= "AND ( p.post_status = 'abandoned' )";
244 244
 	$where  .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
245 245
 
246
-	$sql            = $select . $join . $where;
247
-	$found_payments = $wpdb->get_col( $sql );
246
+	$sql            = $select.$join.$where;
247
+	$found_payments = $wpdb->get_col($sql);
248 248
 
249
-	foreach ( $found_payments as $payment ) {
249
+	foreach ($found_payments as $payment) {
250 250
 
251 251
 		// Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves.
252
-		$modified_time = get_post_modified_time( 'U', false, $payment );
252
+		$modified_time = get_post_modified_time('U', false, $payment);
253 253
 
254 254
 		// 1450124863 =  12/10/2015 20:42:25.
255
-		if ( $modified_time >= 1450124863 ) {
255
+		if ($modified_time >= 1450124863) {
256 256
 
257
-			give_update_payment_status( $payment, 'pending' );
257
+			give_update_payment_status($payment, 'pending');
258 258
 
259 259
 		}
260 260
 	}
261 261
 
262 262
 	$give_updates->percentage = 100;
263
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
263
+	give_set_upgrade_complete('upgrade_give_offline_status');
264 264
 }
265 265
 
266 266
 
@@ -273,17 +273,17 @@  discard block
 block discarded – undo
273 273
  */
274 274
 function give_v152_cleanup_users() {
275 275
 
276
-	$give_version = get_option( 'give_version' );
276
+	$give_version = get_option('give_version');
277 277
 
278
-	if ( ! $give_version ) {
278
+	if ( ! $give_version) {
279 279
 		// 1.0 is the first version to use this option so we must add it.
280 280
 		$give_version = '1.0';
281 281
 	}
282 282
 
283
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
283
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
284 284
 
285 285
 	// v1.5.2 Upgrades
286
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
286
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
287 287
 
288 288
 		// Delete all caps with "ss".
289 289
 		// Also delete all unused "campaign" roles.
@@ -330,9 +330,9 @@  discard block
 block discarded – undo
330 330
 		);
331 331
 
332 332
 		global $wp_roles;
333
-		foreach ( $delete_caps as $cap ) {
334
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
335
-				$wp_roles->remove_cap( $role, $cap );
333
+		foreach ($delete_caps as $cap) {
334
+			foreach (array_keys($wp_roles->roles) as $role) {
335
+				$wp_roles->remove_cap($role, $cap);
336 336
 			}
337 337
 		}
338 338
 
@@ -342,15 +342,15 @@  discard block
 block discarded – undo
342 342
 		$roles->add_caps();
343 343
 
344 344
 		// The Update Ran.
345
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
346
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
347
-		delete_option( 'give_doing_upgrade' );
345
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
346
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
347
+		delete_option('give_doing_upgrade');
348 348
 
349 349
 	}// End if().
350 350
 
351 351
 }
352 352
 
353
-add_action( 'admin_init', 'give_v152_cleanup_users' );
353
+add_action('admin_init', 'give_v152_cleanup_users');
354 354
 
355 355
 /**
356 356
  * 1.6 Upgrade routine to create the customer meta table.
@@ -393,53 +393,53 @@  discard block
 block discarded – undo
393 393
 
394 394
 	// Get addons license key.
395 395
 	$addons = array();
396
-	foreach ( $give_options as $key => $value ) {
397
-		if ( false !== strpos( $key, '_license_key' ) ) {
398
-			$addons[ $key ] = $value;
396
+	foreach ($give_options as $key => $value) {
397
+		if (false !== strpos($key, '_license_key')) {
398
+			$addons[$key] = $value;
399 399
 		}
400 400
 	}
401 401
 
402 402
 	// Bailout: We do not have any addon license data to upgrade.
403
-	if ( empty( $addons ) ) {
403
+	if (empty($addons)) {
404 404
 		return false;
405 405
 	}
406 406
 
407
-	foreach ( $addons as $key => $addon_license ) {
407
+	foreach ($addons as $key => $addon_license) {
408 408
 
409 409
 		// Get addon shortname.
410
-		$shortname = str_replace( '_license_key', '', $key );
410
+		$shortname = str_replace('_license_key', '', $key);
411 411
 
412 412
 		// Addon license option name.
413
-		$addon_license_option_name = $shortname . '_license_active';
413
+		$addon_license_option_name = $shortname.'_license_active';
414 414
 
415 415
 		// bailout if license is empty.
416
-		if ( empty( $addon_license ) ) {
417
-			delete_option( $addon_license_option_name );
416
+		if (empty($addon_license)) {
417
+			delete_option($addon_license_option_name);
418 418
 			continue;
419 419
 		}
420 420
 
421 421
 		// Get addon name.
422 422
 		$addon_name       = array();
423
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
424
-		foreach ( $addon_name_parts as $name_part ) {
423
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
424
+		foreach ($addon_name_parts as $name_part) {
425 425
 
426 426
 			// Fix addon name
427
-			switch ( $name_part ) {
427
+			switch ($name_part) {
428 428
 				case 'authorizenet' :
429 429
 					$name_part = 'authorize.net';
430 430
 					break;
431 431
 			}
432 432
 
433
-			$addon_name[] = ucfirst( $name_part );
433
+			$addon_name[] = ucfirst($name_part);
434 434
 		}
435 435
 
436
-		$addon_name = implode( ' ', $addon_name );
436
+		$addon_name = implode(' ', $addon_name);
437 437
 
438 438
 		// Data to send to the API
439 439
 		$api_params = array(
440 440
 			'edd_action' => 'activate_license', // never change from "edd_" to "give_"!
441 441
 			'license'    => $addon_license,
442
-			'item_name'  => urlencode( $addon_name ),
442
+			'item_name'  => urlencode($addon_name),
443 443
 			'url'        => home_url(),
444 444
 		);
445 445
 
@@ -454,17 +454,17 @@  discard block
 block discarded – undo
454 454
 		);
455 455
 
456 456
 		// Make sure there are no errors.
457
-		if ( is_wp_error( $response ) ) {
458
-			delete_option( $addon_license_option_name );
457
+		if (is_wp_error($response)) {
458
+			delete_option($addon_license_option_name);
459 459
 			continue;
460 460
 		}
461 461
 
462 462
 		// Tell WordPress to look for updates.
463
-		set_site_transient( 'update_plugins', null );
463
+		set_site_transient('update_plugins', null);
464 464
 
465 465
 		// Decode license data.
466
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
467
-		update_option( $addon_license_option_name, $license_data );
466
+		$license_data = json_decode(wp_remote_retrieve_body($response));
467
+		update_option($addon_license_option_name, $license_data);
468 468
 	}// End foreach().
469 469
 }
470 470
 
@@ -494,9 +494,9 @@  discard block
 block discarded – undo
494 494
 	);
495 495
 
496 496
 	global $wp_roles;
497
-	foreach ( $delete_caps as $cap ) {
498
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
499
-			$wp_roles->remove_cap( $role, $cap );
497
+	foreach ($delete_caps as $cap) {
498
+		foreach (array_keys($wp_roles->roles) as $role) {
499
+			$wp_roles->remove_cap($role, $cap);
500 500
 		}
501 501
 	}
502 502
 
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 function give_v18_upgrades_core_setting() {
531 531
 	// Core settings which changes from checkbox to radio.
532 532
 	$core_setting_names = array_merge(
533
-		array_keys( give_v18_renamed_core_settings() ),
533
+		array_keys(give_v18_renamed_core_settings()),
534 534
 		array(
535 535
 			'uninstall_on_delete',
536 536
 			'scripts_footer',
@@ -542,48 +542,48 @@  discard block
 block discarded – undo
542 542
 	);
543 543
 
544 544
 	// Bailout: If not any setting define.
545
-	if ( $give_settings = get_option( 'give_settings' ) ) {
545
+	if ($give_settings = get_option('give_settings')) {
546 546
 
547 547
 		$setting_changed = false;
548 548
 
549 549
 		// Loop: check each setting field.
550
-		foreach ( $core_setting_names as $setting_name ) {
550
+		foreach ($core_setting_names as $setting_name) {
551 551
 			// New setting name.
552
-			$new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name );
552
+			$new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name);
553 553
 
554 554
 			// Continue: If setting already set.
555 555
 			if (
556
-				array_key_exists( $new_setting_name, $give_settings )
557
-				&& in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) )
556
+				array_key_exists($new_setting_name, $give_settings)
557
+				&& in_array($give_settings[$new_setting_name], array('enabled', 'disabled'))
558 558
 			) {
559 559
 				continue;
560 560
 			}
561 561
 
562 562
 			// Set checkbox value to radio value.
563
-			$give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' );
563
+			$give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled');
564 564
 
565 565
 			// @see https://github.com/WordImpress/Give/issues/1063
566
-			if ( false !== strpos( $setting_name, 'disable_' ) ) {
566
+			if (false !== strpos($setting_name, 'disable_')) {
567 567
 
568
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' );
569
-			} elseif ( false !== strpos( $setting_name, 'enable_' ) ) {
568
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled');
569
+			} elseif (false !== strpos($setting_name, 'enable_')) {
570 570
 
571
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' );
571
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled');
572 572
 			}
573 573
 
574 574
 			// Tell bot to update core setting to db.
575
-			if ( ! $setting_changed ) {
575
+			if ( ! $setting_changed) {
576 576
 				$setting_changed = true;
577 577
 			}
578 578
 		}
579 579
 
580 580
 		// Update setting only if they changed.
581
-		if ( $setting_changed ) {
582
-			update_option( 'give_settings', $give_settings );
581
+		if ($setting_changed) {
582
+			update_option('give_settings', $give_settings);
583 583
 		}
584 584
 	}// End if().
585 585
 
586
-	give_set_upgrade_complete( 'v18_upgrades_core_setting' );
586
+	give_set_upgrade_complete('v18_upgrades_core_setting');
587 587
 }
588 588
 
589 589
 /**
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 	$give_updates = Give_Updates::get_instance();
598 598
 
599 599
 	// form query
600
-	$forms = new WP_Query( array(
600
+	$forms = new WP_Query(array(
601 601
 			'paged'          => $give_updates->step,
602 602
 			'status'         => 'any',
603 603
 			'order'          => 'ASC',
@@ -606,41 +606,41 @@  discard block
 block discarded – undo
606 606
 		)
607 607
 	);
608 608
 
609
-	if ( $forms->have_posts() ) {
610
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) );
609
+	if ($forms->have_posts()) {
610
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20));
611 611
 
612
-		while ( $forms->have_posts() ) {
612
+		while ($forms->have_posts()) {
613 613
 			$forms->the_post();
614 614
 
615 615
 			// Form content.
616 616
 			// Note in version 1.8 display content setting split into display content and content placement setting.
617 617
 			// You can delete _give_content_option in future
618
-			$show_content = give_get_meta( get_the_ID(), '_give_content_option', true );
619
-			if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) {
620
-				$field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' );
621
-				give_update_meta( get_the_ID(), '_give_display_content', $field_value );
618
+			$show_content = give_get_meta(get_the_ID(), '_give_content_option', true);
619
+			if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) {
620
+				$field_value = ('none' !== $show_content ? 'enabled' : 'disabled');
621
+				give_update_meta(get_the_ID(), '_give_display_content', $field_value);
622 622
 
623
-				$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
624
-				give_update_meta( get_the_ID(), '_give_content_placement', $field_value );
623
+				$field_value = ('none' !== $show_content ? $show_content : 'give_pre_form');
624
+				give_update_meta(get_the_ID(), '_give_content_placement', $field_value);
625 625
 			}
626 626
 
627 627
 			// "Disable" Guest Donation. Checkbox
628 628
 			// See: https://github.com/WordImpress/Give/issues/1470
629
-			$guest_donation        = give_get_meta( get_the_ID(), '_give_logged_in_only', true );
630
-			$guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' );
631
-			give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval );
629
+			$guest_donation        = give_get_meta(get_the_ID(), '_give_logged_in_only', true);
630
+			$guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled');
631
+			give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval);
632 632
 
633 633
 			// Offline Donations
634 634
 			// See: https://github.com/WordImpress/Give/issues/1579
635
-			$offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true );
636
-			if ( 'no' === $offline_donation ) {
635
+			$offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true);
636
+			if ('no' === $offline_donation) {
637 637
 				$offline_donation_newval = 'global';
638
-			} elseif ( 'yes' === $offline_donation ) {
638
+			} elseif ('yes' === $offline_donation) {
639 639
 				$offline_donation_newval = 'enabled';
640 640
 			} else {
641 641
 				$offline_donation_newval = 'disabled';
642 642
 			}
643
-			give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval );
643
+			give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval);
644 644
 
645 645
 			// Convert yes/no setting field to enabled/disabled.
646 646
 			$form_radio_settings = array(
@@ -660,15 +660,15 @@  discard block
 block discarded – undo
660 660
 				'_give_offline_donation_enable_billing_fields_single',
661 661
 			);
662 662
 
663
-			foreach ( $form_radio_settings as $meta_key ) {
663
+			foreach ($form_radio_settings as $meta_key) {
664 664
 				// Get value.
665
-				$field_value = give_get_meta( get_the_ID(), $meta_key, true );
665
+				$field_value = give_get_meta(get_the_ID(), $meta_key, true);
666 666
 
667 667
 				// Convert meta value only if it is in yes/no/none.
668
-				if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) {
668
+				if (in_array($field_value, array('yes', 'on', 'no', 'none'))) {
669 669
 
670
-					$field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' );
671
-					give_update_meta( get_the_ID(), $meta_key, $field_value );
670
+					$field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled');
671
+					give_update_meta(get_the_ID(), $meta_key, $field_value);
672 672
 				}
673 673
 			}
674 674
 		}// End while().
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 
678 678
 	} else {
679 679
 		// No more forms found, finish up.
680
-		give_set_upgrade_complete( 'v18_upgrades_form_metadata' );
680
+		give_set_upgrade_complete('v18_upgrades_form_metadata');
681 681
 	}
682 682
 }
683 683
 
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 				'_transient_give_stats_',
727 727
 				'give_cache',
728 728
 				'_transient_give_add_ons_feed',
729
-				'_transient__give_ajax_works' .
729
+				'_transient__give_ajax_works'.
730 730
 				'_transient_give_total_api_keys',
731 731
 				'_transient_give_i18n_give_promo_hide',
732 732
 				'_transient_give_contributors',
@@ -753,24 +753,24 @@  discard block
 block discarded – undo
753 753
 		ARRAY_A
754 754
 	);
755 755
 
756
-	if ( ! empty( $user_apikey_options ) ) {
757
-		foreach ( $user_apikey_options as $user ) {
758
-			$cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] );
759
-			$cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] );
760
-			$cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] );
756
+	if ( ! empty($user_apikey_options)) {
757
+		foreach ($user_apikey_options as $user) {
758
+			$cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']);
759
+			$cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']);
760
+			$cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']);
761 761
 		}
762 762
 	}
763 763
 
764
-	if ( ! empty( $cached_options ) ) {
765
-		foreach ( $cached_options as $option ) {
766
-			switch ( true ) {
767
-				case ( false !== strpos( $option, 'transient' ) ):
768
-					$option = str_replace( '_transient_', '', $option );
769
-					delete_transient( $option );
764
+	if ( ! empty($cached_options)) {
765
+		foreach ($cached_options as $option) {
766
+			switch (true) {
767
+				case (false !== strpos($option, 'transient')):
768
+					$option = str_replace('_transient_', '', $option);
769
+					delete_transient($option);
770 770
 					break;
771 771
 
772 772
 				default:
773
-					delete_option( $option );
773
+					delete_option($option);
774 774
 			}
775 775
 		}
776 776
 	}
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 	global $wp_roles;
789 789
 
790 790
 	// Get the role object.
791
-	$give_worker = get_role( 'give_worker' );
791
+	$give_worker = get_role('give_worker');
792 792
 
793 793
 	// A list of capabilities to add for give workers.
794 794
 	$caps_to_add = array(
@@ -796,9 +796,9 @@  discard block
 block discarded – undo
796 796
 		'edit_pages',
797 797
 	);
798 798
 
799
-	foreach ( $caps_to_add as $cap ) {
799
+	foreach ($caps_to_add as $cap) {
800 800
 		// Add the capability.
801
-		$give_worker->add_cap( $cap );
801
+		$give_worker->add_cap($cap);
802 802
 	}
803 803
 
804 804
 }
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 	$give_updates = Give_Updates::get_instance();
816 816
 
817 817
 	// form query
818
-	$donation_forms = new WP_Query( array(
818
+	$donation_forms = new WP_Query(array(
819 819
 			'paged'          => $give_updates->step,
820 820
 			'status'         => 'any',
821 821
 			'order'          => 'ASC',
@@ -824,10 +824,10 @@  discard block
 block discarded – undo
824 824
 		)
825 825
 	);
826 826
 
827
-	if ( $donation_forms->have_posts() ) {
828
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
827
+	if ($donation_forms->have_posts()) {
828
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
829 829
 
830
-		while ( $donation_forms->have_posts() ) {
830
+		while ($donation_forms->have_posts()) {
831 831
 			$donation_forms->the_post();
832 832
 			$form_id = get_the_ID();
833 833
 
@@ -835,41 +835,41 @@  discard block
 block discarded – undo
835 835
 			update_post_meta(
836 836
 				$form_id,
837 837
 				'_give_set_price',
838
-				give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) )
838
+				give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true))
839 839
 			);
840 840
 
841 841
 			// Remove formatting from _give_custom_amount_minimum
842 842
 			update_post_meta(
843 843
 				$form_id,
844 844
 				'_give_custom_amount_minimum',
845
-				give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) )
845
+				give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true))
846 846
 			);
847 847
 
848 848
 			// Bailout.
849
-			if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) {
849
+			if ('set' === get_post_meta($form_id, '_give_price_option', true)) {
850 850
 				continue;
851 851
 			}
852 852
 
853
-			$donation_levels = get_post_meta( $form_id, '_give_donation_levels', true );
853
+			$donation_levels = get_post_meta($form_id, '_give_donation_levels', true);
854 854
 
855
-			if ( ! empty( $donation_levels ) ) {
855
+			if ( ! empty($donation_levels)) {
856 856
 
857
-				foreach ( $donation_levels as $index => $donation_level ) {
858
-					if ( isset( $donation_level['_give_amount'] ) ) {
859
-						$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] );
857
+				foreach ($donation_levels as $index => $donation_level) {
858
+					if (isset($donation_level['_give_amount'])) {
859
+						$donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']);
860 860
 					}
861 861
 				}
862 862
 
863
-				update_post_meta( $form_id, '_give_donation_levels', $donation_levels );
863
+				update_post_meta($form_id, '_give_donation_levels', $donation_levels);
864 864
 
865
-				$donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' );
865
+				$donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount');
866 866
 
867
-				$min_amount = min( $donation_levels_amounts );
868
-				$max_amount = max( $donation_levels_amounts );
867
+				$min_amount = min($donation_levels_amounts);
868
+				$max_amount = max($donation_levels_amounts);
869 869
 
870 870
 				// Set Minimum and Maximum amount for Multi Level Donation Forms
871
-				give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 );
872
-				give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 );
871
+				give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0);
872
+				give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0);
873 873
 			}
874 874
 
875 875
 		}
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 		wp_reset_postdata();
879 879
 	} else {
880 880
 		// The Update Ran.
881
-		give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' );
881
+		give_set_upgrade_complete('v189_upgrades_levels_post_meta');
882 882
 	}
883 883
 
884 884
 }
@@ -934,22 +934,22 @@  discard block
 block discarded – undo
934 934
 	$give_settings        = give_get_settings();
935 935
 	$give_setting_updated = false;
936 936
 
937
-	if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) {
937
+	if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) {
938 938
 		$give_settings['number_decimals']   = 0;
939 939
 		$give_settings['decimal_separator'] = '';
940 940
 		$give_setting_updated               = true;
941 941
 
942
-	} elseif ( empty( $give_settings['decimal_separator'] ) ) {
942
+	} elseif (empty($give_settings['decimal_separator'])) {
943 943
 		$give_settings['number_decimals'] = 0;
944 944
 		$give_setting_updated             = true;
945 945
 
946
-	} elseif ( 6 < absint( $give_settings['number_decimals'] ) ) {
946
+	} elseif (6 < absint($give_settings['number_decimals'])) {
947 947
 		$give_settings['number_decimals'] = 5;
948 948
 		$give_setting_updated             = true;
949 949
 	}
950 950
 
951
-	if ( $give_setting_updated ) {
952
-		update_option( 'give_settings', $give_settings );
951
+	if ($give_setting_updated) {
952
+		update_option('give_settings', $give_settings);
953 953
 	}
954 954
 }
955 955
 
@@ -968,70 +968,70 @@  discard block
 block discarded – undo
968 968
 	$give_updates = Give_Updates::get_instance();
969 969
 
970 970
 	// form query
971
-	$donation_forms = new WP_Query( array(
971
+	$donation_forms = new WP_Query(array(
972 972
 			'paged'          => $give_updates->step,
973 973
 			'status'         => 'any',
974 974
 			'order'          => 'ASC',
975
-			'post_type'      => array( 'give_forms', 'give_payment' ),
975
+			'post_type'      => array('give_forms', 'give_payment'),
976 976
 			'posts_per_page' => 20,
977 977
 		)
978 978
 	);
979 979
 
980
-	if ( $donation_forms->have_posts() ) {
981
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
980
+	if ($donation_forms->have_posts()) {
981
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
982 982
 
983
-		while ( $donation_forms->have_posts() ) {
983
+		while ($donation_forms->have_posts()) {
984 984
 			$donation_forms->the_post();
985 985
 			global $post;
986 986
 
987
-			$meta = get_post_meta( $post->ID );
987
+			$meta = get_post_meta($post->ID);
988 988
 
989
-			switch ( $post->post_type ) {
989
+			switch ($post->post_type) {
990 990
 				case 'give_forms':
991 991
 					// _give_set_price
992
-					if ( ! empty( $meta['_give_set_price'][0] ) ) {
993
-						update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) );
992
+					if ( ! empty($meta['_give_set_price'][0])) {
993
+						update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0]));
994 994
 					}
995 995
 
996 996
 					// _give_custom_amount_minimum
997
-					if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) {
998
-						update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) );
997
+					if ( ! empty($meta['_give_custom_amount_minimum'][0])) {
998
+						update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0]));
999 999
 					}
1000 1000
 
1001 1001
 					// _give_levels_minimum_amount
1002
-					if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) {
1003
-						update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) );
1002
+					if ( ! empty($meta['_give_levels_minimum_amount'][0])) {
1003
+						update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0]));
1004 1004
 					}
1005 1005
 
1006 1006
 					// _give_levels_maximum_amount
1007
-					if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) {
1008
-						update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) );
1007
+					if ( ! empty($meta['_give_levels_maximum_amount'][0])) {
1008
+						update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0]));
1009 1009
 					}
1010 1010
 
1011 1011
 					// _give_set_goal
1012
-					if ( ! empty( $meta['_give_set_goal'][0] ) ) {
1013
-						update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) );
1012
+					if ( ! empty($meta['_give_set_goal'][0])) {
1013
+						update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0]));
1014 1014
 					}
1015 1015
 
1016 1016
 					// _give_form_earnings
1017
-					if ( ! empty( $meta['_give_form_earnings'][0] ) ) {
1018
-						update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) );
1017
+					if ( ! empty($meta['_give_form_earnings'][0])) {
1018
+						update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0]));
1019 1019
 					}
1020 1020
 
1021 1021
 					// _give_custom_amount_minimum
1022
-					if ( ! empty( $meta['_give_donation_levels'][0] ) ) {
1023
-						$donation_levels = unserialize( $meta['_give_donation_levels'][0] );
1022
+					if ( ! empty($meta['_give_donation_levels'][0])) {
1023
+						$donation_levels = unserialize($meta['_give_donation_levels'][0]);
1024 1024
 
1025
-						foreach ( $donation_levels as $index => $level ) {
1026
-							if ( empty( $level['_give_amount'] ) ) {
1025
+						foreach ($donation_levels as $index => $level) {
1026
+							if (empty($level['_give_amount'])) {
1027 1027
 								continue;
1028 1028
 							}
1029 1029
 
1030
-							$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] );
1030
+							$donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']);
1031 1031
 						}
1032 1032
 
1033 1033
 						$meta['_give_donation_levels'] = $donation_levels;
1034
-						update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] );
1034
+						update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']);
1035 1035
 					}
1036 1036
 
1037 1037
 
@@ -1039,8 +1039,8 @@  discard block
 block discarded – undo
1039 1039
 
1040 1040
 				case 'give_payment':
1041 1041
 					// _give_payment_total
1042
-					if ( ! empty( $meta['_give_payment_total'][0] ) ) {
1043
-						update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) );
1042
+					if ( ! empty($meta['_give_payment_total'][0])) {
1043
+						update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0]));
1044 1044
 					}
1045 1045
 
1046 1046
 					break;
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 		wp_reset_postdata();
1052 1052
 	} else {
1053 1053
 		// The Update Ran.
1054
-		give_set_upgrade_complete( 'v1812_update_amount_values' );
1054
+		give_set_upgrade_complete('v1812_update_amount_values');
1055 1055
 	}
1056 1056
 }
1057 1057
 
@@ -1071,22 +1071,22 @@  discard block
 block discarded – undo
1071 1071
 	$offset       = 1 === $give_updates->step ? 0 : $give_updates->step * 20;
1072 1072
 
1073 1073
 	// form query
1074
-	$donors = Give()->donors->get_donors( array(
1074
+	$donors = Give()->donors->get_donors(array(
1075 1075
 			'number' => 20,
1076 1076
 			'offset' => $offset,
1077 1077
 		)
1078 1078
 	);
1079 1079
 
1080
-	if ( ! empty( $donors ) ) {
1081
-		$give_updates->set_percentage( Give()->donors->count(), ( $give_updates->step * 20 ) );
1080
+	if ( ! empty($donors)) {
1081
+		$give_updates->set_percentage(Give()->donors->count(), ($give_updates->step * 20));
1082 1082
 
1083 1083
 		/* @var Object $donor */
1084
-		foreach ( $donors as $donor ) {
1085
-			Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) );
1084
+		foreach ($donors as $donor) {
1085
+			Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value)));
1086 1086
 		}
1087 1087
 	} else {
1088 1088
 		// The Update Ran.
1089
-		give_set_upgrade_complete( 'v1812_update_donor_purchase_values' );
1089
+		give_set_upgrade_complete('v1812_update_donor_purchase_values');
1090 1090
 	}
1091 1091
 }
1092 1092
 
@@ -1101,25 +1101,25 @@  discard block
 block discarded – undo
1101 1101
 	$offset       = 1 === $give_updates->step ? 0 : $give_updates->step * 20;
1102 1102
 
1103 1103
 	// Fetch all the existing donors.
1104
-	$donors = Give()->donors->get_donors( array(
1104
+	$donors = Give()->donors->get_donors(array(
1105 1105
 			'number' => 20,
1106 1106
 			'offset' => $offset,
1107 1107
 		)
1108 1108
 	);
1109 1109
 
1110
-	if ( ! empty( $donors ) ) {
1111
-		$give_updates->set_percentage( Give()->donors->count(), ( $give_updates->step * 20 ) );
1110
+	if ( ! empty($donors)) {
1111
+		$give_updates->set_percentage(Give()->donors->count(), ($give_updates->step * 20));
1112 1112
 
1113 1113
 		/* @var Object $donor */
1114
-		foreach ( $donors as $donor ) {
1114
+		foreach ($donors as $donor) {
1115 1115
 			$user_id = $donor->user_id;
1116 1116
 
1117 1117
 			// Proceed, if donor is attached with user.
1118
-			if ( $user_id ) {
1119
-				$user = get_userdata( $user_id );
1118
+			if ($user_id) {
1119
+				$user = get_userdata($user_id);
1120 1120
 
1121 1121
 				// Update user role, if user has subscriber role.
1122
-				if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) {
1122
+				if (is_array($user->roles) && in_array('subscriber', $user->roles)) {
1123 1123
 					wp_update_user(
1124 1124
 						array(
1125 1125
 							'ID'   => $user_id,
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
 		}
1132 1132
 	} else {
1133 1133
 		// The Update Ran.
1134
-		give_set_upgrade_complete( 'v1813_update_donor_user_roles' );
1134
+		give_set_upgrade_complete('v1813_update_donor_user_roles');
1135 1135
 	}
1136 1136
 }
1137 1137
 
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
  */
1144 1144
 function give_v1813_upgrades() {
1145 1145
 	// Update admin setting.
1146
-	give_update_option( 'donor_default_user_role', 'give_donor' );
1146
+	give_update_option('donor_default_user_role', 'give_donor');
1147 1147
 
1148 1148
 	// Update Give roles.
1149 1149
 	$roles = new Give_Roles();
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-advanced.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -95,13 +95,13 @@
 block discarded – undo
95 95
 								'disabled' => __( 'Head', 'give' ),
96 96
 							)
97 97
 						),
98
-                        array(
99
-                            'name'  => __( 'Advanced Settings Docs Link', 'give' ),
100
-                            'id'    => 'advanced_settings_docs_link',
101
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-advanced' ),
102
-                            'title' => __( 'Advanced Settings', 'give' ),
103
-                            'type'  => 'give_docs_link',
104
-                        ),
98
+						array(
99
+							'name'  => __( 'Advanced Settings Docs Link', 'give' ),
100
+							'id'    => 'advanced_settings_docs_link',
101
+							'url'   => esc_url( 'http://docs.givewp.com/settings-advanced' ),
102
+							'title' => __( 'Advanced Settings', 'give' ),
103
+							'type'  => 'give_docs_link',
104
+						),
105 105
 						array(
106 106
 							'id'   => 'give_title_data_control_2',
107 107
 							'type' => 'sectionend'
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Advanced' ) ) :
16
+if ( ! class_exists('Give_Settings_Advanced')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Advanced.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'advanced';
30
-			$this->label = __( 'Advanced', 'give' );
30
+			$this->label = __('Advanced', 'give');
31 31
 
32 32
 			$this->default_tab = 'advanced-options';
33 33
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 			$current_section = give_get_current_setting_section();
47 47
 
48
-			switch ( $current_section ) {
48
+			switch ($current_section) {
49 49
 				case 'advanced-options':
50 50
 					$settings = array(
51 51
 						array(
@@ -53,19 +53,19 @@  discard block
 block discarded – undo
53 53
 							'type' => 'title'
54 54
 						),
55 55
 						array(
56
-							'name'    => __( 'Remove Data on Uninstall', 'give' ),
57
-							'desc'    => __( 'When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give' ),
56
+							'name'    => __('Remove Data on Uninstall', 'give'),
57
+							'desc'    => __('When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give'),
58 58
 							'id'      => 'uninstall_on_delete',
59 59
 							'type'    => 'radio_inline',
60 60
 							'default' => 'disabled',
61 61
 							'options' => array(
62
-								'enabled'  => __( 'Yes, Remove all data', 'give' ),
63
-								'disabled' => __( 'No, keep my Give settings and donation data', 'give' ),
62
+								'enabled'  => __('Yes, Remove all data', 'give'),
63
+								'disabled' => __('No, keep my Give settings and donation data', 'give'),
64 64
 							)
65 65
 						),
66 66
 						array(
67
-							'name'    => __( 'Default User Role', 'give' ),
68
-							'desc'    => __( 'Assign default user roles for donors when donors opt to register as a WP User.', 'give' ),
67
+							'name'    => __('Default User Role', 'give'),
68
+							'desc'    => __('Assign default user roles for donors when donors opt to register as a WP User.', 'give'),
69 69
 							'id'      => 'donor_default_user_role',
70 70
 							'type'    => 'select',
71 71
 							'default' => 'give_donor',
@@ -73,33 +73,33 @@  discard block
 block discarded – undo
73 73
 						),
74 74
 						array(
75 75
 							/* translators: %s: the_content */
76
-							'name'    => sprintf( __( '%s filter', 'give' ), '<code>the_content</code>' ),
76
+							'name'    => sprintf(__('%s filter', 'give'), '<code>the_content</code>'),
77 77
 							/* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */
78
-							'desc'    => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ),
78
+							'desc'    => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'),
79 79
 							'id'      => 'the_content_filter',
80 80
 							'default' => 'enabled',
81 81
 							'type'    => 'radio_inline',
82 82
 							'options' => array(
83
-								'enabled'  => __( 'Enabled', 'give' ),
84
-								'disabled' => __( 'Disabled', 'give' ),
83
+								'enabled'  => __('Enabled', 'give'),
84
+								'disabled' => __('Disabled', 'give'),
85 85
 							)
86 86
 						),
87 87
 						array(
88
-							'name'    => __( 'Script Loading Location', 'give' ),
89
-							'desc'    => __( 'This allows you to load your Give scripts either in the <code>&lt;head&gt;</code> or footer of your website.', 'give' ),
88
+							'name'    => __('Script Loading Location', 'give'),
89
+							'desc'    => __('This allows you to load your Give scripts either in the <code>&lt;head&gt;</code> or footer of your website.', 'give'),
90 90
 							'id'      => 'scripts_footer',
91 91
 							'type'    => 'radio_inline',
92 92
 							'default' => 'disabled',
93 93
 							'options' => array(
94
-								'enabled'  => __( 'Footer', 'give' ),
95
-								'disabled' => __( 'Head', 'give' ),
94
+								'enabled'  => __('Footer', 'give'),
95
+								'disabled' => __('Head', 'give'),
96 96
 							)
97 97
 						),
98 98
                         array(
99
-                            'name'  => __( 'Advanced Settings Docs Link', 'give' ),
99
+                            'name'  => __('Advanced Settings Docs Link', 'give'),
100 100
                             'id'    => 'advanced_settings_docs_link',
101
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-advanced' ),
102
-                            'title' => __( 'Advanced Settings', 'give' ),
101
+                            'url'   => esc_url('http://docs.givewp.com/settings-advanced'),
102
+                            'title' => __('Advanced Settings', 'give'),
103 103
                             'type'  => 'give_docs_link',
104 104
                         ),
105 105
 						array(
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			 * Filter the advanced settings.
116 116
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
117 117
 			 */
118
-			$settings = apply_filters( 'give_settings_advanced', $settings );
118
+			$settings = apply_filters('give_settings_advanced', $settings);
119 119
 
120 120
 			/**
121 121
 			 * Filter the settings.
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 			 *
125 125
 			 * @param  array $settings
126 126
 			 */
127
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
127
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
128 128
 
129 129
 			// Output.
130 130
 			return $settings;
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
 		 */
139 139
 		public function get_sections() {
140 140
 			$sections = array(
141
-				'advanced-options' => __( 'Advanced Options', 'give' )
141
+				'advanced-options' => __('Advanced Options', 'give')
142 142
 			);
143 143
 
144
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
144
+			return apply_filters('give_get_sections_'.$this->id, $sections);
145 145
 		}
146 146
 	}
147 147
 
Please login to merge, or discard this patch.
includes/admin/forms/class-metabox-form-data.php 2 patches
Spacing   +303 added lines, -303 removed lines patch added patch discarded remove patch
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	function __construct() {
48 48
 		$this->metabox_id    = 'give-metabox-form-data';
49
-		$this->metabox_label = __( 'Donation Form Options', 'give' );
49
+		$this->metabox_label = __('Donation Form Options', 'give');
50 50
 
51 51
 		// Setup.
52
-		add_action( 'admin_init', array( $this, 'setup' ) );
52
+		add_action('admin_init', array($this, 'setup'));
53 53
 
54 54
 		// Add metabox.
55
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 10 );
55
+		add_action('add_meta_boxes', array($this, 'add_meta_box'), 10);
56 56
 
57 57
 		// Save form meta.
58
-		add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 );
58
+		add_action('save_post_give_forms', array($this, 'save'), 10, 2);
59 59
 
60 60
 		// cmb2 old setting loaders.
61 61
 		// add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) );
62 62
 		// Add offline donations options.
63
-		add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 );
63
+		add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1);
64 64
 
65 65
 		// Maintain active tab query parameter after save.
66
-		add_filter( 'redirect_post_location', array( $this, 'maintain_active_tab' ), 10, 2 );
66
+		add_filter('redirect_post_location', array($this, 'maintain_active_tab'), 10, 2);
67 67
 	}
68 68
 
69 69
 	/**
@@ -85,24 +85,24 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	function get_settings() {
87 87
 		$post_id               = give_get_admin_post_id();
88
-		$price                 = give_get_form_price( $post_id );
89
-		$custom_amount_minimum = give_get_form_minimum_price( $post_id );
90
-		$goal                  = give_format_amount( give_get_form_goal( $post_id ), array( 'sanitize' => false ) );
91
-		$price_placeholder     = give_format_decimal( '1.00', false, false );
88
+		$price                 = give_get_form_price($post_id);
89
+		$custom_amount_minimum = give_get_form_minimum_price($post_id);
90
+		$goal                  = give_format_amount(give_get_form_goal($post_id), array('sanitize' => false));
91
+		$price_placeholder     = give_format_decimal('1.00', false, false);
92 92
 
93 93
 		// No empty prices - min. 1.00 for new forms
94
-		if ( empty( $price ) && is_null( $post_id ) ) {
94
+		if (empty($price) && is_null($post_id)) {
95 95
 			$price = '1.00';
96 96
 		}
97 97
 
98 98
 		// Min. $1.00 for new forms
99
-		if ( empty( $custom_amount_minimum ) ) {
99
+		if (empty($custom_amount_minimum)) {
100 100
 			$custom_amount_minimum = '1.00';
101 101
 		}
102 102
 
103 103
 		// Format amounts.
104
-		$price                 = give_format_amount( $price, array( 'sanitize' => false ) );
105
-		$custom_amount_minimum = give_format_amount( $custom_amount_minimum, array( 'sanitize' => false ) );
104
+		$price                 = give_format_amount($price, array('sanitize' => false));
105
+		$custom_amount_minimum = give_format_amount($custom_amount_minimum, array('sanitize' => false));
106 106
 
107 107
 		// Start with an underscore to hide fields from custom fields list
108 108
 		$prefix = '_give_';
@@ -111,27 +111,27 @@  discard block
 block discarded – undo
111 111
 			/**
112 112
 			 * Repeatable Field Groups
113 113
 			 */
114
-			'form_field_options'    => apply_filters( 'give_forms_field_options', array(
114
+			'form_field_options'    => apply_filters('give_forms_field_options', array(
115 115
 				'id'        => 'form_field_options',
116
-				'title'     => __( 'Donation Options', 'give' ),
116
+				'title'     => __('Donation Options', 'give'),
117 117
 				'icon-html' => '<span class="give-icon give-icon-heart"></span>',
118
-				'fields'    => apply_filters( 'give_forms_donation_form_metabox_fields', array(
118
+				'fields'    => apply_filters('give_forms_donation_form_metabox_fields', array(
119 119
 					// Donation Option
120 120
 					array(
121
-						'name'        => __( 'Donation Option', 'give' ),
122
-						'description' => __( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ),
123
-						'id'          => $prefix . 'price_option',
121
+						'name'        => __('Donation Option', 'give'),
122
+						'description' => __('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
123
+						'id'          => $prefix.'price_option',
124 124
 						'type'        => 'radio_inline',
125 125
 						'default'     => 'set',
126
-						'options'     => apply_filters( 'give_forms_price_options', array(
127
-							'set'   => __( 'Set Donation', 'give' ),
128
-							'multi' => __( 'Multi-level Donation', 'give' ),
129
-						) ),
126
+						'options'     => apply_filters('give_forms_price_options', array(
127
+							'set'   => __('Set Donation', 'give'),
128
+							'multi' => __('Multi-level Donation', 'give'),
129
+						)),
130 130
 					),
131 131
 					array(
132
-						'name'        => __( 'Set Donation', 'give' ),
133
-						'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ),
134
-						'id'          => $prefix . 'set_price',
132
+						'name'        => __('Set Donation', 'give'),
133
+						'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'),
134
+						'id'          => $prefix.'set_price',
135 135
 						'type'        => 'text_small',
136 136
 						'data_type'   => 'price',
137 137
 						'attributes'  => array(
@@ -142,34 +142,34 @@  discard block
 block discarded – undo
142 142
 					),
143 143
 					// Display Style
144 144
 					array(
145
-						'name'          => __( 'Display Style', 'give' ),
146
-						'description'   => __( 'Set how the donations levels will display on the form.', 'give' ),
147
-						'id'            => $prefix . 'display_style',
145
+						'name'          => __('Display Style', 'give'),
146
+						'description'   => __('Set how the donations levels will display on the form.', 'give'),
147
+						'id'            => $prefix.'display_style',
148 148
 						'type'          => 'radio_inline',
149 149
 						'default'       => 'buttons',
150 150
 						'options'       => array(
151
-							'buttons'  => __( 'Buttons', 'give' ),
152
-							'radios'   => __( 'Radios', 'give' ),
153
-							'dropdown' => __( 'Dropdown', 'give' ),
151
+							'buttons'  => __('Buttons', 'give'),
152
+							'radios'   => __('Radios', 'give'),
153
+							'dropdown' => __('Dropdown', 'give'),
154 154
 						),
155 155
 						'wrapper_class' => 'give-hidden',
156 156
 					),
157 157
 					// Custom Amount
158 158
 					array(
159
-						'name'        => __( 'Custom Amount', 'give' ),
160
-						'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ),
161
-						'id'          => $prefix . 'custom_amount',
159
+						'name'        => __('Custom Amount', 'give'),
160
+						'description' => __('Do you want the user to be able to input their own donation amount?', 'give'),
161
+						'id'          => $prefix.'custom_amount',
162 162
 						'type'        => 'radio_inline',
163 163
 						'default'     => 'disabled',
164 164
 						'options'     => array(
165
-							'enabled'  => __( 'Enabled', 'give' ),
166
-							'disabled' => __( 'Disabled', 'give' ),
165
+							'enabled'  => __('Enabled', 'give'),
166
+							'disabled' => __('Disabled', 'give'),
167 167
 						),
168 168
 					),
169 169
 					array(
170
-						'name'          => __( 'Minimum Amount', 'give' ),
171
-						'description'   => __( 'Enter the minimum custom donation amount.', 'give' ),
172
-						'id'            => $prefix . 'custom_amount_minimum',
170
+						'name'          => __('Minimum Amount', 'give'),
171
+						'description'   => __('Enter the minimum custom donation amount.', 'give'),
172
+						'id'            => $prefix.'custom_amount_minimum',
173 173
 						'type'          => 'text_small',
174 174
 						'data_type'     => 'price',
175 175
 						'attributes'    => array(
@@ -180,37 +180,37 @@  discard block
 block discarded – undo
180 180
 						'wrapper_class' => 'give-hidden',
181 181
 					),
182 182
 					array(
183
-						'name'          => __( 'Custom Amount Text', 'give' ),
184
-						'description'   => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ),
185
-						'id'            => $prefix . 'custom_amount_text',
183
+						'name'          => __('Custom Amount Text', 'give'),
184
+						'description'   => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'),
185
+						'id'            => $prefix.'custom_amount_text',
186 186
 						'type'          => 'text_medium',
187 187
 						'attributes'    => array(
188 188
 							'rows'        => 3,
189
-							'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ),
189
+							'placeholder' => esc_attr__('Give a Custom Amount', 'give'),
190 190
 						),
191 191
 						'wrapper_class' => 'give-hidden',
192 192
 					),
193 193
 					// Donation Levels: Repeatable CMB2 Group
194 194
 					array(
195
-						'id'            => $prefix . 'donation_levels',
195
+						'id'            => $prefix.'donation_levels',
196 196
 						'type'          => 'group',
197 197
 						'options'       => array(
198
-							'add_button'    => __( 'Add Level', 'give' ),
199
-							'header_title'  => __( 'Donation Level', 'give' ),
198
+							'add_button'    => __('Add Level', 'give'),
199
+							'header_title'  => __('Donation Level', 'give'),
200 200
 							'remove_button' => '<span class="dashicons dashicons-no"></span>',
201 201
 						),
202 202
 						'wrapper_class' => 'give-hidden',
203 203
 						// Fields array works the same, except id's only need to be unique for this group.
204 204
 						// Prefix is not needed.
205
-						'fields'        => apply_filters( 'give_donation_levels_table_row', array(
205
+						'fields'        => apply_filters('give_donation_levels_table_row', array(
206 206
 							array(
207
-								'name' => __( 'ID', 'give' ),
208
-								'id'   => $prefix . 'id',
207
+								'name' => __('ID', 'give'),
208
+								'id'   => $prefix.'id',
209 209
 								'type' => 'levels_id',
210 210
 							),
211 211
 							array(
212
-								'name'       => __( 'Amount', 'give' ),
213
-								'id'         => $prefix . 'amount',
212
+								'name'       => __('Amount', 'give'),
213
+								'id'         => $prefix.'amount',
214 214
 								'type'       => 'text_small',
215 215
 								'data_type'  => 'price',
216 216
 								'attributes' => array(
@@ -219,112 +219,112 @@  discard block
 block discarded – undo
219 219
 								),
220 220
 							),
221 221
 							array(
222
-								'name'       => __( 'Text', 'give' ),
223
-								'id'         => $prefix . 'text',
222
+								'name'       => __('Text', 'give'),
223
+								'id'         => $prefix.'text',
224 224
 								'type'       => 'text',
225 225
 								'attributes' => array(
226
-									'placeholder' => __( 'Donation Level', 'give' ),
226
+									'placeholder' => __('Donation Level', 'give'),
227 227
 									'class'       => 'give-multilevel-text-field',
228 228
 								),
229 229
 							),
230 230
 							array(
231
-								'name' => __( 'Default', 'give' ),
232
-								'id'   => $prefix . 'default',
231
+								'name' => __('Default', 'give'),
232
+								'id'   => $prefix.'default',
233 233
 								'type' => 'give_default_radio_inline',
234 234
 							),
235
-						) ),
235
+						)),
236 236
 					),
237 237
 					array(
238 238
 						'name'  => 'donation_options_docs',
239 239
 						'type'  => 'docs_link',
240 240
 						'url'   => 'http://docs.givewp.com/form-donation-options',
241
-						'title' => __( 'Donation Options', 'give' ),
241
+						'title' => __('Donation Options', 'give'),
242 242
 					),
243 243
 				),
244 244
 					$post_id
245 245
 				),
246
-			) ),
246
+			)),
247 247
 
248 248
 			/**
249 249
 			 * Display Options
250 250
 			 */
251
-			'form_display_options'  => apply_filters( 'give_form_display_options', array(
251
+			'form_display_options'  => apply_filters('give_form_display_options', array(
252 252
 					'id'        => 'form_display_options',
253
-					'title'     => __( 'Form Display', 'give' ),
253
+					'title'     => __('Form Display', 'give'),
254 254
 					'icon-html' => '<span class="give-icon give-icon-display"></span>',
255
-					'fields'    => apply_filters( 'give_forms_display_options_metabox_fields', array(
255
+					'fields'    => apply_filters('give_forms_display_options_metabox_fields', array(
256 256
 						array(
257
-							'name'    => __( 'Display Options', 'give' ),
258
-							'desc'    => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ),
259
-							'id'      => $prefix . 'payment_display',
257
+							'name'    => __('Display Options', 'give'),
258
+							'desc'    => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'),
259
+							'id'      => $prefix.'payment_display',
260 260
 							'type'    => 'radio_inline',
261 261
 							'options' => array(
262
-								'onpage' => __( 'All Fields', 'give' ),
263
-								'modal'  => __( 'Modal', 'give' ),
264
-								'reveal' => __( 'Reveal', 'give' ),
265
-								'button' => __( 'Button', 'give' ),
262
+								'onpage' => __('All Fields', 'give'),
263
+								'modal'  => __('Modal', 'give'),
264
+								'reveal' => __('Reveal', 'give'),
265
+								'button' => __('Button', 'give'),
266 266
 							),
267 267
 							'default' => 'onpage',
268 268
 						),
269 269
 						array(
270
-							'id'            => $prefix . 'reveal_label',
271
-							'name'          => __( 'Continue Button', 'give' ),
272
-							'desc'          => __( 'The button label for displaying the additional payment fields.', 'give' ),
270
+							'id'            => $prefix.'reveal_label',
271
+							'name'          => __('Continue Button', 'give'),
272
+							'desc'          => __('The button label for displaying the additional payment fields.', 'give'),
273 273
 							'type'          => 'text_small',
274 274
 							'attributes'    => array(
275
-								'placeholder' => esc_attr__( 'Donate Now', 'give' ),
275
+								'placeholder' => esc_attr__('Donate Now', 'give'),
276 276
 							),
277 277
 							'wrapper_class' => 'give-hidden',
278 278
 						),
279 279
 						array(
280
-							'id'         => $prefix . 'checkout_label',
281
-							'name'       => __( 'Submit Button', 'give' ),
282
-							'desc'       => __( 'The button label for completing a donation.', 'give' ),
280
+							'id'         => $prefix.'checkout_label',
281
+							'name'       => __('Submit Button', 'give'),
282
+							'desc'       => __('The button label for completing a donation.', 'give'),
283 283
 							'type'       => 'text_small',
284 284
 							'attributes' => array(
285
-								'placeholder' => __( 'Donate Now', 'give' ),
285
+								'placeholder' => __('Donate Now', 'give'),
286 286
 							),
287 287
 						),
288 288
 						array(
289
-							'name' => __( 'Default Gateway', 'give' ),
290
-							'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ),
291
-							'id'   => $prefix . 'default_gateway',
289
+							'name' => __('Default Gateway', 'give'),
290
+							'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
291
+							'id'   => $prefix.'default_gateway',
292 292
 							'type' => 'default_gateway',
293 293
 						),
294 294
 						array(
295
-							'name'    => __( 'Guest Donations', 'give' ),
296
-							'desc'    => __( 'Do you want to allow non-logged-in users to make donations?', 'give' ),
297
-							'id'      => $prefix . 'logged_in_only',
295
+							'name'    => __('Guest Donations', 'give'),
296
+							'desc'    => __('Do you want to allow non-logged-in users to make donations?', 'give'),
297
+							'id'      => $prefix.'logged_in_only',
298 298
 							'type'    => 'radio_inline',
299 299
 							'default' => 'enabled',
300 300
 							'options' => array(
301
-								'enabled'  => __( 'Enabled', 'give' ),
302
-								'disabled' => __( 'Disabled', 'give' ),
301
+								'enabled'  => __('Enabled', 'give'),
302
+								'disabled' => __('Disabled', 'give'),
303 303
 							),
304 304
 						),
305 305
 						array(
306
-							'name'    => __( 'Registration', 'give' ),
307
-							'desc'    => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ),
308
-							'id'      => $prefix . 'show_register_form',
306
+							'name'    => __('Registration', 'give'),
307
+							'desc'    => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
308
+							'id'      => $prefix.'show_register_form',
309 309
 							'type'    => 'radio',
310 310
 							'options' => array(
311
-								'none'         => __( 'None', 'give' ),
312
-								'registration' => __( 'Registration', 'give' ),
313
-								'login'        => __( 'Login', 'give' ),
314
-								'both'         => __( 'Registration + Login', 'give' ),
311
+								'none'         => __('None', 'give'),
312
+								'registration' => __('Registration', 'give'),
313
+								'login'        => __('Login', 'give'),
314
+								'both'         => __('Registration + Login', 'give'),
315 315
 							),
316 316
 							'default' => 'none',
317 317
 						),
318 318
 						array(
319
-							'name'    => __( 'Floating Labels', 'give' ),
319
+							'name'    => __('Floating Labels', 'give'),
320 320
 							/* translators: %s: forms http://docs.givewp.com/form-floating-labels */
321
-							'desc'    => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ),
322
-							'id'      => $prefix . 'form_floating_labels',
321
+							'desc'    => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')),
322
+							'id'      => $prefix.'form_floating_labels',
323 323
 							'type'    => 'radio_inline',
324 324
 							'options' => array(
325
-								'global'   => __( 'Global Option', 'give' ),
326
-								'enabled'  => __( 'Enabled', 'give' ),
327
-								'disabled' => __( 'Disabled', 'give' ),
325
+								'global'   => __('Global Option', 'give'),
326
+								'enabled'  => __('Enabled', 'give'),
327
+								'disabled' => __('Disabled', 'give'),
328 328
 							),
329 329
 							'default' => 'global',
330 330
 						),
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 							'name'  => 'form_display_docs',
333 333
 							'type'  => 'docs_link',
334 334
 							'url'   => 'http://docs.givewp.com/form-display-options',
335
-							'title' => __( 'Form Display', 'give' ),
335
+							'title' => __('Form Display', 'give'),
336 336
 						),
337 337
 					),
338 338
 						$post_id
@@ -343,31 +343,31 @@  discard block
 block discarded – undo
343 343
 			/**
344 344
 			 * Donation Goals
345 345
 			 */
346
-			'donation_goal_options' => apply_filters( 'give_donation_goal_options', array(
346
+			'donation_goal_options' => apply_filters('give_donation_goal_options', array(
347 347
 				'id'        => 'donation_goal_options',
348
-				'title'     => __( 'Donation Goal', 'give' ),
348
+				'title'     => __('Donation Goal', 'give'),
349 349
 				'icon-html' => '<span class="give-icon give-icon-target"></span>',
350
-				'fields'    => apply_filters( 'give_forms_donation_goal_metabox_fields', array(
350
+				'fields'    => apply_filters('give_forms_donation_goal_metabox_fields', array(
351 351
 					// Goals
352 352
 					array(
353
-						'name'        => __( 'Donation Goal', 'give' ),
354
-						'description' => __( 'Do you want to set a donation goal for this form?', 'give' ),
355
-						'id'          => $prefix . 'goal_option',
353
+						'name'        => __('Donation Goal', 'give'),
354
+						'description' => __('Do you want to set a donation goal for this form?', 'give'),
355
+						'id'          => $prefix.'goal_option',
356 356
 						'type'        => 'radio_inline',
357 357
 						'default'     => 'disabled',
358 358
 						'options'     => array(
359
-							'enabled'  => __( 'Enabled', 'give' ),
360
-							'disabled' => __( 'Disabled', 'give' ),
359
+							'enabled'  => __('Enabled', 'give'),
360
+							'disabled' => __('Disabled', 'give'),
361 361
 						),
362 362
 					),
363 363
 					array(
364
-						'name'          => __( 'Goal Amount', 'give' ),
365
-						'description'   => __( 'This is the monetary goal amount you want to reach for this form.', 'give' ),
366
-						'id'            => $prefix . 'set_goal',
364
+						'name'          => __('Goal Amount', 'give'),
365
+						'description'   => __('This is the monetary goal amount you want to reach for this form.', 'give'),
366
+						'id'            => $prefix.'set_goal',
367 367
 						'type'          => 'text_small',
368 368
 						'data_type'     => 'price',
369 369
 						'attributes'    => array(
370
-							'placeholder' => give_format_decimal( '0.00', false, false ),
370
+							'placeholder' => give_format_decimal('0.00', false, false),
371 371
 							'value'       => $goal,
372 372
 							'class'       => 'give-money-field',
373 373
 						),
@@ -375,97 +375,97 @@  discard block
 block discarded – undo
375 375
 					),
376 376
 
377 377
 					array(
378
-						'name'          => __( 'Goal Format', 'give' ),
379
-						'description'   => __( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ),
380
-						'id'            => $prefix . 'goal_format',
378
+						'name'          => __('Goal Format', 'give'),
379
+						'description'   => __('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'),
380
+						'id'            => $prefix.'goal_format',
381 381
 						'type'          => 'radio_inline',
382 382
 						'default'       => 'amount',
383 383
 						'options'       => array(
384
-							'amount'     => __( 'Amount', 'give' ),
385
-							'percentage' => __( 'Percentage', 'give' ),
384
+							'amount'     => __('Amount', 'give'),
385
+							'percentage' => __('Percentage', 'give'),
386 386
 						),
387 387
 						'wrapper_class' => 'give-hidden',
388 388
 					),
389 389
 					array(
390
-						'name'          => __( 'Progress Bar Color', 'give' ),
391
-						'desc'          => __( 'Customize the color of the goal progress bar.', 'give' ),
392
-						'id'            => $prefix . 'goal_color',
390
+						'name'          => __('Progress Bar Color', 'give'),
391
+						'desc'          => __('Customize the color of the goal progress bar.', 'give'),
392
+						'id'            => $prefix.'goal_color',
393 393
 						'type'          => 'colorpicker',
394 394
 						'default'       => '#2bc253',
395 395
 						'wrapper_class' => 'give-hidden',
396 396
 					),
397 397
 
398 398
 					array(
399
-						'name'          => __( 'Close Form', 'give' ),
400
-						'desc'          => __( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ),
401
-						'id'            => $prefix . 'close_form_when_goal_achieved',
399
+						'name'          => __('Close Form', 'give'),
400
+						'desc'          => __('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
401
+						'id'            => $prefix.'close_form_when_goal_achieved',
402 402
 						'type'          => 'radio_inline',
403 403
 						'default'       => 'disabled',
404 404
 						'options'       => array(
405
-							'enabled'  => __( 'Enabled', 'give' ),
406
-							'disabled' => __( 'Disabled', 'give' ),
405
+							'enabled'  => __('Enabled', 'give'),
406
+							'disabled' => __('Disabled', 'give'),
407 407
 						),
408 408
 						'wrapper_class' => 'give-hidden',
409 409
 					),
410 410
 					array(
411
-						'name'          => __( 'Goal Achieved Message', 'give' ),
412
-						'desc'          => __( 'Do you want to display a custom message when the goal is closed?', 'give' ),
413
-						'id'            => $prefix . 'form_goal_achieved_message',
411
+						'name'          => __('Goal Achieved Message', 'give'),
412
+						'desc'          => __('Do you want to display a custom message when the goal is closed?', 'give'),
413
+						'id'            => $prefix.'form_goal_achieved_message',
414 414
 						'type'          => 'wysiwyg',
415
-						'default'       => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
415
+						'default'       => __('Thank you to all our donors, we have met our fundraising goal.', 'give'),
416 416
 						'wrapper_class' => 'give-hidden',
417 417
 					),
418 418
 					array(
419 419
 						'name'  => 'donation_goal_docs',
420 420
 						'type'  => 'docs_link',
421 421
 						'url'   => 'http://docs.givewp.com/form-donation-goal',
422
-						'title' => __( 'Donation Goal', 'give' ),
422
+						'title' => __('Donation Goal', 'give'),
423 423
 					),
424 424
 				),
425 425
 					$post_id
426 426
 				),
427
-			) ),
427
+			)),
428 428
 
429 429
 			/**
430 430
 			 * Content Field
431 431
 			 */
432
-			'form_content_options'  => apply_filters( 'give_forms_content_options', array(
432
+			'form_content_options'  => apply_filters('give_forms_content_options', array(
433 433
 				'id'        => 'form_content_options',
434
-				'title'     => __( 'Form Content', 'give' ),
434
+				'title'     => __('Form Content', 'give'),
435 435
 				'icon-html' => '<span class="give-icon give-icon-edit"></span>',
436
-				'fields'    => apply_filters( 'give_forms_content_options_metabox_fields', array(
436
+				'fields'    => apply_filters('give_forms_content_options_metabox_fields', array(
437 437
 
438 438
 					// Donation content.
439 439
 					array(
440
-						'name'        => __( 'Display Content', 'give' ),
441
-						'description' => __( 'Do you want to add custom content to this form?', 'give' ),
442
-						'id'          => $prefix . 'display_content',
440
+						'name'        => __('Display Content', 'give'),
441
+						'description' => __('Do you want to add custom content to this form?', 'give'),
442
+						'id'          => $prefix.'display_content',
443 443
 						'type'        => 'radio_inline',
444 444
 						'options'     => array(
445
-							'enabled'  => __( 'Enabled', 'give' ),
446
-							'disabled' => __( 'Disabled', 'give' ),
445
+							'enabled'  => __('Enabled', 'give'),
446
+							'disabled' => __('Disabled', 'give'),
447 447
 						),
448 448
 						'default'     => 'disabled',
449 449
 					),
450 450
 
451 451
 					// Content placement.
452 452
 					array(
453
-						'name'          => __( 'Content Placement', 'give' ),
454
-						'description'   => __( 'This option controls where the content appears within the donation form.', 'give' ),
455
-						'id'            => $prefix . 'content_placement',
453
+						'name'          => __('Content Placement', 'give'),
454
+						'description'   => __('This option controls where the content appears within the donation form.', 'give'),
455
+						'id'            => $prefix.'content_placement',
456 456
 						'type'          => 'radio_inline',
457
-						'options'       => apply_filters( 'give_forms_content_options_select', array(
458
-								'give_pre_form'  => __( 'Above fields', 'give' ),
459
-								'give_post_form' => __( 'Below fields', 'give' ),
457
+						'options'       => apply_filters('give_forms_content_options_select', array(
458
+								'give_pre_form'  => __('Above fields', 'give'),
459
+								'give_post_form' => __('Below fields', 'give'),
460 460
 							)
461 461
 						),
462 462
 						'default'       => 'give_pre_form',
463 463
 						'wrapper_class' => 'give-hidden',
464 464
 					),
465 465
 					array(
466
-						'name'          => __( 'Content', 'give' ),
467
-						'description'   => __( 'This content will display on the single give form page.', 'give' ),
468
-						'id'            => $prefix . 'form_content',
466
+						'name'          => __('Content', 'give'),
467
+						'description'   => __('This content will display on the single give form page.', 'give'),
468
+						'id'            => $prefix.'form_content',
469 469
 						'type'          => 'wysiwyg',
470 470
 						'wrapper_class' => 'give-hidden',
471 471
 					),
@@ -473,51 +473,51 @@  discard block
 block discarded – undo
473 473
 						'name'  => 'form_content_docs',
474 474
 						'type'  => 'docs_link',
475 475
 						'url'   => 'http://docs.givewp.com/form-content',
476
-						'title' => __( 'Form Content', 'give' ),
476
+						'title' => __('Form Content', 'give'),
477 477
 					),
478 478
 				),
479 479
 					$post_id
480 480
 				),
481
-			) ),
481
+			)),
482 482
 
483 483
 			/**
484 484
 			 * Terms & Conditions
485 485
 			 */
486
-			'form_terms_options'    => apply_filters( 'give_forms_terms_options', array(
486
+			'form_terms_options'    => apply_filters('give_forms_terms_options', array(
487 487
 				'id'        => 'form_terms_options',
488
-				'title'     => __( 'Terms & Conditions', 'give' ),
488
+				'title'     => __('Terms & Conditions', 'give'),
489 489
 				'icon-html' => '<span class="give-icon give-icon-checklist"></span>',
490
-				'fields'    => apply_filters( 'give_forms_terms_options_metabox_fields', array(
490
+				'fields'    => apply_filters('give_forms_terms_options_metabox_fields', array(
491 491
 					// Donation Option
492 492
 					array(
493
-						'name'        => __( 'Terms and Conditions', 'give' ),
494
-						'description' => __( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ),
495
-						'id'          => $prefix . 'terms_option',
493
+						'name'        => __('Terms and Conditions', 'give'),
494
+						'description' => __('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'),
495
+						'id'          => $prefix.'terms_option',
496 496
 						'type'        => 'radio_inline',
497
-						'options'     => apply_filters( 'give_forms_content_options_select', array(
498
-								'global'   => __( 'Global Option', 'give' ),
499
-								'enabled'  => __( 'Customize', 'give' ),
500
-								'disabled' => __( 'Disable', 'give' ),
497
+						'options'     => apply_filters('give_forms_content_options_select', array(
498
+								'global'   => __('Global Option', 'give'),
499
+								'enabled'  => __('Customize', 'give'),
500
+								'disabled' => __('Disable', 'give'),
501 501
 							)
502 502
 						),
503 503
 						'default'     => 'global',
504 504
 					),
505 505
 					array(
506
-						'id'            => $prefix . 'agree_label',
507
-						'name'          => __( 'Agreement Label', 'give' ),
508
-						'desc'          => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ),
506
+						'id'            => $prefix.'agree_label',
507
+						'name'          => __('Agreement Label', 'give'),
508
+						'desc'          => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
509 509
 						'type'          => 'text',
510 510
 						'size'          => 'regular',
511 511
 						'attributes'    => array(
512
-							'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ),
512
+							'placeholder' => esc_attr__('Agree to Terms?', 'give'),
513 513
 						),
514 514
 						'wrapper_class' => 'give-hidden',
515 515
 					),
516 516
 					array(
517
-						'id'            => $prefix . 'agree_text',
518
-						'name'          => __( 'Agreement Text', 'give' ),
519
-						'desc'          => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ),
520
-						'default'       => give_get_option( 'agreement_text' ),
517
+						'id'            => $prefix.'agree_text',
518
+						'name'          => __('Agreement Text', 'give'),
519
+						'desc'          => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
520
+						'default'       => give_get_option('agreement_text'),
521 521
 						'type'          => 'wysiwyg',
522 522
 						'wrapper_class' => 'give-hidden',
523 523
 					),
@@ -525,18 +525,18 @@  discard block
 block discarded – undo
525 525
 						'name'  => 'terms_docs',
526 526
 						'type'  => 'docs_link',
527 527
 						'url'   => 'http://docs.givewp.com/form-terms',
528
-						'title' => __( 'Terms and Conditions', 'give' ),
528
+						'title' => __('Terms and Conditions', 'give'),
529 529
 					),
530 530
 				),
531 531
 					$post_id
532 532
 				),
533
-			) ),
533
+			)),
534 534
 		);
535 535
 
536 536
 		/**
537 537
 		 * Filter the metabox tabbed panel settings.
538 538
 		 */
539
-		$settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id );
539
+		$settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id);
540 540
 
541 541
 		// Output.
542 542
 		return $settings;
@@ -552,8 +552,8 @@  discard block
 block discarded – undo
552 552
 		add_meta_box(
553 553
 			$this->get_metabox_ID(),
554 554
 			$this->get_metabox_label(),
555
-			array( $this, 'output' ),
556
-			array( 'give_forms' ),
555
+			array($this, 'output'),
556
+			array('give_forms'),
557 557
 			'normal',
558 558
 			'high'
559 559
 		);
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 	function enqueue_script() {
570 570
 		global $post;
571 571
 
572
-		if ( is_object( $post ) && 'give_forms' === $post->post_type ) {
572
+		if (is_object($post) && 'give_forms' === $post->post_type) {
573 573
 
574 574
 		}
575 575
 	}
@@ -604,32 +604,32 @@  discard block
 block discarded – undo
604 604
 	public function get_tabs() {
605 605
 		$tabs = array();
606 606
 
607
-		if ( ! empty( $this->settings ) ) {
608
-			foreach ( $this->settings as $setting ) {
609
-				if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) {
607
+		if ( ! empty($this->settings)) {
608
+			foreach ($this->settings as $setting) {
609
+				if ( ! isset($setting['id']) || ! isset($setting['title'])) {
610 610
 					continue;
611 611
 				}
612 612
 				$tab = array(
613 613
 					'id'        => $setting['id'],
614 614
 					'label'     => $setting['title'],
615
-					'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ),
615
+					'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''),
616 616
 				);
617 617
 
618
-				if ( $this->has_sub_tab( $setting ) ) {
619
-					if ( empty( $setting['sub-fields'] ) ) {
618
+				if ($this->has_sub_tab($setting)) {
619
+					if (empty($setting['sub-fields'])) {
620 620
 						$tab = array();
621 621
 					} else {
622
-						foreach ( $setting['sub-fields'] as $sub_fields ) {
622
+						foreach ($setting['sub-fields'] as $sub_fields) {
623 623
 							$tab['sub-fields'][] = array(
624 624
 								'id'        => $sub_fields['id'],
625 625
 								'label'     => $sub_fields['title'],
626
-								'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ),
626
+								'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''),
627 627
 							);
628 628
 						}
629 629
 					}
630 630
 				}
631 631
 
632
-				if ( ! empty( $tab ) ) {
632
+				if ( ! empty($tab)) {
633 633
 					$tabs[] = $tab;
634 634
 				}
635 635
 			}
@@ -646,33 +646,33 @@  discard block
 block discarded – undo
646 646
 	 */
647 647
 	public function output() {
648 648
 		// Bailout.
649
-		if ( $form_data_tabs = $this->get_tabs() ) :
650
-			$active_tab = ! empty( $_GET['give_tab'] ) ? give_clean( $_GET['give_tab'] ) : 'form_field_options';
651
-			wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' );
649
+		if ($form_data_tabs = $this->get_tabs()) :
650
+			$active_tab = ! empty($_GET['give_tab']) ? give_clean($_GET['give_tab']) : 'form_field_options';
651
+			wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce');
652 652
 			?>
653 653
 			<input id="give_form_active_tab" type="hidden" name="give_form_active_tab">
654 654
 			<div class="give-metabox-panel-wrap">
655 655
 				<ul class="give-form-data-tabs give-metabox-tabs">
656
-					<?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?>
656
+					<?php foreach ($form_data_tabs as $index => $form_data_tab) : ?>
657 657
 						<?php
658 658
 						// Determine if current tab is active.
659 659
 						$is_active = $active_tab === $form_data_tab['id'] ? true : false;
660 660
 						?>
661
-						<li class="<?php echo "{$form_data_tab['id']}_tab" . ( $is_active ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>">
661
+						<li class="<?php echo "{$form_data_tab['id']}_tab".($is_active ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>">
662 662
 							<a href="#<?php echo $form_data_tab['id']; ?>" data-tab-id="<?php echo $form_data_tab['id']; ?>">
663
-								<?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?>
663
+								<?php if ( ! empty($form_data_tab['icon-html'])) : ?>
664 664
 									<?php echo $form_data_tab['icon-html']; ?>
665 665
 								<?php else : ?>
666 666
 									<span class="give-icon give-icon-default"></span>
667 667
 								<?php endif; ?>
668 668
 								<span class="give-label"><?php echo $form_data_tab['label']; ?></span>
669 669
 							</a>
670
-							<?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?>
670
+							<?php if ($this->has_sub_tab($form_data_tab)) : ?>
671 671
 								<ul class="give-metabox-sub-tabs give-hidden">
672
-									<?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?>
672
+									<?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?>
673 673
 										<li class="<?php echo "{$sub_tab['id']}_tab"; ?>">
674 674
 											<a href="#<?php echo $sub_tab['id']; ?>" data-tab-id="<?php echo $sub_tab['id']; ?>">
675
-												<?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?>
675
+												<?php if ( ! empty($sub_tab['icon-html'])) : ?>
676 676
 													<?php echo $sub_tab['icon-html']; ?>
677 677
 												<?php else : ?>
678 678
 													<span class="give-icon give-icon-default"></span>
@@ -687,30 +687,30 @@  discard block
 block discarded – undo
687 687
 					<?php endforeach; ?>
688 688
 				</ul>
689 689
 
690
-				<?php foreach ( $this->settings as $setting ) : ?>
691
-					<?php if ( ! $this->has_sub_tab( $setting ) ) : ?>
692
-						<?php do_action( "give_before_{$setting['id']}_settings" ); ?>
690
+				<?php foreach ($this->settings as $setting) : ?>
691
+					<?php if ( ! $this->has_sub_tab($setting)) : ?>
692
+						<?php do_action("give_before_{$setting['id']}_settings"); ?>
693 693
 						<?php
694 694
 						// Determine if current panel is active.
695 695
 						$is_active = $active_tab === $setting['id'] ? true : false;
696 696
 						?>
697
-						<div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo( $is_active ? ' active' : '' ); ?>">
698
-							<?php if ( ! empty( $setting['fields'] ) ) : ?>
699
-								<?php foreach ( $setting['fields'] as $field ) : ?>
700
-									<?php give_render_field( $field ); ?>
697
+						<div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo($is_active ? ' active' : ''); ?>">
698
+							<?php if ( ! empty($setting['fields'])) : ?>
699
+								<?php foreach ($setting['fields'] as $field) : ?>
700
+									<?php give_render_field($field); ?>
701 701
 								<?php endforeach; ?>
702 702
 							<?php endif; ?>
703 703
 						</div>
704 704
 
705
-						<?php do_action( "give_after_{$setting['id']}_settings" ); ?>
705
+						<?php do_action("give_after_{$setting['id']}_settings"); ?>
706 706
 					<?php else : ?>
707
-						<?php if ( $this->has_sub_tab( $setting ) ) : ?>
708
-							<?php if ( ! empty( $setting['sub-fields'] ) ) : ?>
709
-								<?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?>
707
+						<?php if ($this->has_sub_tab($setting)) : ?>
708
+							<?php if ( ! empty($setting['sub-fields'])) : ?>
709
+								<?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?>
710 710
 									<div id="<?php echo $sub_fields['id']; ?>" class="panel give_options_panel give-hidden">
711
-										<?php if ( ! empty( $sub_fields['fields'] ) ) : ?>
712
-											<?php foreach ( $sub_fields['fields'] as $sub_field ) : ?>
713
-												<?php give_render_field( $sub_field ); ?>
711
+										<?php if ( ! empty($sub_fields['fields'])) : ?>
712
+											<?php foreach ($sub_fields['fields'] as $sub_field) : ?>
713
+												<?php give_render_field($sub_field); ?>
714 714
 											<?php endforeach; ?>
715 715
 										<?php endif; ?>
716 716
 									</div>
@@ -734,9 +734,9 @@  discard block
 block discarded – undo
734 734
 	 *
735 735
 	 * @return bool
736 736
 	 */
737
-	private function has_sub_tab( $field_setting ) {
737
+	private function has_sub_tab($field_setting) {
738 738
 		$has_sub_tab = false;
739
-		if ( array_key_exists( 'sub-fields', $field_setting ) ) {
739
+		if (array_key_exists('sub-fields', $field_setting)) {
740 740
 			$has_sub_tab = true;
741 741
 		}
742 742
 
@@ -750,13 +750,13 @@  discard block
 block discarded – undo
750 750
 	 * @return array
751 751
 	 */
752 752
 	function cmb2_metabox_settings() {
753
-		$all_cmb2_settings   = apply_filters( 'cmb2_meta_boxes', array() );
753
+		$all_cmb2_settings   = apply_filters('cmb2_meta_boxes', array());
754 754
 		$give_forms_settings = $all_cmb2_settings;
755 755
 
756 756
 		// Filter settings: Use only give forms related settings.
757
-		foreach ( $all_cmb2_settings as $index => $setting ) {
758
-			if ( ! in_array( 'give_forms', $setting['object_types'] ) ) {
759
-				unset( $give_forms_settings[ $index ] );
757
+		foreach ($all_cmb2_settings as $index => $setting) {
758
+			if ( ! in_array('give_forms', $setting['object_types'])) {
759
+				unset($give_forms_settings[$index]);
760 760
 			}
761 761
 		}
762 762
 
@@ -774,96 +774,96 @@  discard block
 block discarded – undo
774 774
 	 *
775 775
 	 * @return void
776 776
 	 */
777
-	public function save( $post_id, $post ) {
777
+	public function save($post_id, $post) {
778 778
 
779 779
 		// $post_id and $post are required.
780
-		if ( empty( $post_id ) || empty( $post ) ) {
780
+		if (empty($post_id) || empty($post)) {
781 781
 			return;
782 782
 		}
783 783
 
784 784
 		// Don't save meta boxes for revisions or autosaves.
785
-		if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
785
+		if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
786 786
 			return;
787 787
 		}
788 788
 
789 789
 		// Check the nonce.
790
-		if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) {
790
+		if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) {
791 791
 			return;
792 792
 		}
793 793
 
794 794
 		// Check the post being saved == the $post_id to prevent triggering this call for other save_post events.
795
-		if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) {
795
+		if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) {
796 796
 			return;
797 797
 		}
798 798
 
799 799
 		// Check user has permission to edit.
800
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
800
+		if ( ! current_user_can('edit_post', $post_id)) {
801 801
 			return;
802 802
 		}
803 803
 
804 804
 		// Fire action before saving form meta.
805
-		do_action( 'give_pre_process_give_forms_meta', $post_id, $post );
805
+		do_action('give_pre_process_give_forms_meta', $post_id, $post);
806 806
 
807 807
 		/**
808 808
 		 * Filter the meta key to save.
809 809
 		 * Third party addon developer can remove there meta keys from this array to handle saving data on there own.
810 810
 		 */
811
-		$form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() );
811
+		$form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings());
812 812
 
813 813
 		// Save form meta data.
814
-		if ( ! empty( $form_meta_keys ) ) {
815
-			foreach ( $form_meta_keys as $form_meta_key ) {
814
+		if ( ! empty($form_meta_keys)) {
815
+			foreach ($form_meta_keys as $form_meta_key) {
816 816
 
817 817
 				// Set default value for checkbox fields.
818 818
 				if (
819
-					! isset( $_POST[ $form_meta_key ] )
820
-					&& ( 'checkbox' === $this->get_field_type( $form_meta_key ) )
819
+					! isset($_POST[$form_meta_key])
820
+					&& ('checkbox' === $this->get_field_type($form_meta_key))
821 821
 				) {
822
-					$_POST[ $form_meta_key ] = '';
822
+					$_POST[$form_meta_key] = '';
823 823
 				}
824 824
 
825
-				if ( isset( $_POST[ $form_meta_key ] ) ) {
826
-					$setting_field = $this->get_setting_field( $form_meta_key );
827
-					if ( ! empty( $setting_field['type'] ) ) {
828
-						switch ( $setting_field['type'] ) {
825
+				if (isset($_POST[$form_meta_key])) {
826
+					$setting_field = $this->get_setting_field($form_meta_key);
827
+					if ( ! empty($setting_field['type'])) {
828
+						switch ($setting_field['type']) {
829 829
 							case 'textarea':
830 830
 							case 'wysiwyg':
831
-								$form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] );
831
+								$form_meta_value = wp_kses_post($_POST[$form_meta_key]);
832 832
 								break;
833 833
 
834 834
 							case 'group':
835 835
 								$form_meta_value = array();
836 836
 
837
-								foreach ( $_POST[ $form_meta_key ] as $index => $group ) {
837
+								foreach ($_POST[$form_meta_key] as $index => $group) {
838 838
 
839 839
 									// Do not save template input field values.
840
-									if ( '{{row-count-placeholder}}' === $index ) {
840
+									if ('{{row-count-placeholder}}' === $index) {
841 841
 										continue;
842 842
 									}
843 843
 
844 844
 									$group_meta_value = array();
845
-									foreach ( $group as $field_id => $field_value ) {
846
-										switch ( $this->get_field_type( $field_id, $form_meta_key ) ) {
845
+									foreach ($group as $field_id => $field_value) {
846
+										switch ($this->get_field_type($field_id, $form_meta_key)) {
847 847
 											case 'wysiwyg':
848
-												$group_meta_value[ $field_id ] = wp_kses_post( $field_value );
848
+												$group_meta_value[$field_id] = wp_kses_post($field_value);
849 849
 												break;
850 850
 
851 851
 											default:
852
-												$group_meta_value[ $field_id ] = give_clean( $field_value );
852
+												$group_meta_value[$field_id] = give_clean($field_value);
853 853
 										}
854 854
 									}
855 855
 
856
-									if ( ! empty( $group_meta_value ) ) {
857
-										$form_meta_value[ $index ] = $group_meta_value;
856
+									if ( ! empty($group_meta_value)) {
857
+										$form_meta_value[$index] = $group_meta_value;
858 858
 									}
859 859
 								}
860 860
 
861 861
 								// Arrange repeater field keys in order.
862
-								$form_meta_value = array_values( $form_meta_value );
862
+								$form_meta_value = array_values($form_meta_value);
863 863
 								break;
864 864
 
865 865
 							default:
866
-								$form_meta_value = give_clean( $_POST[ $form_meta_key ] );
866
+								$form_meta_value = give_clean($_POST[$form_meta_key]);
867 867
 						}// End switch().
868 868
 
869 869
 						/**
@@ -873,24 +873,24 @@  discard block
 block discarded – undo
873 873
 						 */
874 874
 						$form_meta_value = apply_filters(
875 875
 							'give_pre_save_form_meta_value',
876
-							$this->sanitize_form_meta( $form_meta_value, $setting_field ),
876
+							$this->sanitize_form_meta($form_meta_value, $setting_field),
877 877
 							$form_meta_key,
878 878
 							$this,
879 879
 							$post_id
880 880
 						);
881 881
 
882 882
 						// Save data.
883
-						give_update_meta( $post_id, $form_meta_key, $form_meta_value );
883
+						give_update_meta($post_id, $form_meta_key, $form_meta_value);
884 884
 
885 885
 						// Fire after saving form meta key.
886
-						do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post );
886
+						do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post);
887 887
 					}// End if().
888 888
 				}// End if().
889 889
 			}// End foreach().
890 890
 		}// End if().
891 891
 
892 892
 		// Fire action after saving form meta.
893
-		do_action( 'give_post_process_give_forms_meta', $post_id, $post );
893
+		do_action('give_post_process_give_forms_meta', $post_id, $post);
894 894
 	}
895 895
 
896 896
 
@@ -903,10 +903,10 @@  discard block
 block discarded – undo
903 903
 	 *
904 904
 	 * @return string
905 905
 	 */
906
-	private function get_field_id( $field ) {
906
+	private function get_field_id($field) {
907 907
 		$field_id = '';
908 908
 
909
-		if ( array_key_exists( 'id', $field ) ) {
909
+		if (array_key_exists('id', $field)) {
910 910
 			$field_id = $field['id'];
911 911
 
912 912
 		}
@@ -923,12 +923,12 @@  discard block
 block discarded – undo
923 923
 	 *
924 924
 	 * @return array
925 925
 	 */
926
-	private function get_fields_id( $setting ) {
926
+	private function get_fields_id($setting) {
927 927
 		$meta_keys = array();
928 928
 
929
-		if ( ! empty( $setting ) ) {
930
-			foreach ( $setting['fields'] as $field ) {
931
-				if ( $field_id = $this->get_field_id( $field ) ) {
929
+		if ( ! empty($setting)) {
930
+			foreach ($setting['fields'] as $field) {
931
+				if ($field_id = $this->get_field_id($field)) {
932 932
 					$meta_keys[] = $field_id;
933 933
 				}
934 934
 			}
@@ -946,14 +946,14 @@  discard block
 block discarded – undo
946 946
 	 *
947 947
 	 * @return array
948 948
 	 */
949
-	private function get_sub_fields_id( $setting ) {
949
+	private function get_sub_fields_id($setting) {
950 950
 		$meta_keys = array();
951 951
 
952
-		if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) {
953
-			foreach ( $setting['sub-fields'] as $fields ) {
954
-				if ( ! empty( $fields['fields'] ) ) {
955
-					foreach ( $fields['fields'] as $field ) {
956
-						if ( $field_id = $this->get_field_id( $field ) ) {
952
+		if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) {
953
+			foreach ($setting['sub-fields'] as $fields) {
954
+				if ( ! empty($fields['fields'])) {
955
+					foreach ($fields['fields'] as $field) {
956
+						if ($field_id = $this->get_field_id($field)) {
957 957
 							$meta_keys[] = $field_id;
958 958
 						}
959 959
 					}
@@ -974,14 +974,14 @@  discard block
 block discarded – undo
974 974
 	private function get_meta_keys_from_settings() {
975 975
 		$meta_keys = array();
976 976
 
977
-		foreach ( $this->settings as $setting ) {
978
-			if ( $this->has_sub_tab( $setting ) ) {
979
-				$meta_key = $this->get_sub_fields_id( $setting );
977
+		foreach ($this->settings as $setting) {
978
+			if ($this->has_sub_tab($setting)) {
979
+				$meta_key = $this->get_sub_fields_id($setting);
980 980
 			} else {
981
-				$meta_key = $this->get_fields_id( $setting );
981
+				$meta_key = $this->get_fields_id($setting);
982 982
 			}
983 983
 
984
-			$meta_keys = array_merge( $meta_keys, $meta_key );
984
+			$meta_keys = array_merge($meta_keys, $meta_key);
985 985
 		}
986 986
 
987 987
 		return $meta_keys;
@@ -998,10 +998,10 @@  discard block
 block discarded – undo
998 998
 	 *
999 999
 	 * @return string
1000 1000
 	 */
1001
-	function get_field_type( $field_id, $group_id = '' ) {
1002
-		$field = $this->get_setting_field( $field_id, $group_id );
1001
+	function get_field_type($field_id, $group_id = '') {
1002
+		$field = $this->get_setting_field($field_id, $group_id);
1003 1003
 
1004
-		$type = array_key_exists( 'type', $field )
1004
+		$type = array_key_exists('type', $field)
1005 1005
 			? $field['type']
1006 1006
 			: '';
1007 1007
 
@@ -1019,12 +1019,12 @@  discard block
 block discarded – undo
1019 1019
 	 *
1020 1020
 	 * @return array
1021 1021
 	 */
1022
-	private function get_field( $setting, $field_id ) {
1022
+	private function get_field($setting, $field_id) {
1023 1023
 		$setting_field = array();
1024 1024
 
1025
-		if ( ! empty( $setting['fields'] ) ) {
1026
-			foreach ( $setting['fields'] as $field ) {
1027
-				if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) {
1025
+		if ( ! empty($setting['fields'])) {
1026
+			foreach ($setting['fields'] as $field) {
1027
+				if (array_key_exists('id', $field) && $field['id'] === $field_id) {
1028 1028
 					$setting_field = $field;
1029 1029
 					break;
1030 1030
 				}
@@ -1044,12 +1044,12 @@  discard block
 block discarded – undo
1044 1044
 	 *
1045 1045
 	 * @return array
1046 1046
 	 */
1047
-	private function get_sub_field( $setting, $field_id ) {
1047
+	private function get_sub_field($setting, $field_id) {
1048 1048
 		$setting_field = array();
1049 1049
 
1050
-		if ( ! empty( $setting['sub-fields'] ) ) {
1051
-			foreach ( $setting['sub-fields'] as $fields ) {
1052
-				if ( $field = $this->get_field( $fields, $field_id ) ) {
1050
+		if ( ! empty($setting['sub-fields'])) {
1051
+			foreach ($setting['sub-fields'] as $fields) {
1052
+				if ($field = $this->get_field($fields, $field_id)) {
1053 1053
 					$setting_field = $field;
1054 1054
 					break;
1055 1055
 				}
@@ -1069,17 +1069,17 @@  discard block
 block discarded – undo
1069 1069
 	 *
1070 1070
 	 * @return array
1071 1071
 	 */
1072
-	function get_setting_field( $field_id, $group_id = '' ) {
1072
+	function get_setting_field($field_id, $group_id = '') {
1073 1073
 		$setting_field = array();
1074 1074
 
1075 1075
 		$_field_id = $field_id;
1076
-		$field_id  = empty( $group_id ) ? $field_id : $group_id;
1076
+		$field_id  = empty($group_id) ? $field_id : $group_id;
1077 1077
 
1078
-		if ( ! empty( $this->settings ) ) {
1079
-			foreach ( $this->settings as $setting ) {
1078
+		if ( ! empty($this->settings)) {
1079
+			foreach ($this->settings as $setting) {
1080 1080
 				if (
1081
-					( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) )
1082
-					|| ( $setting_field = $this->get_field( $setting, $field_id ) )
1081
+					($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id)))
1082
+					|| ($setting_field = $this->get_field($setting, $field_id))
1083 1083
 				) {
1084 1084
 					break;
1085 1085
 				}
@@ -1087,9 +1087,9 @@  discard block
 block discarded – undo
1087 1087
 		}
1088 1088
 
1089 1089
 		// Get field from group.
1090
-		if ( ! empty( $group_id ) ) {
1091
-			foreach ( $setting_field['fields'] as $field ) {
1092
-				if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) {
1090
+		if ( ! empty($group_id)) {
1091
+			foreach ($setting_field['fields'] as $field) {
1092
+				if (array_key_exists('id', $field) && $field['id'] === $_field_id) {
1093 1093
 					$setting_field = $field;
1094 1094
 				}
1095 1095
 			}
@@ -1108,14 +1108,14 @@  discard block
 block discarded – undo
1108 1108
 	 *
1109 1109
 	 * @return mixed
1110 1110
 	 */
1111
-	function add_offline_donations_setting_tab( $settings ) {
1112
-		if ( give_is_gateway_active( 'offline' ) ) {
1113
-			$settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array(
1111
+	function add_offline_donations_setting_tab($settings) {
1112
+		if (give_is_gateway_active('offline')) {
1113
+			$settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array(
1114 1114
 				'id'        => 'offline_donations_options',
1115
-				'title'     => __( 'Offline Donations', 'give' ),
1115
+				'title'     => __('Offline Donations', 'give'),
1116 1116
 				'icon-html' => '<span class="give-icon give-icon-purse"></span>',
1117
-				'fields'    => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ),
1118
-			) );
1117
+				'fields'    => apply_filters('give_forms_offline_donations_metabox_fields', array()),
1118
+			));
1119 1119
 		}
1120 1120
 
1121 1121
 		return $settings;
@@ -1133,22 +1133,22 @@  discard block
 block discarded – undo
1133 1133
 	 *
1134 1134
 	 * @return mixed
1135 1135
 	 */
1136
-	function sanitize_form_meta( $meta_value, $setting_field ) {
1137
-		switch ( $setting_field['type'] ) {
1136
+	function sanitize_form_meta($meta_value, $setting_field) {
1137
+		switch ($setting_field['type']) {
1138 1138
 			case 'group':
1139
-				if ( ! empty( $setting_field['fields'] ) ) {
1140
-					foreach ( $setting_field['fields'] as $field ) {
1141
-						if ( empty( $field['data_type'] ) || 'price' !== $field['data_type'] ) {
1139
+				if ( ! empty($setting_field['fields'])) {
1140
+					foreach ($setting_field['fields'] as $field) {
1141
+						if (empty($field['data_type']) || 'price' !== $field['data_type']) {
1142 1142
 							continue;
1143 1143
 						}
1144 1144
 
1145
-						foreach ( $meta_value as $index => $meta_data ) {
1146
-							if ( ! isset( $meta_value[ $index ][ $field['id'] ] ) ) {
1145
+						foreach ($meta_value as $index => $meta_data) {
1146
+							if ( ! isset($meta_value[$index][$field['id']])) {
1147 1147
 								continue;
1148 1148
 							}
1149 1149
 
1150
-							$meta_value[ $index ][ $field['id'] ] = ! empty( $meta_value[ $index ][ $field['id'] ] )
1151
-								? give_sanitize_amount_for_db( $meta_value[ $index ][ $field['id'] ] )
1150
+							$meta_value[$index][$field['id']] = ! empty($meta_value[$index][$field['id']])
1151
+								? give_sanitize_amount_for_db($meta_value[$index][$field['id']])
1152 1152
 								: 0;
1153 1153
 						}
1154 1154
 					}
@@ -1156,8 +1156,8 @@  discard block
 block discarded – undo
1156 1156
 				break;
1157 1157
 
1158 1158
 			default:
1159
-				if ( ! empty( $setting_field['data_type'] ) && 'price' === $setting_field['data_type'] ) {
1160
-					$meta_value = $meta_value ? give_sanitize_amount_for_db( $meta_value ) : 0;
1159
+				if ( ! empty($setting_field['data_type']) && 'price' === $setting_field['data_type']) {
1160
+					$meta_value = $meta_value ? give_sanitize_amount_for_db($meta_value) : 0;
1161 1161
 				}
1162 1162
 		}
1163 1163
 
@@ -1175,12 +1175,12 @@  discard block
 block discarded – undo
1175 1175
 	 *
1176 1176
 	 * @return string The URL after redirect.
1177 1177
 	 */
1178
-	public function maintain_active_tab( $location, $post_id ) {
1178
+	public function maintain_active_tab($location, $post_id) {
1179 1179
 		if (
1180
-			'give_forms' === get_post_type( $post_id ) &&
1181
-			! empty( $_POST['give_form_active_tab'] )
1180
+			'give_forms' === get_post_type($post_id) &&
1181
+			! empty($_POST['give_form_active_tab'])
1182 1182
 		) {
1183
-			$location = add_query_arg( 'give_tab', give_clean( $_POST['give_form_active_tab'] ), $location );
1183
+			$location = add_query_arg('give_tab', give_clean($_POST['give_form_active_tab']), $location);
1184 1184
 		}
1185 1185
 
1186 1186
 		return $location;
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -662,9 +662,12 @@  discard block
 block discarded – undo
662 662
 							<a href="#<?php echo $form_data_tab['id']; ?>" data-tab-id="<?php echo $form_data_tab['id']; ?>">
663 663
 								<?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?>
664 664
 									<?php echo $form_data_tab['icon-html']; ?>
665
-								<?php else : ?>
665
+								<?php else {
666
+	: ?>
666 667
 									<span class="give-icon give-icon-default"></span>
667
-								<?php endif; ?>
668
+								<?php endif;
669
+}
670
+?>
668 671
 								<span class="give-label"><?php echo $form_data_tab['label']; ?></span>
669 672
 							</a>
670 673
 							<?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?>
@@ -674,9 +677,12 @@  discard block
 block discarded – undo
674 677
 											<a href="#<?php echo $sub_tab['id']; ?>" data-tab-id="<?php echo $sub_tab['id']; ?>">
675 678
 												<?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?>
676 679
 													<?php echo $sub_tab['icon-html']; ?>
677
-												<?php else : ?>
680
+												<?php else {
681
+	: ?>
678 682
 													<span class="give-icon give-icon-default"></span>
679
-												<?php endif; ?>
683
+												<?php endif;
684
+}
685
+?>
680 686
 												<span class="give-label"><?php echo $sub_tab['label']; ?></span>
681 687
 											</a>
682 688
 										</li>
@@ -703,11 +709,14 @@  discard block
 block discarded – undo
703 709
 						</div>
704 710
 
705 711
 						<?php do_action( "give_after_{$setting['id']}_settings" ); ?>
706
-					<?php else : ?>
712
+					<?php else {
713
+	: ?>
707 714
 						<?php if ( $this->has_sub_tab( $setting ) ) : ?>
708 715
 							<?php if ( ! empty( $setting['sub-fields'] ) ) : ?>
709 716
 								<?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?>
710
-									<div id="<?php echo $sub_fields['id']; ?>" class="panel give_options_panel give-hidden">
717
+									<div id="<?php echo $sub_fields['id'];
718
+}
719
+?>" class="panel give_options_panel give-hidden">
711 720
 										<?php if ( ! empty( $sub_fields['fields'] ) ) : ?>
712 721
 											<?php foreach ( $sub_fields['fields'] as $sub_field ) : ?>
713 722
 												<?php give_render_field( $sub_field ); ?>
Please login to merge, or discard this patch.
includes/admin/class-blank-slate.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.8.13
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -75,63 +75,63 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function init() {
77 77
 		// Bail early if screen cannot be detected.
78
-		if ( empty( $this->screen ) ) {
78
+		if (empty($this->screen)) {
79 79
 			return null;
80 80
 		}
81 81
 
82 82
 		$content = array();
83 83
 
84 84
 		// Define content and hook into the appropriate action.
85
-		switch ( $this->screen ) {
85
+		switch ($this->screen) {
86 86
 			// Forms screen.
87 87
 			case 'edit-give_forms':
88
-				$this->form = $this->post_exists( 'give_forms' );
88
+				$this->form = $this->post_exists('give_forms');
89 89
 
90
-				if ( $this->form ) {
90
+				if ($this->form) {
91 91
 					// Form exists. Bail out.
92 92
 					return false;
93 93
 				} else {
94 94
 					// No forms exist.
95
-					$content = $this->get_content( 'no_forms' );
95
+					$content = $this->get_content('no_forms');
96 96
 				}
97 97
 
98
-				add_action( 'manage_posts_extra_tablenav', array( $this, 'render' ) );
98
+				add_action('manage_posts_extra_tablenav', array($this, 'render'));
99 99
 				break;
100 100
 			// Donations screen.
101 101
 			case 'give_forms_page_give-payment-history':
102
-				$this->form     = $this->post_exists( 'give_forms' );
103
-				$this->donation = $this->post_exists( 'give_payment' );
102
+				$this->form     = $this->post_exists('give_forms');
103
+				$this->donation = $this->post_exists('give_payment');
104 104
 
105
-				if ( $this->donation ) {
105
+				if ($this->donation) {
106 106
 					// Donation exists. Bail out.
107 107
 					return false;
108
-				} elseif ( ! $this->form ) {
108
+				} elseif ( ! $this->form) {
109 109
 					// No forms and no donations exist.
110
-					$content = $this->get_content( 'no_donations_or_forms' );
110
+					$content = $this->get_content('no_donations_or_forms');
111 111
 				} else {
112 112
 					// No donations exist but a form does exist.
113
-					$content = $this->get_content( 'no_donations' );
113
+					$content = $this->get_content('no_donations');
114 114
 				}
115 115
 
116
-				add_action( 'give_payments_page_bottom', array( $this, 'render' ) );
116
+				add_action('give_payments_page_bottom', array($this, 'render'));
117 117
 				break;
118 118
 			// Donors screen.
119 119
 			case 'give_forms_page_give-donors':
120
-				$this->form  = $this->post_exists( 'give_forms' );
120
+				$this->form  = $this->post_exists('give_forms');
121 121
 				$this->donor = $this->donor_exists();
122 122
 
123
-				if ( $this->donor ) {
123
+				if ($this->donor) {
124 124
 					// Donor exists. Bail out.
125 125
 					return false;
126
-				} elseif ( ! $this->form ) {
126
+				} elseif ( ! $this->form) {
127 127
 					// No forms and no donors exist.
128
-					$content = $this->get_content( 'no_donors_or_forms' );
128
+					$content = $this->get_content('no_donors_or_forms');
129 129
 				} else {
130 130
 					// No donors exist but a form does exist.
131
-					$content = $this->get_content( 'no_donors' );
131
+					$content = $this->get_content('no_donors');
132 132
 				}
133 133
 
134
-				add_action( 'give_donors_table_bottom', array( $this, 'render' ) );
134
+				add_action('give_donors_table_bottom', array($this, 'render'));
135 135
 				break;
136 136
 			default:
137 137
 				return null;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		$this->content = $content;
141 141
 
142 142
 		// Hide non-essential UI elements.
143
-		add_action( 'admin_head', array( $this, 'hide_ui' ) );
143
+		add_action('admin_head', array($this, 'hide_ui'));
144 144
 	}
145 145
 
146 146
 	/**
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @param string $which The location of the list table hook: 'top' or 'bottom'.
152 152
 	 */
153
-	public function render( $which = 'bottom') {
153
+	public function render($which = 'bottom') {
154 154
 		// Bail out to prevent content from rendering twice.
155
-		if ( 'top' === $which ) {
155
+		if ('top' === $which) {
156 156
 			return null;
157 157
 		}
158 158
 
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 		 *
178 178
 		 * @param string $screen The current screen ID.
179 179
 		 */
180
-		$content = apply_filters( 'give_blank_slate_content', $this->content, $screen );
180
+		$content = apply_filters('give_blank_slate_content', $this->content, $screen);
181 181
 
182
-		$template_path = GIVE_PLUGIN_DIR . 'includes/admin/views/blank-slate.php';
182
+		$template_path = GIVE_PLUGIN_DIR.'includes/admin/views/blank-slate.php';
183 183
 
184 184
 		include $template_path;
185 185
 	}
@@ -201,17 +201,17 @@  discard block
 block discarded – undo
201 201
 	 * @param string $post_type Post type used in the query.
202 202
 	 * @return bool True if post exists, otherwise false.
203 203
 	 */
204
-	private function post_exists( $post_type ) {
204
+	private function post_exists($post_type) {
205 205
 		// Attempt to get a single post of the post type.
206
-		$query = new WP_Query( array(
206
+		$query = new WP_Query(array(
207 207
 			'post_type'              => $post_type,
208 208
 			'posts_per_page'         => 1,
209 209
 			'no_found_rows'          => false,
210 210
 			'update_post_meta_cache' => false,
211 211
 			'update_post_term_cache' => false,
212 212
 			'fields'                 => 'ids',
213
-			'post_status'            => array( 'any', 'trash' ),
214
-		) );
213
+			'post_status'            => array('any', 'trash'),
214
+		));
215 215
 
216 216
 		return $query->have_posts();
217 217
 	}
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
 	 * @return bool True if donor exists, otherwise false.
225 225
 	 */
226 226
 	private function donor_exists() {
227
-		$donors = Give()->donors->get_donors( array( 'number' => 1 ) );
227
+		$donors = Give()->donors->get_donors(array('number' => 1));
228 228
 
229
-		return ! empty( $donors );
229
+		return ! empty($donors);
230 230
 	}
231 231
 
232 232
 	/**
@@ -237,17 +237,17 @@  discard block
 block discarded – undo
237 237
 	 * @param string $context The key used to determine which content is returned.
238 238
 	 * @return array Blank slate content.
239 239
 	 */
240
-	private function get_content( $context ) {
240
+	private function get_content($context) {
241 241
 		// Define default content.
242 242
 		$defaults = array(
243
-			'image_url' => GIVE_PLUGIN_URL . 'assets/images/svg/give-icon-full-circle.svg',
244
-			'image_alt' => __( 'Give Icon', 'give' ),
245
-			'heading'   => __( 'No donation forms  found.', 'give' ),
246
-			'message'   => __( 'The first step towards accepting online donations is to create a form.', 'give' ),
247
-			'cta_text'  => __( 'Create Donation Form', 'give' ),
248
-			'cta_link'  => admin_url( 'post-new.php?post_type=give_forms' ),
243
+			'image_url' => GIVE_PLUGIN_URL.'assets/images/svg/give-icon-full-circle.svg',
244
+			'image_alt' => __('Give Icon', 'give'),
245
+			'heading'   => __('No donation forms  found.', 'give'),
246
+			'message'   => __('The first step towards accepting online donations is to create a form.', 'give'),
247
+			'cta_text'  => __('Create Donation Form', 'give'),
248
+			'cta_link'  => admin_url('post-new.php?post_type=give_forms'),
249 249
 			'help'      => sprintf(
250
-				__( 'Need help? Get started with %sGive 101%s.', 'wbpr' ),
250
+				__('Need help? Get started with %sGive 101%s.', 'wbpr'),
251 251
 				'<a href="http://docs.givewp.com/give101/" target="_blank">',
252 252
 				'</a>'
253 253
 			),
@@ -256,40 +256,40 @@  discard block
 block discarded – undo
256 256
 		// Define contextual content.
257 257
 		$content = array(
258 258
 			'no_donations_or_forms' => array(
259
-				'heading' => __( 'No donations found.', 'give' ),
260
-				'message' => __( 'Your donation history will appear here, but first, you need a donation form!', 'give' ),
259
+				'heading' => __('No donations found.', 'give'),
260
+				'message' => __('Your donation history will appear here, but first, you need a donation form!', 'give'),
261 261
 			),
262 262
 			'no_donations'          => array(
263
-				'heading'  => __( 'No donations found.', 'give' ),
264
-				'message'  => __( 'When your first donation arrives, a record of the donation will appear here.', 'give' ),
265
-				'cta_text' => __( 'View All Forms', 'give' ),
266
-				'cta_link' => admin_url( 'edit.php?post_type=give_forms' ),
263
+				'heading'  => __('No donations found.', 'give'),
264
+				'message'  => __('When your first donation arrives, a record of the donation will appear here.', 'give'),
265
+				'cta_text' => __('View All Forms', 'give'),
266
+				'cta_link' => admin_url('edit.php?post_type=give_forms'),
267 267
 				'help'     => sprintf(
268
-					__( 'Need help? Learn more about %sDonations%s.', 'wbpr' ),
268
+					__('Need help? Learn more about %sDonations%s.', 'wbpr'),
269 269
 					'<a href="http://docs.givewp.com/core-donations/">',
270 270
 					'</a>'
271 271
 				),
272 272
 			),
273 273
 			'no_donors_or_forms'    => array(
274
-				'heading' => __( 'No donors  found.', 'give' ),
275
-				'message' => __( 'Your donor history will appear here, but first, you need a donation form!', 'give' ),
274
+				'heading' => __('No donors  found.', 'give'),
275
+				'message' => __('Your donor history will appear here, but first, you need a donation form!', 'give'),
276 276
 			),
277 277
 			'no_donors'             => array(
278
-				'heading'  => __( 'No donors found.', 'give' ),
279
-				'message'  => __( 'When your first donation arrives, the donor will appear here.', 'give' ),
280
-				'cta_text' => __( 'View All Forms', 'give' ),
281
-				'cta_link' => admin_url( 'edit.php?post_type=give_forms' ),
278
+				'heading'  => __('No donors found.', 'give'),
279
+				'message'  => __('When your first donation arrives, the donor will appear here.', 'give'),
280
+				'cta_text' => __('View All Forms', 'give'),
281
+				'cta_link' => admin_url('edit.php?post_type=give_forms'),
282 282
 				'help'     => sprintf(
283
-					__( 'Need help? Learn more about %sDonors%s.', 'wbpr' ),
283
+					__('Need help? Learn more about %sDonors%s.', 'wbpr'),
284 284
 					'<a href="http://docs.givewp.com/core-donors/">',
285 285
 					'</a>'
286 286
 				),
287 287
 			),
288 288
 		);
289 289
 
290
-		if ( isset( $content[ $context ] ) ) {
290
+		if (isset($content[$context])) {
291 291
 			// Merge contextual content with defaults.
292
-			return wp_parse_args( $content[ $context ], $defaults );
292
+			return wp_parse_args($content[$context], $defaults);
293 293
 		} else {
294 294
 			// Return defaults if context is undefined.
295 295
 			return $defaults;
Please login to merge, or discard this patch.