Completed
Pull Request — master (#1147)
by Zack
31:52 queued 16:34
created
includes/fields/class-gravityview-field.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@
 block discarded – undo
245 245
 	 * @param bool $url_encode Whether to URL-encode output
246 246
 	 * @param bool $esc_html Whether to apply `esc_html()` to output
247 247
 	 *
248
-	 * @return mixed
248
+	 * @return string
249 249
 	 */
250 250
 	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
251 251
 
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
 
135 135
 		add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 );
136 136
 
137
-		if( $this->entry_meta_key ) {
137
+		if ( $this->entry_meta_key ) {
138 138
 			add_filter( 'gform_entry_meta', array( $this, 'add_entry_meta' ) );
139 139
 			add_filter( 'gravityview/common/sortable_fields', array( $this, 'add_sortable_field' ), 10, 2 );
140 140
 		}
141 141
 
142
-		if( $this->_custom_merge_tag ) {
142
+		if ( $this->_custom_merge_tag ) {
143 143
 			add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 );
144 144
 			add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 );
145 145
 		}
146 146
 
147
-		if( 'meta' === $this->group || '' !== $this->default_search_label ) {
147
+		if ( 'meta' === $this->group || '' !== $this->default_search_label ) {
148 148
 			add_filter( 'gravityview_search_field_label', array( $this, 'set_default_search_label' ), 10, 3 );
149 149
 		}
150 150
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		 * Auto-assign label from Gravity Forms label, if exists
153 153
 		 * @since 1.20
154 154
 		 */
155
-		if( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) {
155
+		if ( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) {
156 156
 			$this->label = ucfirst( GF_Fields::get( $this->name )->get_form_editor_field_title() );
157 157
 		}
158 158
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 			'type'  => $this->name
176 176
 		);
177 177
 
178
-		$fields["{$this->entry_meta_key}"] = $added_field;
178
+		$fields[ "{$this->entry_meta_key}" ] = $added_field;
179 179
 
180 180
 		return $fields;
181 181
 	}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	function set_default_search_label( $label = '', $gf_field = null, $field = array() ) {
197 197
 
198
-		if( $this->name === $field['field'] && '' === $label ) {
198
+		if ( $this->name === $field[ 'field' ] && '' === $label ) {
199 199
 			$label = esc_html( $this->default_search_label );
200 200
 		}
201 201
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 *
217 217
 	 * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text.
218 218
 	 */
219
-	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
219
+	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
220 220
 
221 221
 		// Is there is field merge tag? Strip whitespace off the ned, too.
222 222
 		preg_match_all( '/{' . preg_quote( $this->_custom_merge_tag ) . ':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER );
@@ -249,19 +249,19 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
251 251
 
252
-		foreach( $matches as $match ) {
252
+		foreach ( $matches as $match ) {
253 253
 
254
-			$full_tag = $match[0];
254
+			$full_tag = $match[ 0 ];
255 255
 
256 256
 			// Strip the Merge Tags
257
-			$tag = str_replace( array( '{', '}'), '', $full_tag );
257
+			$tag = str_replace( array( '{', '}' ), '', $full_tag );
258 258
 
259 259
 			// Replace the value from the entry, if exists
260
-			if( isset( $entry[ $tag ] ) ) {
260
+			if ( isset( $entry[ $tag ] ) ) {
261 261
 
262 262
 				$value = $entry[ $tag ];
263 263
 
264
-				if( is_callable( array( $this, 'get_content') ) ) {
264
+				if ( is_callable( array( $this, 'get_content' ) ) ) {
265 265
 					$value = $this->get_content( $value );
266 266
 				}
267 267
 
@@ -334,8 +334,8 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	public function _filter_sortable_fields( $not_sortable ) {
336 336
 
337
-		if( ! $this->is_sortable ) {
338
-			$not_sortable[] = $this->name;
337
+		if ( ! $this->is_sortable ) {
338
+			$not_sortable[ ] = $this->name;
339 339
 		}
340 340
 
341 341
 		return $not_sortable;
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	 */
353 353
 	function add_entry_meta( $entry_meta ) {
354 354
 
355
-		if( ! isset( $entry_meta["{$this->entry_meta_key}"] ) ) {
355
+		if ( ! isset( $entry_meta[ "{$this->entry_meta_key}" ] ) ) {
356 356
 
357 357
 			$added_meta = array(
358 358
 				'label'             => $this->label,
@@ -361,13 +361,13 @@  discard block
 block discarded – undo
361 361
 			);
362 362
 
363 363
 			if ( $this->entry_meta_update_callback && is_callable( $this->entry_meta_update_callback ) ) {
364
-				$added_meta['update_entry_meta_callback'] = $this->entry_meta_update_callback;
364
+				$added_meta[ 'update_entry_meta_callback' ] = $this->entry_meta_update_callback;
365 365
 			}
366 366
 
367
-			$entry_meta["{$this->entry_meta_key}"] = $added_meta;
367
+			$entry_meta[ "{$this->entry_meta_key}" ] = $added_meta;
368 368
 
369 369
 		} else {
370
-			gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' =>  $entry_meta["{$this->entry_meta_key}"] ) );
370
+			gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' =>  $entry_meta[ "{$this->entry_meta_key}" ] ) );
371 371
 		}
372 372
 
373 373
 		return $entry_meta;
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 			'date_display' => array(
397 397
 				'type' => 'text',
398 398
 				'label' => __( 'Override Date Format', 'gravityview' ),
399
-				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ),
399
+				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ),
400 400
 				/**
401 401
 				 * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time)
402 402
 				 * @param[in,out] null|string $date_format Date Format (default: null)
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 
422 422
 		$options = $this->field_support_options();
423 423
 
424
-		if( isset( $options[ $key ] ) ) {
424
+		if ( isset( $options[ $key ] ) ) {
425 425
 			$field_options[ $key ] = $options[ $key ];
426 426
 		}
427 427
 
@@ -485,11 +485,11 @@  discard block
 block discarded – undo
485 485
 		$connected_form = \GV\Utils::_POST( 'form_id' );
486 486
 
487 487
 		// Otherwise, get the Form ID from the Post page
488
-		if( empty( $connected_form ) ) {
488
+		if ( empty( $connected_form ) ) {
489 489
 			$connected_form = gravityview_get_form_id( get_the_ID() );
490 490
 		}
491 491
 
492
-		if( empty( $connected_form ) ) {
492
+		if ( empty( $connected_form ) ) {
493 493
 			gravityview()->log->error( 'Form not found for form ID "{form_id}"', array( 'form_id' => $connected_form ) );
494 494
 			return false;
495 495
 		}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-transaction-type.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	public function get_content( $output, $entry = array(), $field_settings = array(), $field = array() ) {
60 60
 
61 61
 		/** Overridden by a template. */
62
-		if( ! empty( $field['field_path'] ) ) { return $output; }
62
+		if ( ! empty( $field[ 'field_path' ] ) ) { return $output; }
63 63
 
64 64
 		return $this->get_string_from_value( $output );
65 65
 	}
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 		switch ( intval( $value ) ) {
79 79
 			case self::ONE_TIME_PAYMENT:
80 80
 			default:
81
-				$return = __('One-Time Payment', 'gravityview');
81
+				$return = __( 'One-Time Payment', 'gravityview' );
82 82
 				break;
83 83
 
84 84
 			case self::SUBSCRIPTION:
85
-				$return = __('Subscription', 'gravityview');
85
+				$return = __( 'Subscription', 'gravityview' );
86 86
 				break;
87 87
 		}
88 88
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
 	 *
73 73
 	 * @param mixed $value The value in.
74 74
 	 *
75
-	 * @return mixed The value out.
75
+	 * @return string The value out.
76 76
 	 */
77 77
 	public function get_value( $value ) {
78 78
 		return $this->get_string_from_value( $value );
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-post-image.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
 
24 24
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
25 25
 
26
-		unset ( $field_options['search_filter'] );
26
+		unset ( $field_options[ 'search_filter' ] );
27 27
 
28
-		if( 'edit' === $context ) {
28
+		if ( 'edit' === $context ) {
29 29
 			return $field_options;
30 30
 		}
31 31
 
32
-		$this->add_field_support('link_to_post', $field_options );
32
+		$this->add_field_support( 'link_to_post', $field_options );
33 33
 
34 34
 		// @since 1.5.4
35
-		$this->add_field_support('dynamic_data', $field_options );
35
+		$this->add_field_support( 'dynamic_data', $field_options );
36 36
 
37 37
 		return $field_options;
38 38
 	}
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		$url = $title = $caption = $description = '';
60 60
 
61 61
 		// If there's a |:| match, process. Otherwise, empty array!
62
-		if( preg_match( '/\|\:\|/', $value ) ) {
62
+		if ( preg_match( '/\|\:\|/', $value ) ) {
63 63
 			list( $url, $title, $caption, $description ) = array_pad( explode( '|:|', $value ), 4, false );
64 64
 		}
65 65
 
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function get_field_input( $form, $value = '', $entry = null, GF_Field_Post_Image $field ) {
90 90
 
91
-		$id = (int) $field->id;
92
-		$form_id = $form['id'];
91
+		$id = (int)$field->id;
92
+		$form_id = $form[ 'id' ];
93 93
 		$input_name = "input_{$id}";
94 94
 		$field_id = sprintf( 'input_%d_%d', $form_id, $id );
95 95
 		$img_name = null;
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
 		// Convert |:| to associative array
98 98
 		$img_array = self::explode_value( $value );
99 99
 
100
-		if( ! empty( $img_array['url'] ) ) {
100
+		if ( ! empty( $img_array[ 'url' ] ) ) {
101 101
 
102
-			$img_name = basename( $img_array['url'] );
102
+			$img_name = basename( $img_array[ 'url' ] );
103 103
 
104 104
 			/**
105 105
 			 * Set the $uploaded_files value so that the .ginput_preview renders, and the file upload is hidden
106 106
 			 * @see GF_Field_Post_Image::get_field_input See the `<span class='ginput_preview'>` code
107 107
 			 * @see GFFormsModel::get_temp_filename See the `rgget( $input_name, self::$uploaded_files[ $form_id ] );` code
108 108
 			 */
109
-			if( empty( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
109
+			if ( empty( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
110 110
 				GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $img_name;
111 111
 			}
112 112
 		}
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 		 * @hack
136 136
 		 */
137 137
 		if ( null !== $img_name ) {
138
-			$current_file = sprintf( "<input name='%s' id='%s' type='hidden' value='%s' />", $input_name, $field_id, esc_url_raw( $img_array['url'] ) );
139
-			$gf_post_image_field_output = str_replace('<span class=\'ginput_preview\'>', '<span class=\'ginput_preview\'>'.$current_file, $gf_post_image_field_output );
138
+			$current_file = sprintf( "<input name='%s' id='%s' type='hidden' value='%s' />", $input_name, $field_id, esc_url_raw( $img_array[ 'url' ] ) );
139
+			$gf_post_image_field_output = str_replace( '<span class=\'ginput_preview\'>', '<span class=\'ginput_preview\'>' . $current_file, $gf_post_image_field_output );
140 140
 		}
141 141
 
142 142
 		return $gf_post_image_field_output;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-date.php 2 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,6 @@
 block discarded – undo
40 40
 	 * Get the default date format for a field based on the field ID and the time format setting
41 41
 	 *
42 42
 	 * @since 1.16.4
43
-
44 43
 	 * @param string $date_format The Gravity Forms date format for the field. Default: "mdy"
45 44
 	 * @param int $field_id The ID of the field. Used to figure out full date/day/month/year
46 45
 	 *
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 
32 32
 	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
33 33
 
34
-		if( 'edit' === $context ) {
34
+		if ( 'edit' === $context ) {
35 35
 			return $field_options;
36 36
 		}
37 37
 
38
-		$this->add_field_support('date_display', $field_options );
38
+		$this->add_field_support( 'date_display', $field_options );
39 39
 
40 40
 		return $field_options;
41 41
 	}
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		$field_input_id = gravityview_get_input_id_from_id( $field_id );
84 84
 
85 85
 		$date_field_output = '';
86
-		switch( $field_input_id ) {
86
+		switch ( $field_input_id ) {
87 87
 			case 1:
88 88
 				$date_field_output = \GV\Utils::get( $parsed_date, 'day' );
89 89
 				break;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-radio.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 	var $is_searchable = true;
13 13
 
14
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
14
+	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' );
15 15
 
16 16
 	var $_gf_field_class_name = 'GF_Field_Radio';
17 17
 
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 		// Set the $_field_id var
41 41
 		$field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type );
42 42
 		
43
-		if( $this->is_choice_value_enabled() ) {
44
-			$field_options['choice_display'] = array(
43
+		if ( $this->is_choice_value_enabled() ) {
44
+			$field_options[ 'choice_display' ] = array(
45 45
 				'type'    => 'radio',
46 46
 				'value'   => 'value',
47 47
 				'label'   => __( 'What should be displayed:', 'gravityview' ),
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-post-tags.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 	var $is_searchable = true;
16 16
 
17
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
17
+	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' );
18 18
 
19 19
 	var $_gf_field_class_name = 'GF_Field_Post_Tags';
20 20
 
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 
28 28
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
29 29
 
30
-		if( 'edit' === $context ) {
30
+		if ( 'edit' === $context ) {
31 31
 			return $field_options;
32 32
 		}
33 33
 
34
-		$this->add_field_support('dynamic_data', $field_options );
35
-		$this->add_field_support('link_to_term', $field_options );
34
+		$this->add_field_support( 'dynamic_data', $field_options );
35
+		$this->add_field_support( 'link_to_term', $field_options );
36 36
 
37 37
 		return $field_options;
38 38
 	}
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-gravity-perks.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	public function edit_entry_fix_uid_fields( $fields ) {
51 51
 
52 52
 		/** @var GF_Field $field */
53
-		foreach( $fields as &$field ) {
53
+		foreach ( $fields as &$field ) {
54 54
 			if ( 'uid' === $field->type ) {
55 55
 
56 56
 				// Replace GF_Field with GF_Field_Text, copying all the data from $field
Please login to merge, or discard this patch.
class-gravityview-plugin-hooks-gravity-forms-coupon.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		 */
54 54
 		$hide_coupon_fields = apply_filters( 'gravityview/edit_entry/hide-coupon-fields', $has_transaction_data );
55 55
 
56
-		return (bool) $hide_coupon_fields;
56
+		return (bool)$hide_coupon_fields;
57 57
 	}
58 58
 
59 59
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	public function edit_entry_field_blacklist( $blacklist = array(), $entry = array() ) {
70 70
 
71 71
 		if ( $this->should_hide_coupon_fields( $entry ) ) {
72
-			$blacklist[] = 'coupon';
72
+			$blacklist[ ] = 'coupon';
73 73
 		}
74 74
 
75 75
 		return $blacklist;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		// No coupons match the codes provided
108 108
 		$discounts = gf_coupons()->get_coupons_by_codes( $coupon_codes, $form );
109 109
 
110
-		if( ! $discounts ) {
110
+		if ( ! $discounts ) {
111 111
 			return $value;
112 112
 		}
113 113
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		 * @see GF_Field_Coupon::get_field_input
117 117
 		 */
118 118
 		$_POST = ! isset( $_POST ) ? array() : $_POST;
119
-		$_POST[ 'gf_coupons_' . $form['id'] ] = json_encode( (array) $discounts );
119
+		$_POST[ 'gf_coupons_' . $form[ 'id' ] ] = json_encode( (array)$discounts );
120 120
 		$_POST[ 'input_' . $field->id ] = implode( ',', $coupon_codes );
121 121
 
122 122
 		return $value;
Please login to merge, or discard this patch.
includes/admin/field-types/type_multiselect.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 		?>
14 14
 		<label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php
15 15
 
16
-			echo '<span class="gv-label">'.$this->get_field_label().'</span>';
16
+			echo '<span class="gv-label">' . $this->get_field_label() . '</span>';
17 17
 
18 18
 			echo $this->get_tooltip() . $this->get_field_desc();
19 19
 
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
 
27 27
 	function render_input( $override_input = null ) {
28 28
 
29
-		if( isset( $override_input ) ) {
29
+		if ( isset( $override_input ) ) {
30 30
 			echo $override_input;
31 31
 			return;
32 32
 		}
33 33
 
34 34
 		?>
35 35
 		<select name="<?php echo esc_attr( $this->name ); ?>[]" id="<?php echo $this->get_field_id(); ?>" multiple="multiple">
36
-			<?php foreach( $this->field['options'] as $value => $label ) : ?>
36
+			<?php foreach ( $this->field[ 'options' ] as $value => $label ) : ?>
37 37
 				<option value="<?php echo esc_attr( $value ); ?>" <?php selected( in_array( $value, (array)$this->value ), true, true ); ?>><?php echo esc_html( $label ); ?></option>
38 38
 			<?php endforeach; ?>
39 39
 		</select>
Please login to merge, or discard this patch.