Completed
Pull Request — master (#1907)
by
unknown
19:56
created
includes/admin/shortcodes/shortcode-give-register.php 1 patch
Spacing   +6 added lines, -6 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
 
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['title'] = esc_html__( 'Register', 'give' );
25
-		$this->shortcode['label'] = esc_html__( 'Register', 'give' );
24
+		$this->shortcode['title'] = esc_html__('Register', 'give');
25
+		$this->shortcode['label'] = esc_html__('Register', 'give');
26 26
 
27
-		parent::__construct( 'give_register' );
27
+		parent::__construct('give_register');
28 28
 	}
29 29
 
30 30
 	/**
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 		return array(
38 38
 			array(
39 39
 				'type' => 'container',
40
-				'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ),
40
+				'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')),
41 41
 			),
42 42
 			array(
43 43
 				'type'     => 'textbox',
44 44
 				'name'     => 'redirect',
45 45
 				'minWidth' => 320,
46
-				'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ),
46
+				'tooltip'  => esc_attr__('Enter an URL here to redirect to after registering.', 'give'),
47 47
 			),
48 48
 		);
49 49
 	}
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-donation-history.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['label'] = esc_html__( 'Donation History', 'give' );
24
+		$this->shortcode['label'] = esc_html__('Donation History', 'give');
25 25
 
26
-		parent::__construct( 'donation_history' );
26
+		parent::__construct('donation_history');
27 27
 	}
28 28
 }
29 29
 
Please login to merge, or discard this patch.
includes/class-give-db.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
 	 * @since  1.0
112 112
 	 * @access public
113 113
 	 *
114
-     * @param  int $column Column ID.
115
-     * @param  int $row_id Row ID.
116
-     *
117
-     * @return object
114
+	 * @param  int $column Column ID.
115
+	 * @param  int $row_id Row ID.
116
+	 *
117
+	 * @return object
118 118
 	 */
119 119
 	public function get_by( $column, $row_id ) {
120
-        /* @var WPDB $wpdb */
121
-        global $wpdb;
120
+		/* @var WPDB $wpdb */
121
+		global $wpdb;
122 122
 
123 123
 		$column = esc_sql( $column );
124 124
 		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @since  1.0
131 131
 	 * @access public
132
-     *
133
-     * @param  int $column Column ID.
134
-     * @param  int $row_id Row ID.
135
-     *
132
+	 *
133
+	 * @param  int $column Column ID.
134
+	 * @param  int $row_id Row ID.
135
+	 *
136 136
 	 * @return string      Column value.
137 137
 	 */
138 138
 	public function get_column( $column, $row_id ) {
139
-        /* @var WPDB $wpdb */
140
-        global $wpdb;
139
+		/* @var WPDB $wpdb */
140
+		global $wpdb;
141 141
 
142 142
 		$column = esc_sql( $column );
143 143
 		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
@@ -148,16 +148,16 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @since  1.0
150 150
 	 * @access public
151
-     *
152
-     * @param  int    $column       Column ID.
153
-     * @param  string $column_where Column name.
154
-     * @param  string $column_value Column value.
155
-     *
151
+	 *
152
+	 * @param  int    $column       Column ID.
153
+	 * @param  string $column_where Column name.
154
+	 * @param  string $column_value Column value.
155
+	 *
156 156
 	 * @return string
157 157
 	 */
158 158
 	public function get_column_by( $column, $column_where, $column_value ) {
159
-        /* @var WPDB $wpdb */
160
-        global $wpdb;
159
+		/* @var WPDB $wpdb */
160
+		global $wpdb;
161 161
 
162 162
 		$column_where = esc_sql( $column_where );
163 163
 		$column       = esc_sql( $column );
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
 	 *
170 170
 	 * @since  1.0
171 171
 	 * @access public
172
-     *
173
-     * @param  array  $data
174
-     * @param  string $type
175
-     *
172
+	 *
173
+	 * @param  array  $data
174
+	 * @param  string $type
175
+	 *
176 176
 	 * @return int
177 177
 	 */
178 178
 	public function insert( $data, $type = '' ) {
179
-        /* @var WPDB $wpdb */
180
-        global $wpdb;
179
+		/* @var WPDB $wpdb */
180
+		global $wpdb;
181 181
 
182 182
 		// Set default values.
183 183
 		$data = wp_parse_args( $data, $this->get_column_defaults() );
@@ -224,16 +224,16 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @since  1.0
226 226
 	 * @access public
227
-     *
228
-     * @param  int    $row_id Column ID
229
-     * @param  array  $data
230
-     * @param  string $where  Column value
231
-     *
227
+	 *
228
+	 * @param  int    $row_id Column ID
229
+	 * @param  array  $data
230
+	 * @param  string $where  Column value
231
+	 *
232 232
 	 * @return bool
233 233
 	 */
234 234
 	public function update( $row_id, $data = array(), $where = '' ) {
235
-        /* @var WPDB $wpdb */
236
-        global $wpdb;
235
+		/* @var WPDB $wpdb */
236
+		global $wpdb;
237 237
 
238 238
 		// Row ID must be positive integer
239 239
 		$row_id = absint( $row_id );
@@ -271,14 +271,14 @@  discard block
 block discarded – undo
271 271
 	 *
272 272
 	 * @since  1.0
273 273
 	 * @access public
274
-     *
275
-     * @param  int $row_id Column ID.
276
-     *
274
+	 *
275
+	 * @param  int $row_id Column ID.
276
+	 *
277 277
 	 * @return bool
278 278
 	 */
279 279
 	public function delete( $row_id = 0 ) {
280
-        /* @var WPDB $wpdb */
281
-        global $wpdb;
280
+		/* @var WPDB $wpdb */
281
+		global $wpdb;
282 282
 
283 283
 		// Row ID must be positive integer
284 284
 		$row_id = absint( $row_id );
@@ -299,13 +299,13 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @since  1.3.2
301 301
 	 * @access public
302
-     *
302
+	 *
303 303
 	 * @param  string $table The table name.
304
-     *
304
+	 *
305 305
 	 * @return bool          If the table name exists.
306 306
 	 */
307 307
 	public function table_exists( $table ) {
308
-        /* @var WPDB $wpdb */
308
+		/* @var WPDB $wpdb */
309 309
 		global $wpdb;
310 310
 
311 311
 		$table = sanitize_text_field( $table );
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 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,11 +98,11 @@  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
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
105
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
106 106
 	}
107 107
 
108 108
 	/**
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
      *
117 117
      * @return object
118 118
 	 */
119
-	public function get_by( $column, $row_id ) {
119
+	public function get_by($column, $row_id) {
120 120
         /* @var WPDB $wpdb */
121 121
         global $wpdb;
122 122
 
123
-		$column = esc_sql( $column );
124
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
123
+		$column = esc_sql($column);
124
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id));
125 125
 	}
126 126
 
127 127
 	/**
@@ -135,12 +135,12 @@  discard block
 block discarded – undo
135 135
      *
136 136
 	 * @return string      Column value.
137 137
 	 */
138
-	public function get_column( $column, $row_id ) {
138
+	public function get_column($column, $row_id) {
139 139
         /* @var WPDB $wpdb */
140 140
         global $wpdb;
141 141
 
142
-		$column = esc_sql( $column );
143
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
142
+		$column = esc_sql($column);
143
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
144 144
 	}
145 145
 
146 146
 	/**
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
      *
156 156
 	 * @return string
157 157
 	 */
158
-	public function get_column_by( $column, $column_where, $column_value ) {
158
+	public function get_column_by($column, $column_where, $column_value) {
159 159
         /* @var WPDB $wpdb */
160 160
         global $wpdb;
161 161
 
162
-		$column_where = esc_sql( $column_where );
163
-		$column       = esc_sql( $column );
164
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) );
162
+		$column_where = esc_sql($column_where);
163
+		$column       = esc_sql($column);
164
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value));
165 165
 	}
166 166
 
167 167
 	/**
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
      *
176 176
 	 * @return int
177 177
 	 */
178
-	public function insert( $data, $type = '' ) {
178
+	public function insert($data, $type = '') {
179 179
         /* @var WPDB $wpdb */
180 180
         global $wpdb;
181 181
 
182 182
 		// Set default values.
183
-		$data = wp_parse_args( $data, $this->get_column_defaults() );
183
+		$data = wp_parse_args($data, $this->get_column_defaults());
184 184
 
185 185
 		/**
186 186
 		 * Fires before inserting data to the database.
@@ -189,22 +189,22 @@  discard block
 block discarded – undo
189 189
 		 *
190 190
 		 * @param array $data
191 191
 		 */
192
-		do_action( "give_pre_insert_{$type}", $data );
192
+		do_action("give_pre_insert_{$type}", $data);
193 193
 
194 194
 		// Initialise column format array
195 195
 		$column_formats = $this->get_columns();
196 196
 
197 197
 		// Force fields to lower case
198
-		$data = array_change_key_case( $data );
198
+		$data = array_change_key_case($data);
199 199
 
200 200
 		// White list columns
201
-		$data = array_intersect_key( $data, $column_formats );
201
+		$data = array_intersect_key($data, $column_formats);
202 202
 
203 203
 		// Reorder $column_formats to match the order of columns given in $data
204
-		$data_keys      = array_keys( $data );
205
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
204
+		$data_keys      = array_keys($data);
205
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
206 206
 
207
-		$wpdb->insert( $this->table_name, $data, $column_formats );
207
+		$wpdb->insert($this->table_name, $data, $column_formats);
208 208
 
209 209
 		/**
210 210
 		 * Fires after inserting data to the database.
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		 * @param int   $insert_id
215 215
 		 * @param array $data
216 216
 		 */
217
-		do_action( "give_post_insert_{$type}", $wpdb->insert_id, $data );
217
+		do_action("give_post_insert_{$type}", $wpdb->insert_id, $data);
218 218
 
219 219
 		return $wpdb->insert_id;
220 220
 	}
@@ -231,18 +231,18 @@  discard block
 block discarded – undo
231 231
      *
232 232
 	 * @return bool
233 233
 	 */
234
-	public function update( $row_id, $data = array(), $where = '' ) {
234
+	public function update($row_id, $data = array(), $where = '') {
235 235
         /* @var WPDB $wpdb */
236 236
         global $wpdb;
237 237
 
238 238
 		// Row ID must be positive integer
239
-		$row_id = absint( $row_id );
239
+		$row_id = absint($row_id);
240 240
 
241
-		if ( empty( $row_id ) ) {
241
+		if (empty($row_id)) {
242 242
 			return false;
243 243
 		}
244 244
 
245
-		if ( empty( $where ) ) {
245
+		if (empty($where)) {
246 246
 			$where = $this->primary_key;
247 247
 		}
248 248
 
@@ -250,16 +250,16 @@  discard block
 block discarded – undo
250 250
 		$column_formats = $this->get_columns();
251 251
 
252 252
 		// Force fields to lower case
253
-		$data = array_change_key_case( $data );
253
+		$data = array_change_key_case($data);
254 254
 
255 255
 		// White list columns
256
-		$data = array_intersect_key( $data, $column_formats );
256
+		$data = array_intersect_key($data, $column_formats);
257 257
 
258 258
 		// Reorder $column_formats to match the order of columns given in $data
259
-		$data_keys      = array_keys( $data );
260
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
259
+		$data_keys      = array_keys($data);
260
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
261 261
 
262
-		if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) {
262
+		if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) {
263 263
 			return false;
264 264
 		}
265 265
 
@@ -276,18 +276,18 @@  discard block
 block discarded – undo
276 276
      *
277 277
 	 * @return bool
278 278
 	 */
279
-	public function delete( $row_id = 0 ) {
279
+	public function delete($row_id = 0) {
280 280
         /* @var WPDB $wpdb */
281 281
         global $wpdb;
282 282
 
283 283
 		// Row ID must be positive integer
284
-		$row_id = absint( $row_id );
284
+		$row_id = absint($row_id);
285 285
 
286
-		if ( empty( $row_id ) ) {
286
+		if (empty($row_id)) {
287 287
 			return false;
288 288
 		}
289 289
 
290
-		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
290
+		if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) {
291 291
 			return false;
292 292
 		}
293 293
 
@@ -304,13 +304,13 @@  discard block
 block discarded – undo
304 304
      *
305 305
 	 * @return bool          If the table name exists.
306 306
 	 */
307
-	public function table_exists( $table ) {
307
+	public function table_exists($table) {
308 308
         /* @var WPDB $wpdb */
309 309
 		global $wpdb;
310 310
 
311
-		$table = sanitize_text_field( $table );
311
+		$table = sanitize_text_field($table);
312 312
 
313
-		return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
313
+		return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table;
314 314
 	}
315 315
 
316 316
 	/**
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 * @return bool Returns if the customers table was installed and upgrade routine run.
323 323
 	 */
324 324
 	public function installed() {
325
-		return $this->table_exists( $this->table_name );
325
+		return $this->table_exists($this->table_name);
326 326
 	}
327 327
 
328 328
 	/**
@@ -332,8 +332,8 @@  discard block
 block discarded – undo
332 332
 	 * @access public
333 333
 	 */
334 334
 	public function register_table() {
335
-		$current_version = get_option( $this->table_name . '_db_version' );
336
-		if ( ! $current_version || version_compare( $current_version, $this->version, '<' ) ) {
335
+		$current_version = get_option($this->table_name.'_db_version');
336
+		if ( ! $current_version || version_compare($current_version, $this->version, '<')) {
337 337
 			$this->create_table();
338 338
 		}
339 339
 	}
@@ -344,5 +344,5 @@  discard block
 block discarded – undo
344 344
 	 * @since  1.8.9
345 345
 	 * @access public
346 346
 	 */
347
-	public function create_table(){}
347
+	public function create_table() {}
348 348
 }
Please login to merge, or discard this patch.
includes/api/class-give-api-v1.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 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
 
Please login to merge, or discard this patch.
includes/filters.php 1 patch
Spacing   +12 added lines, -12 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
 
@@ -26,29 +26,29 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return void
28 28
  */
29
-function give_set_settings_with_disable_prefix( $old_settings, $settings ) {
29
+function give_set_settings_with_disable_prefix($old_settings, $settings) {
30 30
 	// Get old setting names.
31
-	$old_settings   = array_flip( give_v18_renamed_core_settings() );
31
+	$old_settings   = array_flip(give_v18_renamed_core_settings());
32 32
 	$update_setting = false;
33 33
 
34
-	foreach ( $settings as $key => $value ) {
34
+	foreach ($settings as $key => $value) {
35 35
 
36 36
 		// Check 1. Check if new option is really updated or not.
37 37
 		// Check 2. Continue if key is not renamed.
38
-		if ( ! isset( $old_settings[ $key ] ) ) {
38
+		if ( ! isset($old_settings[$key])) {
39 39
 			continue;
40 40
 		}
41 41
 
42 42
 		// Set old setting.
43
-		$settings[ $old_settings[ $key ] ] = 'on';
43
+		$settings[$old_settings[$key]] = 'on';
44 44
 
45 45
 		// Do not need to set old setting if new setting is not set.
46 46
 		if (
47
-			( give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'disable_' ) ) )
48
-			|| ( ! give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'enable_' ) ) )
47
+			(give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'disable_')))
48
+			|| ( ! give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'enable_')))
49 49
 
50 50
 		) {
51
-			unset( $settings[ $old_settings[ $key ] ] );
51
+			unset($settings[$old_settings[$key]]);
52 52
 		}
53 53
 
54 54
 		// Tell bot to update setting.
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	}
57 57
 
58 58
 	// Update setting if any old setting set.
59
-	if ( $update_setting ) {
60
-		update_option( 'give_settings', $settings );
59
+	if ($update_setting) {
60
+		update_option('give_settings', $settings);
61 61
 	}
62 62
 }
63
-add_action( 'update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2 );
63
+add_action('update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2);
Please login to merge, or discard this patch.
includes/gateways/actions.php 1 patch
Spacing   +13 added lines, -13 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
 
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @param $data
23 23
  */
24
-function give_process_gateway_select( $data ) {
25
-	if ( isset( $_POST['gateway_submit'] ) ) {
26
-		wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) );
24
+function give_process_gateway_select($data) {
25
+	if (isset($_POST['gateway_submit'])) {
26
+		wp_redirect(esc_url(add_query_arg('payment-mode', $_POST['payment-mode'])));
27 27
 		exit;
28 28
 	}
29 29
 }
30 30
 
31
-add_action( 'give_gateway_select', 'give_process_gateway_select' );
31
+add_action('give_gateway_select', 'give_process_gateway_select');
32 32
 
33 33
 /**
34 34
  * Loads a payment gateway via AJAX.
@@ -38,20 +38,20 @@  discard block
 block discarded – undo
38 38
  * @return void
39 39
  */
40 40
 function give_load_ajax_gateway() {
41
-	if ( isset( $_POST['give_payment_mode'] ) ) {
41
+	if (isset($_POST['give_payment_mode'])) {
42 42
 		/**
43 43
 		 * Fire to render donation form.
44 44
 		 *
45 45
 		 * @since 1.7
46 46
 		 */
47
-		do_action( 'give_donation_form', $_POST['give_form_id'] );
47
+		do_action('give_donation_form', $_POST['give_form_id']);
48 48
 
49 49
 		exit();
50 50
 	}
51 51
 }
52 52
 
53
-add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' );
54
-add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' );
53
+add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway');
54
+add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway');
55 55
 
56 56
 /**
57 57
  * Sets an error within the donation form if no gateways are enabled.
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 function give_no_gateway_error() {
64 64
 	$gateways = give_get_enabled_payment_gateways();
65 65
 
66
-	if ( empty( $gateways ) ) {
67
-		give_set_error( 'no_gateways', esc_html__( 'You must enable a payment gateway to use Give.', 'give' ) );
66
+	if (empty($gateways)) {
67
+		give_set_error('no_gateways', esc_html__('You must enable a payment gateway to use Give.', 'give'));
68 68
 	} else {
69
-		give_unset_error( 'no_gateways' );
69
+		give_unset_error('no_gateways');
70 70
 	}
71 71
 }
72 72
 
73
-add_action( 'init', 'give_no_gateway_error' );
73
+add_action('init', 'give_no_gateway_error');
Please login to merge, or discard this patch.
includes/admin/abstract-admin-settings-page.php 1 patch
Spacing   +22 added lines, -22 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_Page' ) ) :
16
+if ( ! class_exists('Give_Settings_Page')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Page.
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 			// Get current setting page.
63 63
 			$this->current_setting_page = give_get_current_setting_page();
64 64
 
65
-			add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 );
66
-			add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 );
67
-			add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array( $this, 'output_sections' ) );
68
-			add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) );
69
-			add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) );
65
+			add_filter("give_default_setting_tab_section_{$this->id}", array($this, 'set_default_setting_tab'), 10);
66
+			add_filter("{$this->current_setting_page}_tabs_array", array($this, 'add_settings_page'), 20);
67
+			add_action("{$this->current_setting_page}_sections_{$this->id}_page", array($this, 'output_sections'));
68
+			add_action("{$this->current_setting_page}_settings_{$this->id}_page", array($this, 'output'));
69
+			add_action("{$this->current_setting_page}_save_{$this->id}", array($this, 'save'));
70 70
 		}
71 71
 
72 72
 		/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		 *
79 79
 		 * @return string
80 80
 		 */
81
-		function set_default_setting_tab( $setting_tab ) {
81
+		function set_default_setting_tab($setting_tab) {
82 82
 			return $this->default_tab;
83 83
 		}
84 84
 
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 		 *
92 92
 		 * @return array
93 93
 		 */
94
-		public function add_settings_page( $pages ) {
95
-			$pages[ $this->id ] = $this->label;
94
+		public function add_settings_page($pages) {
95
+			$pages[$this->id] = $this->label;
96 96
 
97 97
 			return $pages;
98 98
 		}
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 			 *
112 112
 			 * @param  array $settings
113 113
 			 */
114
-			$settings = apply_filters( 'give_get_settings_' . $this->id, array() );
114
+			$settings = apply_filters('give_get_settings_'.$this->id, array());
115 115
 
116 116
 			// Output.
117 117
 			return $settings;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		 * @return array
125 125
 		 */
126 126
 		public function get_sections() {
127
-			return apply_filters( 'give_get_sections_' . $this->id, array() );
127
+			return apply_filters('give_get_sections_'.$this->id, array());
128 128
 		}
129 129
 
130 130
 		/**
@@ -141,29 +141,29 @@  discard block
 block discarded – undo
141 141
 			$sections = $this->get_sections();
142 142
 
143 143
 			// Show section settings only if setting section exist.
144
-			if ( $current_section && ! in_array( $current_section, array_keys( $sections ) ) ) {
145
-				echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>';
144
+			if ($current_section && ! in_array($current_section, array_keys($sections))) {
145
+				echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>';
146 146
 				$GLOBALS['give_hide_save_button'] = true;
147 147
 
148 148
 				return;
149 149
 			}
150 150
 
151 151
 			// Bailout.
152
-			if ( empty( $sections ) ) {
152
+			if (empty($sections)) {
153 153
 				return;
154 154
 			}
155 155
 
156
-			if ( is_null( $this->current_setting_page ) ) {
156
+			if (is_null($this->current_setting_page)) {
157 157
 				$this->current_setting_page = give_get_current_setting_page();
158 158
 			}
159 159
 
160 160
 			echo '<ul class="subsubsub">';
161 161
 
162 162
 			// Get section keys.
163
-			$array_keys = array_keys( $sections );
163
+			$array_keys = array_keys($sections);
164 164
 
165
-			foreach ( $sections as $id => $label ) {
166
-				echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=' . $this->current_setting_page . '&tab=' . $this->id . '&section=' . sanitize_title( $id ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>';
165
+			foreach ($sections as $id => $label) {
166
+				echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page='.$this->current_setting_page.'&tab='.$this->id.'&section='.sanitize_title($id)).'" class="'.($current_section == $id ? 'current' : '').'">'.$label.'</a> '.(end($array_keys) == $id ? '' : '|').' </li>';
167 167
 			}
168 168
 
169 169
 			echo '</ul><br class="clear" /><hr>';
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		public function output() {
179 179
 			$settings = $this->get_settings();
180 180
 
181
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
181
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
182 182
 		}
183 183
 
184 184
 		/**
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 			$settings        = $this->get_settings();
192 192
 			$current_section = give_get_current_setting_section();
193 193
 
194
-			Give_Admin_Settings::save_fields( $settings, 'give_settings' );
194
+			Give_Admin_Settings::save_fields($settings, 'give_settings');
195 195
 
196 196
 			/**
197 197
 			 * Trigger Action
198 198
 			 *
199 199
 			 * @since 1.8
200 200
 			 */
201
-			do_action( 'give_update_options_' . $this->id . '_' . $current_section );
201
+			do_action('give_update_options_'.$this->id.'_'.$current_section);
202 202
 		}
203 203
 	}
204 204
 
Please login to merge, or discard this patch.
includes/admin/views/html-admin-settings.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -2,13 +2,13 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * Admin View: Settings
4 4
  */
5
-if ( ! defined( 'ABSPATH' ) ) {
5
+if ( ! defined('ABSPATH')) {
6 6
 	exit;
7 7
 }
8 8
 
9 9
 
10 10
 // Bailout: Do not output anything if setting tab is not defined.
11
-if( ! empty( $tabs ) && array_key_exists( give_get_current_setting_tab(), $tabs ) ) :
11
+if ( ! empty($tabs) && array_key_exists(give_get_current_setting_tab(), $tabs)) :
12 12
 	/**
13 13
 	 * Filter the form action.
14 14
 	 *
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @since 1.8
20 20
 	 */
21
-	$form_method    = apply_filters( self::$setting_filter_prefix . '_form_method_tab_' . $current_tab, 'post' );
21
+	$form_method = apply_filters(self::$setting_filter_prefix.'_form_method_tab_'.$current_tab, 'post');
22 22
 
23 23
 	/**
24 24
 	 * Filter the main form tab.
@@ -30,15 +30,15 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @since 1.8
32 32
 	 */
33
-	$form_open_tag  = apply_filters( self::$setting_filter_prefix . '_open_form', '<form method="' . $form_method  . '" id="give-mainform" action="" enctype="multipart/form-data">' );
34
-	$form_close_tag = apply_filters( self::$setting_filter_prefix . '_close_form', '</form>' );
33
+	$form_open_tag  = apply_filters(self::$setting_filter_prefix.'_open_form', '<form method="'.$form_method.'" id="give-mainform" action="" enctype="multipart/form-data">');
34
+	$form_close_tag = apply_filters(self::$setting_filter_prefix.'_close_form', '</form>');
35 35
 	?>
36
-	<div class="wrap give-settings-page <?php echo self::$setting_filter_prefix . '-setting-page'; ?>">
36
+	<div class="wrap give-settings-page <?php echo self::$setting_filter_prefix.'-setting-page'; ?>">
37 37
 		<?php echo $form_open_tag; ?>
38 38
 			<h2 class="nav-tab-wrapper give-nav-tab-wrapper">
39 39
 				<?php
40
-				foreach ( $tabs as $name => $label ) {
41
-					echo '<a href="' . admin_url( "edit.php?post_type=give_forms&page=" . self::$setting_filter_prefix . "&tab={$name}" ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . $label . '</a>';
40
+				foreach ($tabs as $name => $label) {
41
+					echo '<a href="'.admin_url("edit.php?post_type=give_forms&page=".self::$setting_filter_prefix."&tab={$name}").'" class="nav-tab '.($current_tab == $name ? 'nav-tab-active' : '').'">'.$label.'</a>';
42 42
 				}
43 43
 
44 44
 				/**
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
 				 *
51 51
 				 * @since 1.8
52 52
 				 */
53
-				do_action( self::$setting_filter_prefix . '_tabs' );
53
+				do_action(self::$setting_filter_prefix.'_tabs');
54 54
 				?>
55 55
 			</h2>
56 56
 			<div class="give-sub-nav-tab-wrapper">
57
-				<a href="#" id="give-show-sub-nav" class="nav-tab give-not-tab" title="<?php _e( 'View remaining setting tabs', 'give' ); ?>"><span class="dashicons dashicons-arrow-down-alt2"></span></span></a>
57
+				<a href="#" id="give-show-sub-nav" class="nav-tab give-not-tab" title="<?php _e('View remaining setting tabs', 'give'); ?>"><span class="dashicons dashicons-arrow-down-alt2"></span></span></a>
58 58
 				<nav class="give-sub-nav-tab give-hidden"></nav>
59 59
 			</div>
60
-			<h1 class="screen-reader-text"><?php echo esc_html( $tabs[ $current_tab ] ); ?></h1>
60
+			<h1 class="screen-reader-text"><?php echo esc_html($tabs[$current_tab]); ?></h1>
61 61
 			<?php
62 62
 
63 63
 			/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 			 *
70 70
 			 * @since 1.8
71 71
 			 */
72
-			do_action( self::$setting_filter_prefix . "_sections_{$current_tab}_page" );
72
+			do_action(self::$setting_filter_prefix."_sections_{$current_tab}_page");
73 73
 
74 74
 			
75 75
 			// Show messages.
@@ -85,15 +85,15 @@  discard block
 block discarded – undo
85 85
 			 *
86 86
 			 * @since 1.8
87 87
 			 */
88
-			do_action( self::$setting_filter_prefix . "_settings_{$current_tab}_page" );
88
+			do_action(self::$setting_filter_prefix."_settings_{$current_tab}_page");
89 89
 
90
-			if ( empty( $GLOBALS['give_hide_save_button'] ) ) : ?>
90
+			if (empty($GLOBALS['give_hide_save_button'])) : ?>
91 91
 				<div class="give-submit-wrap">
92
-					<?php wp_nonce_field( 'give-save-settings', '_give-save-settings' ); ?>
93
-					<input name="save" class="button-primary give-save-button" type="submit" value="<?php esc_attr_e( 'Save changes', 'give' ); ?>" />
92
+					<?php wp_nonce_field('give-save-settings', '_give-save-settings'); ?>
93
+					<input name="save" class="button-primary give-save-button" type="submit" value="<?php esc_attr_e('Save changes', 'give'); ?>" />
94 94
 				</div>
95 95
 			<?php endif; ?>
96 96
 		<?php echo $form_close_tag; ?>
97 97
 	</div>
98
-	<?php else : echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; ?>
98
+	<?php else : echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; ?>
99 99
 <?php endif; ?>
100 100
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,5 +95,8 @@
 block discarded – undo
95 95
 			<?php endif; ?>
96 96
 		<?php echo $form_close_tag; ?>
97 97
 	</div>
98
-	<?php else : echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; ?>
98
+	<?php else {
99
+	: echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>';
100
+}
101
+?>
99 102
 <?php endif; ?>
100 103
\ No newline at end of file
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
@@ -87,13 +87,13 @@
 block discarded – undo
87 87
 								'disabled' => __( 'Head', 'give' ),
88 88
 							)
89 89
 						),
90
-                        array(
91
-                            'name'  => esc_html__( 'Advanced Settings Docs Link', 'give' ),
92
-                            'id'    => 'advanced_settings_docs_link',
93
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-advanced' ),
94
-                            'title' => __( 'Advanced Settings', 'give' ),
95
-                            'type'  => 'give_docs_link',
96
-                        ),
90
+						array(
91
+							'name'  => esc_html__( 'Advanced Settings Docs Link', 'give' ),
92
+							'id'    => 'advanced_settings_docs_link',
93
+							'url'   => esc_url( 'http://docs.givewp.com/settings-advanced' ),
94
+							'title' => __( 'Advanced Settings', 'give' ),
95
+							'type'  => 'give_docs_link',
96
+						),
97 97
 						array(
98 98
 							'id'   => 'give_title_data_control_2',
99 99
 							'type' => 'sectionend'
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 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 = esc_html__( 'Advanced', 'give' );
30
+			$this->label = esc_html__('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,45 +53,45 @@  discard block
 block discarded – undo
53 53
 							'type' => 'title'
54 54
 						),
55 55
 						array(
56
-							'name'    => esc_html__( 'Remove Data on Uninstall', 'give' ),
57
-							'desc'    => esc_html__( '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'    => esc_html__('Remove Data on Uninstall', 'give'),
57
+							'desc'    => esc_html__('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 67
 							/* translators: %s: the_content */
68
-							'name'    => sprintf( __( '%s filter', 'give' ), '<code>the_content</code>' ),
68
+							'name'    => sprintf(__('%s filter', 'give'), '<code>the_content</code>'),
69 69
 							/* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */
70
-							'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>' ),
70
+							'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>'),
71 71
 							'id'      => 'the_content_filter',
72 72
 							'default' => 'enabled',
73 73
 							'type'    => 'radio_inline',
74 74
 							'options' => array(
75
-								'enabled'  => __( 'Enabled', 'give' ),
76
-								'disabled' => __( 'Disabled', 'give' ),
75
+								'enabled'  => __('Enabled', 'give'),
76
+								'disabled' => __('Disabled', 'give'),
77 77
 							)
78 78
 						),
79 79
 						array(
80
-							'name'    => esc_html__( 'Script Loading Location', 'give' ),
81
-							'desc'    => __( 'This allows you to load your Give scripts either in the <code>&lt;head&gt;</code> or footer of your website.', 'give' ),
80
+							'name'    => esc_html__('Script Loading Location', 'give'),
81
+							'desc'    => __('This allows you to load your Give scripts either in the <code>&lt;head&gt;</code> or footer of your website.', 'give'),
82 82
 							'id'      => 'scripts_footer',
83 83
 							'type'    => 'radio_inline',
84 84
 							'default' => 'disabled',
85 85
 							'options' => array(
86
-								'enabled'  => __( 'Footer', 'give' ),
87
-								'disabled' => __( 'Head', 'give' ),
86
+								'enabled'  => __('Footer', 'give'),
87
+								'disabled' => __('Head', 'give'),
88 88
 							)
89 89
 						),
90 90
                         array(
91
-                            'name'  => esc_html__( 'Advanced Settings Docs Link', 'give' ),
91
+                            'name'  => esc_html__('Advanced Settings Docs Link', 'give'),
92 92
                             'id'    => 'advanced_settings_docs_link',
93
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-advanced' ),
94
-                            'title' => __( 'Advanced Settings', 'give' ),
93
+                            'url'   => esc_url('http://docs.givewp.com/settings-advanced'),
94
+                            'title' => __('Advanced Settings', 'give'),
95 95
                             'type'  => 'give_docs_link',
96 96
                         ),
97 97
 						array(
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 			 * Filter the advanced settings.
108 108
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
109 109
 			 */
110
-			$settings = apply_filters( 'give_settings_advanced', $settings );
110
+			$settings = apply_filters('give_settings_advanced', $settings);
111 111
 
112 112
 			/**
113 113
 			 * Filter the settings.
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 			 *
117 117
 			 * @param  array $settings
118 118
 			 */
119
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
119
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
120 120
 
121 121
 			// Output.
122 122
 			return $settings;
@@ -130,10 +130,10 @@  discard block
 block discarded – undo
130 130
 		 */
131 131
 		public function get_sections() {
132 132
 			$sections = array(
133
-				'advanced-options' => esc_html__( 'Advanced Options', 'give' )
133
+				'advanced-options' => esc_html__('Advanced Options', 'give')
134 134
 			);
135 135
 
136
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
136
+			return apply_filters('give_get_sections_'.$this->id, $sections);
137 137
 		}
138 138
 	}
139 139
 
Please login to merge, or discard this patch.