Completed
Push — develop ( f5e79f...748d21 )
by Zack
06:59
created
future/includes/rest/class-gv-rest-route.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
 		$format = '(?:\.(?P<format>html|json))?';
134 134
 
135
-		register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ) , array(
135
+		register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ), array(
136 136
 			array(
137 137
 				'methods'         => \WP_REST_Server::READABLE,
138 138
 				'callback'        => array( $this, 'get_sub_item' ),
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	 * @return \WP_REST_Response
383 383
 	 */
384 384
 	protected function not_implemented() {
385
-		$error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' )  );
385
+		$error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' ) );
386 386
 		return new \WP_REST_Response( $error, 501 );
387 387
 	}
388 388
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-textarea.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@
 block discarded – undo
39 39
 			'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ),
40 40
 		);
41 41
 
42
-        $field_options['make_clickable'] = array(
43
-            'type' => 'checkbox',
44
-            'merge_tags' => false,
45
-            'value' => 0,
46
-            'label' => __( 'Convert text URLs to HTML links', 'gravityview' ),
47
-            'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ),
48
-        );
42
+		$field_options['make_clickable'] = array(
43
+			'type' => 'checkbox',
44
+			'merge_tags' => false,
45
+			'value' => 0,
46
+			'label' => __( 'Convert text URLs to HTML links', 'gravityview' ),
47
+			'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ),
48
+		);
49 49
 
50 50
 		$field_options['allow_html'] = array(
51 51
 			'type' => 'checkbox',
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 
28 28
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
29 29
 
30
-		if( 'edit' === $context ) {
30
+		if ( 'edit' === $context ) {
31 31
 			return $field_options;
32 32
 		}
33 33
 
34
-		$field_options['trim_words'] = array(
34
+		$field_options[ 'trim_words' ] = array(
35 35
 			'type' => 'number',
36 36
 			'merge_tags' => false,
37 37
 			'value' => null,
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 			'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ),
40 40
 		);
41 41
 
42
-        $field_options['make_clickable'] = array(
42
+        $field_options[ 'make_clickable' ] = array(
43 43
             'type' => 'checkbox',
44 44
             'merge_tags' => false,
45 45
             'value' => 0,
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ),
48 48
         );
49 49
 
50
-		$field_options['allow_html'] = array(
50
+		$field_options[ 'allow_html' ] = array(
51 51
 			'type' => 'checkbox',
52 52
 			'merge_tags' => false,
53 53
 			'value' => 1,
Please login to merge, or discard this patch.
includes/admin/field-types/type_number.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * number input type
4 4
  */
5 5
 
6
-if( !class_exists('GravityView_FieldType_text') ) {
6
+if ( ! class_exists( 'GravityView_FieldType_text' ) ) {
7 7
 	include_once( GRAVITYVIEW_DIR . 'includes/admin/field-types/type_text.php' );
8 8
 }
9 9
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 		$show_mt = $this->show_merge_tags();
22 22
 
23
-		if ( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
23
+		if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) {
24 24
 			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
25 25
 		}
26 26
 
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 		$step = \GV\Utils::get( $this->field, 'step', null );
32 32
 
33 33
 		$atts = '';
34
-		$atts .= $max ? ' max="' . (int) $max . '"' : '';
35
-		$atts .= $min ? ' min="' . (int) $min . '"' : '';
36
-		$atts .= $step ? ' step="' . (int) $step . '"' : '';
34
+		$atts .= $max ? ' max="' . (int)$max . '"' : '';
35
+		$atts .= $min ? ' min="' . (int)$min . '"' : '';
36
+		$atts .= $step ? ' step="' . (int)$step . '"' : '';
37 37
 		?>
38 38
 		<input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="number"
39 39
 		       value="<?php echo esc_attr( $this->value ); ?>"
Please login to merge, or discard this patch.
class-gravityview-plugin-hooks-gravityformspartialentries.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 		$partial_entries_addon = GF_Partial_Entries::get_instance();
55 55
 
56
-		$feed_settings = $partial_entries_addon->get_feed_settings( $form['id'] );
56
+		$feed_settings = $partial_entries_addon->get_feed_settings( $form[ 'id' ] );
57 57
 
58 58
 		$is_enabled = \GV\Utils::get( $feed_settings, 'enable', 0 );
59 59
 
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
 		$partial_entry_id = \GV\Utils::get( $entry, 'partial_entry_id' );
67 67
 
68 68
 		// Set the expected $_POST key for the Add-On to use
69
-		$_POST['partial_entry_id'] = $partial_entry_id;
69
+		$_POST[ 'partial_entry_id' ] = $partial_entry_id;
70 70
 
71 71
 		gravityview()->log->debug( 'Saving partial entry (ID #{partial_entry_id}) for Entry #{entry_id}', array(
72 72
 			'partial_entry_id' => $partial_entry_id,
73 73
 			'entry_id'         => $entry_id
74 74
 		) );
75 75
 
76
-		$partial_entries_addon->maybe_save_partial_entry( $form['id'] );
76
+		$partial_entries_addon->maybe_save_partial_entry( $form[ 'id' ] );
77 77
 	}
78 78
 }
79 79
 
Please login to merge, or discard this patch.
includes/presets/default-table/class-gravityview-default-template-table.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -88,15 +88,15 @@
 block discarded – undo
88 88
 	 */
89 89
 	public function maybe_modify_button_label( $label = '', $atts = array() ) {
90 90
 
91
-		if( $this->template_id !== \GV\Utils::get( $atts, 'template_id' ) ) {
91
+		if ( $this->template_id !== \GV\Utils::get( $atts, 'template_id' ) ) {
92 92
 			return $label;
93 93
 		}
94 94
 
95
-		if( 'field' !== \GV\Utils::get( $atts, 'type' ) ) {
95
+		if ( 'field' !== \GV\Utils::get( $atts, 'type' ) ) {
96 96
 			return $label;
97 97
 		}
98 98
 
99
-		if( 'edit' === \GV\Utils::get( $atts, 'zone' ) ) {
99
+		if ( 'edit' === \GV\Utils::get( $atts, 'zone' ) ) {
100 100
 			return $label;
101 101
 		}
102 102
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-address.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 				continue;
63 63
 			}
64 64
 
65
-			$field_id = intval( floor( $search_field['key'] ) );
66
-			$input_id = gravityview_get_input_id_from_id( $search_field['key'] );
65
+			$field_id = intval( floor( $search_field[ 'key' ] ) );
66
+			$input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] );
67 67
 			$form = GravityView_View::getInstance()->getForm();
68 68
 
69 69
 			/** @var GF_Field_Address $address_field */
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			$choices = array();
73 73
 
74 74
 			$method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id );
75
-			if( method_exists( $this, $method_name ) ) {
75
+			if ( method_exists( $this, $method_name ) ) {
76 76
 				/**
77 77
 				 * @uses GravityView_Field_Address::get_choices_country()
78 78
 				 * @uses GravityView_Field_Address::get_choices_state()
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
 				$choices = $this->{$method_name}( $address_field, $form );
81 81
 			}
82 82
 
83
-			if( ! empty( $choices ) ) {
84
-				$search_field['choices'] = $choices;
85
-				$search_field['type'] = \GV\Utils::get( $search_field, 'input');
83
+			if ( ! empty( $choices ) ) {
84
+				$search_field[ 'choices' ] = $choices;
85
+				$search_field[ 'type' ] = \GV\Utils::get( $search_field, 'input' );
86 86
 			} else {
87
-				$search_field['type'] = 'text';
88
-				$search_field['input'] = 'input_text';
87
+				$search_field[ 'type' ] = 'text';
88
+				$search_field[ 'input' ] = 'input_text';
89 89
 			}
90 90
 		}
91 91
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 		$country_choices = array();
111 111
 
112 112
 		foreach ( $countries as $key => $country ) {
113
-			$country_choices[] = array(
113
+			$country_choices[ ] = array(
114 114
 				'value' => $country,
115 115
 				'text' => $country,
116 116
 			);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	private function get_choices_state( $address_field, $form ) {
137 137
 
138
-		$address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType;
138
+		$address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType;
139 139
 
140 140
 		$state_choices = array();
141 141
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 				$states = GFCommon::get_canadian_provinces();
148 148
 				break;
149 149
 			default:
150
-				$address_types = $address_field->get_address_types( $form['id'] );
151
-				$states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states'];
150
+				$address_types = $address_field->get_address_types( $form[ 'id' ] );
151
+				$states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ];
152 152
 				break;
153 153
 		}
154 154
 
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
 				$state_subchoices = array();
158 158
 
159 159
 				foreach ( $state as $key => $substate ) {
160
-					$state_subchoices[] = array(
160
+					$state_subchoices[ ] = array(
161 161
 						'value' => is_numeric( $key ) ? $substate : $key,
162 162
 						'text' => $substate,
163 163
 					);
164 164
 				}
165 165
 
166
-				$state_choices[] = array(
166
+				$state_choices[ ] = array(
167 167
 					'text' => $key,
168 168
 					'value' => $state_subchoices,
169 169
 				);
170 170
 
171 171
 			} else {
172
-				$state_choices[] = array(
172
+				$state_choices[ ] = array(
173 173
 					'value' => is_numeric( $key ) ? $state : $key,
174 174
 					'text' => $state,
175 175
 				);
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
 		// Use the same inputs as the "text" input type allows
194 194
 		$text_inputs = \GV\Utils::get( $input_types, 'text' );
195 195
 
196
-		$input_types['street'] = $text_inputs;
197
-		$input_types['street2'] = $text_inputs;
198
-		$input_types['city'] = $text_inputs;
196
+		$input_types[ 'street' ] = $text_inputs;
197
+		$input_types[ 'street2' ] = $text_inputs;
198
+		$input_types[ 'city' ] = $text_inputs;
199 199
 
200
-		$input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs;
201
-		$input_types['zip'] = array( 'input_text' );
202
-		$input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs;
200
+		$input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs;
201
+		$input_types[ 'zip' ] = array( 'input_text' );
202
+		$input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs;
203 203
 
204 204
 		return $input_types;
205 205
 	}
@@ -220,12 +220,12 @@  discard block
 block discarded – undo
220 220
 		// Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)?
221 221
 		$input_id = gravityview_get_input_id_from_id( $field_id );
222 222
 
223
-		if( 'address' !== $field_type && $input_id ) {
223
+		if ( 'address' !== $field_type && $input_id ) {
224 224
 			return $input_type;
225 225
 		}
226 226
 
227 227
 		// If the input ID matches an expected address input, set to that. Otherwise, keep existing input type.
228
-		if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) {
228
+		if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) {
229 229
 			$input_type = $address_field_name;
230 230
 		}
231 231
 
@@ -273,20 +273,20 @@  discard block
 block discarded – undo
273 273
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
274 274
 
275 275
 		// If this is NOT the full address field, return default options.
276
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
276
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
277 277
 			return $field_options;
278 278
 		}
279 279
 
280
-		if( 'edit' === $context ) {
280
+		if ( 'edit' === $context ) {
281 281
 			return $field_options;
282 282
 		}
283 283
 
284 284
 		$add_options = array();
285 285
 
286
-		$add_options['show_map_link'] = array(
286
+		$add_options[ 'show_map_link' ] = array(
287 287
 			'type' => 'checkbox',
288 288
 			'label' => __( 'Show Map Link:', 'gravityview' ),
289
-			'desc' => __('Display a "Map It" link below the address', 'gravityview'),
289
+			'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ),
290 290
 			'value' => true,
291 291
 			'merge_tags' => false,
292 292
 		);
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-view-item.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	protected $form_id;
46 46
 
47
-	function __construct( $title = '', $item_id = '', $item = array(), $settings = array(), $form_id = null) {
47
+	function __construct( $title = '', $item_id = '', $item = array(), $settings = array(), $form_id = null ) {
48 48
 
49 49
 		// Backward compat
50
-		if ( ! empty( $item['type'] ) ) {
51
-			$item['input_type'] = $item['type'];
52
-			unset( $item['type'] );
50
+		if ( ! empty( $item[ 'type' ] ) ) {
51
+			$item[ 'input_type' ] = $item[ 'type' ];
52
+			unset( $item[ 'type' ] );
53 53
 		}
54 54
 
55 55
 		if ( $admin_label = \GV\Utils::get( $settings, 'admin_label' ) ) {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		$this->id         = $item_id;
76 76
 		$this->form_id    = $form_id;
77 77
 		$this->settings   = $settings;
78
-		$this->label_type = $item['label_type'];
78
+		$this->label_type = $item[ 'label_type' ];
79 79
 	}
80 80
 
81 81
 	/**
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 
120 120
 			foreach ( $field_info_items as $item ) {
121 121
 
122
-				if( \GV\Utils::get( $item, 'hide_in_picker', false ) ) {
122
+				if ( \GV\Utils::get( $item, 'hide_in_picker', false ) ) {
123 123
 					continue;
124 124
 				}
125 125
 
126
-				$class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description';
126
+				$class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description';
127 127
 				// Add the title in case the value's long, in which case, it'll be truncated by CSS.
128 128
 				$output .= '<span class="' . $class . '">';
129
-				$output .= esc_html( $item['value'] );
129
+				$output .= esc_html( $item[ 'value' ] );
130 130
 				$output .= '</span>';
131 131
 			}
132 132
 
@@ -154,21 +154,21 @@  discard block
 block discarded – undo
154 154
 
155 155
 		// $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know.
156 156
 		// TODO: Un-hack this
157
-		$hide_settings_link_class = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
158
-		$settings_link      = sprintf( '<button class="gv-field-settings" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons %2$s"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class );
157
+		$hide_settings_link_class = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
158
+		$settings_link = sprintf( '<button class="gv-field-settings" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons %2$s"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class );
159 159
 
160 160
 		// Should we show the icon that the field is being used as a link to single entry?
161
-		$hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : '';
161
+		$hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : '';
162 162
 		$show_as_link            = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>';
163 163
 
164 164
 		// When a field label is empty, use the Field ID
165 165
 		$label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title;
166 166
 
167 167
 		// If there's a custom label, and show label is checked, use that as the field heading
168
-		if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) {
169
-			$label = $this->settings['custom_label'];
170
-		} else if ( ! empty( $this->item['customLabel'] ) ) {
171
-			$label = $this->item['customLabel'];
168
+		if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) {
169
+			$label = $this->settings[ 'custom_label' ];
170
+		} else if ( ! empty( $this->item[ 'customLabel' ] ) ) {
171
+			$label = $this->item[ 'customLabel' ];
172 172
 		}
173 173
 		$label = esc_attr( $label );
174 174
 
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 
177 177
 		$output .= '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">';
178 178
 
179
-		if ( ! empty( $this->item['parent'] ) ) {
180
-			$label .= ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>';
179
+		if ( ! empty( $this->item[ 'parent' ] ) ) {
180
+			$label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>';
181 181
 		}
182 182
 
183 183
 		// Name of field / widget
@@ -193,10 +193,10 @@  discard block
 block discarded – undo
193 193
 
194 194
 		$output .= '</h5>';
195 195
 
196
-		$container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : '';
197
-		$data_form_id   = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : '';
196
+		$container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : '';
197
+		$data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : '';
198 198
 
199
-		$output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>';
199
+		$output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>';
200 200
 
201 201
 		return $output;
202 202
 	}
Please login to merge, or discard this patch.
includes/admin/class.render.settings.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$is_table_layout = preg_match( '/table/ism', $template_id );
32 32
 
33
-		if( 'field' === $field_type ) {
33
+		if ( 'field' === $field_type ) {
34 34
 
35 35
 			// Default options - fields
36 36
 			$field_options = array(
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 				'custom_class' => array(
50 50
 					'type' => 'text',
51 51
 					'label' => __( 'Custom CSS Class:', 'gravityview' ),
52
-					'desc' => __( 'This class will be added to the field container', 'gravityview'),
52
+					'desc' => __( 'This class will be added to the field container', 'gravityview' ),
53 53
 					'value' => '',
54 54
 					'merge_tags' => true,
55 55
 					'tooltip' => 'gv_css_merge_tags',
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 			);
71 71
 
72 72
 			// Match Table as well as DataTables
73
-			if( $is_table_layout && 'directory' === $context ) {
74
-				$field_options['width'] = array(
73
+			if ( $is_table_layout && 'directory' === $context ) {
74
+				$field_options[ 'width' ] = array(
75 75
 					'type' => 'number',
76
-					'label' => __('Percent Width', 'gravityview'),
77
-					'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview'),
76
+					'label' => __( 'Percent Width', 'gravityview' ),
77
+					'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview' ),
78 78
 					'class' => 'code widefat',
79 79
 					'value' => '',
80 80
 				);
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 			'manage_options' => __( 'Administrator', 'gravityview' ),
130 130
 		);
131 131
 
132
-		if( is_multisite() ) {
133
-			$select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' );
132
+		if ( is_multisite() ) {
133
+			$select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gravityview' );
134 134
 		}
135 135
 
136 136
 		/**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		 * @param  string $context     Optional. What context are we in? Example: `single` or `directory`
144 144
 		 * @param  string $input_type  Optional. (textarea, list, select, etc.)
145 145
 		 */
146
-		$select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type );
146
+		$select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type );
147 147
 
148 148
 		return $select_cap_choices;
149 149
 	}
@@ -171,27 +171,27 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	public static function render_field_options( $form_id, $field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array() ) {
173 173
 
174
-		if( empty( $uniqid ) ) {
174
+		if ( empty( $uniqid ) ) {
175 175
 			//generate a unique field id
176
-			$uniqid = uniqid('', false);
176
+			$uniqid = uniqid( '', false );
177 177
 		}
178 178
 
179 179
 		// get field/widget options
180 180
 		$options = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type, $form_id );
181 181
 
182 182
 		// two different post arrays, depending of the field type
183
-		$name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']';
183
+		$name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']';
184 184
 
185 185
 		// build output
186 186
 		$output = '';
187
-		$output .= '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">';
188
-		$output .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">';
187
+		$output .= '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">';
188
+		$output .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">';
189 189
 		if ( $form_id ) {
190
-			$output .= '<input type="hidden" class="field-form-id" name="'. $name_prefix .'[form_id]" value="'. esc_attr( $form_id ) .'">';
190
+			$output .= '<input type="hidden" class="field-form-id" name="' . $name_prefix . '[form_id]" value="' . esc_attr( $form_id ) . '">';
191 191
 		}
192 192
 
193 193
 		// If there are no options, return what we got.
194
-		if(empty($options)) {
194
+		if ( empty( $options ) ) {
195 195
 
196 196
 			// This is here for checking if the output is empty in render_label()
197 197
 			$output .= '<!-- No Options -->';
@@ -199,33 +199,33 @@  discard block
 block discarded – undo
199 199
 			return $output;
200 200
 		}
201 201
 
202
-		$output .= '<div class="gv-dialog-options" title="'. esc_attr( sprintf( __( 'Options: %s', 'gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ) .'">';
202
+		$output .= '<div class="gv-dialog-options" title="' . esc_attr( sprintf( __( 'Options: %s', 'gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) ) . '">';
203 203
 
204 204
 		/**
205 205
 		 * @since 1.8
206 206
 		 */
207
-		if( !empty( $item['subtitle'] ) ) {
208
-			$output .= '<div class="subtitle">' . $item['subtitle'] . '</div>';
207
+		if ( ! empty( $item[ 'subtitle' ] ) ) {
208
+			$output .= '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>';
209 209
 		}
210 210
 
211
-		foreach( $options as $key => $option ) {
211
+		foreach ( $options as $key => $option ) {
212 212
 
213 213
 			$value = isset( $current[ $key ] ) ? $current[ $key ] : NULL;
214 214
 
215
-			$field_output = self::render_field_option( $name_prefix . '['. $key .']' , $option, $value);
215
+			$field_output = self::render_field_option( $name_prefix . '[' . $key . ']', $option, $value );
216 216
 
217 217
 			// The setting is empty
218
-			if( empty( $field_output ) ) {
218
+			if ( empty( $field_output ) ) {
219 219
 				continue;
220 220
 			}
221 221
 
222
-			switch( $option['type'] ) {
222
+			switch ( $option[ 'type' ] ) {
223 223
 				// Hide hidden fields
224 224
 				case 'hidden':
225
-					$output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . ' screen-reader-text">'. $field_output . '</div>';
225
+					$output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>';
226 226
 					break;
227 227
 				default:
228
-					$output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . '">'. $field_output .'</div>';
228
+					$output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . '">' . $field_output . '</div>';
229 229
 			}
230 230
 		}
231 231
 
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
 		 * @deprecated setting index 'default' was replaced by 'value'
255 255
 		 * @see GravityView_FieldType::get_field_defaults
256 256
 		 */
257
-		if( !empty( $option['default'] ) && empty( $option['value'] ) ) {
258
-			$option['value'] = $option['default'];
259
-			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' );
257
+		if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) {
258
+			$option[ 'value' ] = $option[ 'default' ];
259
+			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' );
260 260
 		}
261 261
 
262 262
 		// prepare to render option field type
263
-		if( isset( $option['type'] ) ) {
263
+		if ( isset( $option[ 'type' ] ) ) {
264 264
 
265 265
 			$type_class = self::load_type_class( $option );
266 266
 
267
-			if( class_exists( $type_class ) ) {
267
+			if ( class_exists( $type_class ) ) {
268 268
 
269 269
 				/** @var GravityView_FieldType $render_type */
270 270
 				$render_type = new $type_class( $name, $option, $curr_value );
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 				 * @param[in,out] string $output field class name
282 282
 				 * @param[in] array $option  option field data
283 283
 				 */
284
-				$output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option );
284
+				$output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option );
285 285
 			}
286 286
 
287 287
 		} // isset option[type]
@@ -316,27 +316,27 @@  discard block
 block discarded – undo
316 316
 		 * @deprecated setting index 'name' was replaced by 'label'
317 317
 		 * @see GravityView_FieldType::get_field_defaults
318 318
 		 */
319
-		if( isset( $setting['name'] ) && empty( $setting['label'] ) ) {
320
-			$setting['label'] = $setting['name'];
321
-			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' );
319
+		if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) {
320
+			$setting[ 'label' ] = $setting[ 'name' ];
321
+			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' );
322 322
 		}
323 323
 
324 324
 		$name = esc_attr( sprintf( $name, $key ) );
325
-		$setting['id'] = esc_attr( sprintf( $id, $key ) );
326
-		$setting['tooltip'] = 'gv_' . $key;
325
+		$setting[ 'id' ] = esc_attr( sprintf( $id, $key ) );
326
+		$setting[ 'tooltip' ] = 'gv_' . $key;
327 327
 
328 328
 		// Use default if current setting isn't set.
329
-		$curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value'];
329
+		$curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ];
330 330
 
331 331
 		// default setting type = text
332
-		$setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type'];
332
+		$setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ];
333 333
 
334 334
 		// merge tags
335
-		if( !isset( $setting['merge_tags'] ) ) {
336
-			if( $setting['type'] === 'text' ) {
337
-				$setting['merge_tags'] = true;
335
+		if ( ! isset( $setting[ 'merge_tags' ] ) ) {
336
+			if ( $setting[ 'type' ] === 'text' ) {
337
+				$setting[ 'merge_tags' ] = true;
338 338
 			} else {
339
-				$setting['merge_tags'] = false;
339
+				$setting[ 'merge_tags' ] = false;
340 340
 			}
341 341
 		}
342 342
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 
345 345
 		// render the setting
346 346
 		$type_class = self::load_type_class( $setting );
347
-		if( class_exists( $type_class ) ) {
347
+		if ( class_exists( $type_class ) ) {
348 348
 			/** @var GravityView_FieldType $render_type */
349 349
 			$render_type = new $type_class( $name, $setting, $curr_value );
350 350
 			ob_start();
@@ -353,25 +353,25 @@  discard block
 block discarded – undo
353 353
 		}
354 354
 
355 355
 		// Check if setting is specific for a template
356
-		if( !empty( $setting['show_in_template'] ) ) {
357
-			if( !is_array( $setting['show_in_template'] ) ) {
358
-				$setting['show_in_template'] = array( $setting['show_in_template'] );
356
+		if ( ! empty( $setting[ 'show_in_template' ] ) ) {
357
+			if ( ! is_array( $setting[ 'show_in_template' ] ) ) {
358
+				$setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] );
359 359
 			}
360
-			$show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"';
360
+			$show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"';
361 361
 		} else {
362 362
 			$show_if = '';
363 363
 		}
364 364
 
365
-		if( ! empty( $setting['requires'] ) ) {
366
-			$show_if .= sprintf( ' data-requires="%s"', $setting['requires'] );
365
+		if ( ! empty( $setting[ 'requires' ] ) ) {
366
+			$show_if .= sprintf( ' data-requires="%s"', $setting[ 'requires' ] );
367 367
 		}
368 368
 
369
-		if( ! empty( $setting['requires_not'] ) ) {
370
-			$show_if .= sprintf( ' data-requires-not="%s"', $setting['requires_not'] );
369
+		if ( ! empty( $setting[ 'requires_not' ] ) ) {
370
+			$show_if .= sprintf( ' data-requires-not="%s"', $setting[ 'requires_not' ] );
371 371
 		}
372 372
 
373 373
 		// output
374
-		echo '<tr style="vertical-align: top;" '. $show_if .'>' . $output . '</tr>';
374
+		echo '<tr style="vertical-align: top;" ' . $show_if . '>' . $output . '</tr>';
375 375
 
376 376
 	}
377 377
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 */
384 384
 	public static function load_type_class( $field = NULL ) {
385 385
 
386
-		if( empty( $field['type'] ) ) {
386
+		if ( empty( $field[ 'type' ] ) ) {
387 387
 			return NULL;
388 388
 		}
389 389
 
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
 		 * @param string $class_suffix  field class suffix; `GravityView_FieldType_{$class_suffix}`
393 393
 		 * @param array $field   field data
394 394
 		 */
395
-		$type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field );
395
+		$type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field );
396 396
 
397
-		if( class_exists( $type_class ) ) {
397
+		if ( class_exists( $type_class ) ) {
398 398
 			return $type_class;
399 399
 		}
400 400
 
@@ -403,9 +403,9 @@  discard block
 block discarded – undo
403 403
 		 * @param string  $field_type_include_path field class file path
404 404
 		 * @param array $field  field data
405 405
 		 */
406
-		$class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field );
406
+		$class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field );
407 407
 
408
-		if( $class_file && file_exists( $class_file ) ) {
408
+		if ( $class_file && file_exists( $class_file ) ) {
409 409
 			require_once( $class_file );
410 410
 		}
411 411
 
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
 
428 428
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' );
429 429
 
430
-		$output  = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">';
431
-		$output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >';
430
+		$output  = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">';
431
+		$output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >';
432 432
 
433 433
 		return $output;
434 434
 	}
@@ -448,22 +448,22 @@  discard block
 block discarded – undo
448 448
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_text::render_input' );
449 449
 
450 450
 		// Show the merge tags if the field is a list view
451
-		$is_list = ( preg_match( '/_list-/ism', $name ));
451
+		$is_list = ( preg_match( '/_list-/ism', $name ) );
452 452
 
453 453
 		// Or is a single entry view
454
-		$is_single = ( preg_match( '/single_/ism', $name ));
454
+		$is_single = ( preg_match( '/single_/ism', $name ) );
455 455
 		$show = ( $is_single || $is_list );
456 456
 
457 457
 		$class = '';
458 458
 		// and $add_merge_tags is not false
459
-		if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
459
+		if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
460 460
 			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
461 461
 		}
462 462
 
463
-		$class .= !empty( $args['class'] ) ? $args['class'] : 'widefat';
464
-		$type = !empty( $args['type'] ) ? $args['type'] : 'text';
463
+		$class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat';
464
+		$type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text';
465 465
 
466
-		return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">';
466
+		return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">';
467 467
 	}
468 468
 
469 469
 	/**
@@ -480,21 +480,21 @@  discard block
 block discarded – undo
480 480
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_textarea::render_input' );
481 481
 
482 482
 		// Show the merge tags if the field is a list view
483
-		$is_list = ( preg_match( '/_list-/ism', $name ));
483
+		$is_list = ( preg_match( '/_list-/ism', $name ) );
484 484
 
485 485
 		// Or is a single entry view
486
-		$is_single = ( preg_match( '/single_/ism', $name ));
486
+		$is_single = ( preg_match( '/single_/ism', $name ) );
487 487
 		$show = ( $is_single || $is_list );
488 488
 
489 489
 		$class = '';
490 490
 		// and $add_merge_tags is not false
491
-		if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
491
+		if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
492 492
 			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
493 493
 		}
494 494
 
495
-		$class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat';
495
+		$class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat';
496 496
 
497
-		return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>';
497
+		return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>';
498 498
 	}
499 499
 
500 500
 	/**
@@ -510,9 +510,9 @@  discard block
 block discarded – undo
510 510
 
511 511
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_select::render_input' );
512 512
 
513
-		$output = '<select name="'. $name .'" id="'. $id .'">';
514
-		foreach( $choices as $value => $label ) {
515
-			$output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>';
513
+		$output = '<select name="' . $name . '" id="' . $id . '">';
514
+		foreach ( $choices as $value => $label ) {
515
+			$output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>';
516 516
 		}
517 517
 		$output .= '</select>';
518 518
 
Please login to merge, or discard this patch.
future/includes/class-gv-utils.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 * @param string $name The key name (will be prefixed).
53 53
 	 * @param mixed $default The default value if not found (Default: null)
54 54
 	 *
55
-	 * @return mixed The value or $default if not found.
55
+	 * @return string The value or $default if not found.
56 56
 	 */
57 57
 	public static function _SERVER( $name, $default = null ) {
58 58
 		return self::get( $_SERVER, $name, $default );
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @param mixed $value The value to return from the closure.
128 128
 	 *
129
-	 * @return Closure The closure with the $value bound.
129
+	 * @return \Closure The closure with the $value bound.
130 130
 	 */
131 131
 	public static function _return( $value ) {
132 132
 		return function() use ( $value ) { return $value; };
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 		 * Try subkeys after split.
92 92
 		 */
93 93
 		if ( count( $parts = explode( '/', $key, 2 ) ) > 1 ) {
94
-			return self::get( self::get( $array, $parts[0] ), $parts[1], $default );
94
+			return self::get( self::get( $array, $parts[ 0 ] ), $parts[ 1 ], $default );
95 95
 		}
96 96
 
97 97
 		return $default;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	public static function gf_query_debug( $query ) {
146 146
 		$introspect = $query->_introspect();
147 147
 		return array(
148
-			'where' => $query->_where_unwrap( $introspect['where'] )
148
+			'where' => $query->_where_unwrap( $introspect[ 'where' ] )
149 149
 		);
150 150
 	}
151 151
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 		if ( $condition->expressions ) {
159 159
 			$conditions = array();
160 160
 			foreach ( $condition->expressions as $expression ) {
161
-				$conditions[] = self::gf_query_strip_condition_column_aliases( $expression );
161
+				$conditions[ ] = self::gf_query_strip_condition_column_aliases( $expression );
162 162
 			}
163 163
 			return call_user_func_array(
164 164
 				array( '\GF_Query_Condition', $condition->operator == 'AND' ? '_and' : '_or' ),
Please login to merge, or discard this patch.