Completed
Push — master ( 9cf7be...029c15 )
by Zack
04:07
created
includes/admin/field-types/type_text.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 		?>
9 9
 		<label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php
10 10
 
11
-			echo '<span class="gv-label">'.$this->get_field_label().'</span>';
11
+			echo '<span class="gv-label">' . $this->get_field_label() . '</span>';
12 12
 			echo $this->get_tooltip() . $this->get_field_desc();
13 13
 		?><div>
14 14
 				<?php $this->render_input(); ?>
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 	function render_input( $override_input = null ) {
21 21
 
22
-		if( isset( $override_input ) ) {
22
+		if ( isset( $override_input ) ) {
23 23
 			echo $override_input;
24 24
 			return;
25 25
 		}
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 
29 29
 		$show_mt = $this->show_merge_tags();
30 30
 
31
-        if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
31
+        if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) {
32 32
             $class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
33 33
         }
34
-        $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat';
34
+        $class .= ! empty( $this->field[ 'class' ] ) ? $this->field[ 'class' ] : 'widefat';
35 35
 
36 36
 		?>
37 37
 		<input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>">
Please login to merge, or discard this patch.
includes/admin/field-types/type_select.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 		?>
9 9
 		<label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php
10 10
 
11
-			echo '<span class="gv-label">'.$this->get_field_label().'</span>';
11
+			echo '<span class="gv-label">' . $this->get_field_label() . '</span>';
12 12
 
13 13
 			echo $this->get_tooltip() . $this->get_field_desc();
14 14
 
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 	}
21 21
 
22 22
 	function render_input( $override_input = null ) {
23
-		if( isset( $override_input ) ) {
23
+		if ( isset( $override_input ) ) {
24 24
 			echo $override_input;
25 25
 			return;
26 26
 		}
27 27
 		?>
28 28
 		<select name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>">
29
-			<?php foreach( $this->field['options'] as $value => $label ) : ?>
29
+			<?php foreach ( $this->field[ 'options' ] as $value => $label ) : ?>
30 30
 				<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $this->value, true ); ?>><?php echo esc_html( $label ); ?></option>
31 31
 			<?php endforeach; ?>
32 32
 		</select>
Please login to merge, or discard this patch.
includes/admin/field-types/type_number.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@  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
 class GravityView_FieldType_number extends GravityView_FieldType_text {
10 10
 
11 11
 	function render_input( $override_input = null ) {
12
-		if( isset( $override_input ) ) {
12
+		if ( isset( $override_input ) ) {
13 13
 			echo $override_input;
14 14
 			return;
15 15
 		}
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 
19 19
 		$show_mt = $this->show_merge_tags();
20 20
 
21
-        if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
21
+        if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) {
22 22
             $class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
23 23
         }
24
-        $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat';
24
+        $class .= ! empty( $this->field[ 'class' ] ) ? $this->field[ 'class' ] : 'widefat';
25 25
 
26 26
 		?>
27 27
 		<input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="number" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>">
Please login to merge, or discard this patch.
includes/admin/class.field.type.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
         $defaults = self::get_field_defaults();
34 34
 
35 35
         // Backward compatibility
36
-        if( !empty( $field['choices'] ) ) {
37
-        	$field['options'] = $field['choices'];
38
-        	unset( $field['choices'] );
36
+        if ( ! empty( $field[ 'choices' ] ) ) {
37
+        	$field[ 'options' ] = $field[ 'choices' ];
38
+        	unset( $field[ 'choices' ] );
39 39
         }
40 40
 
41
-        $this->field =  wp_parse_args( $field, $defaults );
41
+        $this->field = wp_parse_args( $field, $defaults );
42 42
 
43
-        $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value;
43
+        $this->value = is_null( $curr_value ) ? $this->field[ 'value' ] : $curr_value;
44 44
 
45 45
     }
46 46
 
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 
79 79
 
80 80
     function get_tooltip() {
81
-        if( !function_exists('gform_tooltip') ) {
81
+        if ( ! function_exists( 'gform_tooltip' ) ) {
82 82
             return NULL;
83 83
         }
84 84
 
85
-        return !empty( $this->field['tooltip'] ) ? ' '.gform_tooltip( $this->field['tooltip'] , false, true ) : NULL;
85
+        return ! empty( $this->field[ 'tooltip' ] ) ? ' ' . gform_tooltip( $this->field[ 'tooltip' ], false, true ) : NULL;
86 86
     }
87 87
 
88 88
     /**
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
      * @return string
91 91
      */
92 92
     function get_field_id() {
93
-        if( isset( $this->field['id'] ) ) {
94
-            return esc_attr( $this->field['id'] );
93
+        if ( isset( $this->field[ 'id' ] ) ) {
94
+            return esc_attr( $this->field[ 'id' ] );
95 95
         }
96 96
         return esc_attr( sanitize_html_class( $this->name ) );
97 97
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @return string
102 102
      */
103 103
     function get_field_label() {
104
-        return esc_html( trim( $this->field['label'] ) );
104
+        return esc_html( trim( $this->field[ 'label' ] ) );
105 105
     }
106 106
 
107 107
 	/**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 * @return string
113 113
 	 */
114 114
 	function get_field_left_label() {
115
-		return ! empty( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL;
115
+		return ! empty( $this->field[ 'left_label' ] ) ? esc_html( trim( $this->field[ 'left_label' ] ) ) : NULL;
116 116
 	}
117 117
 
118 118
     /**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      * @return string
121 121
      */
122 122
     function get_label_class() {
123
-        return 'gv-label-'. sanitize_html_class( $this->field['type'] );
123
+        return 'gv-label-' . sanitize_html_class( $this->field[ 'type' ] );
124 124
     }
125 125
 
126 126
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      * @return string
130 130
      */
131 131
     function get_field_desc() {
132
-        return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : '';
132
+        return ! empty( $this->field[ 'desc' ] ) ? '<span class="howto">' . $this->field[ 'desc' ] . '</span>' : '';
133 133
     }
134 134
 
135 135
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      */
163 163
     function render_setting( $override_input = NULL ) {
164 164
 
165
-        if( !empty( $this->field['full_width'] ) ) { ?>
165
+        if ( ! empty( $this->field[ 'full_width' ] ) ) { ?>
166 166
             <th scope="row" colspan="2">
167 167
                 <div>
168 168
                     <label for="<?php echo $this->get_field_id(); ?>">
Please login to merge, or discard this patch.
includes/admin/class.render.settings.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 		$field_options = array();
29 29
 
30
-		if( 'field' === $field_type ) {
30
+		if ( 'field' === $field_type ) {
31 31
 
32 32
 			// Default options - fields
33 33
 			$field_options = array(
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 				'custom_class' => array(
46 46
 					'type' => 'text',
47 47
 					'label' => __( 'Custom CSS Class:', 'gravityview' ),
48
-					'desc' => __( 'This class will be added to the field container', 'gravityview'),
48
+					'desc' => __( 'This class will be added to the field container', 'gravityview' ),
49 49
 					'value' => '',
50 50
 					'merge_tags' => true,
51 51
 					'tooltip' => 'gv_css_merge_tags',
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 			);
66 66
 
67 67
 			// Match Table as well as DataTables
68
-			if( preg_match( '/table/ism', $template_id ) && 'directory' === $context ) {
69
-				$field_options['width'] = array(
68
+			if ( preg_match( '/table/ism', $template_id ) && 'directory' === $context ) {
69
+				$field_options[ 'width' ] = array(
70 70
 					'type' => 'number',
71
-					'label' => __('Percent Width', 'gravityview'),
72
-					'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview'),
71
+					'label' => __( 'Percent Width', 'gravityview' ),
72
+					'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview' ),
73 73
 					'class' => 'code widefat',
74 74
 					'value' => '',
75 75
 				);
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 			'manage_options' => __( 'Administrator', 'gravityview' ),
123 123
 		);
124 124
 
125
-		if( is_multisite() ) {
126
-			$select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' );
125
+		if ( is_multisite() ) {
126
+			$select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gravityview' );
127 127
 		}
128 128
 
129 129
 		/**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		 * @param  string $context     Optional. What context are we in? Example: `single` or `directory`
137 137
 		 * @param  string $input_type  Optional. (textarea, list, select, etc.)
138 138
 		 */
139
-		$select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type );
139
+		$select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type );
140 140
 
141 141
 		return $select_cap_choices;
142 142
 	}
@@ -163,24 +163,24 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	public static function render_field_options( $field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array() ) {
165 165
 
166
-		if( empty( $uniqid ) ) {
166
+		if ( empty( $uniqid ) ) {
167 167
 			//generate a unique field id
168
-			$uniqid = uniqid('', false);
168
+			$uniqid = uniqid( '', false );
169 169
 		}
170 170
 
171 171
 		// get field/widget options
172 172
 		$options = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type );
173 173
 
174 174
 		// two different post arrays, depending of the field type
175
-		$name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']';
175
+		$name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']';
176 176
 
177 177
 		// build output
178 178
 		$output = '';
179
-		$output .= '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">';
180
-		$output .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">';
179
+		$output .= '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">';
180
+		$output .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">';
181 181
 
182 182
 		// If there are no options, return what we got.
183
-		if(empty($options)) {
183
+		if ( empty( $options ) ) {
184 184
 
185 185
 			// This is here for checking if the output is empty in render_label()
186 186
 			$output .= '<!-- No Options -->';
@@ -188,33 +188,33 @@  discard block
 block discarded – undo
188 188
 			return $output;
189 189
 		}
190 190
 
191
-		$output .= '<div class="gv-dialog-options" title="'. esc_attr( sprintf( __( 'Options: %s', 'gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ) .'">';
191
+		$output .= '<div class="gv-dialog-options" title="' . esc_attr( sprintf( __( 'Options: %s', 'gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) ) . '">';
192 192
 
193 193
 		/**
194 194
 		 * @since 1.8
195 195
 		 */
196
-		if( !empty( $item['subtitle'] ) ) {
197
-			$output .= '<div class="subtitle">' . $item['subtitle'] . '</div>';
196
+		if ( ! empty( $item[ 'subtitle' ] ) ) {
197
+			$output .= '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>';
198 198
 		}
199 199
 
200
-		foreach( $options as $key => $option ) {
200
+		foreach ( $options as $key => $option ) {
201 201
 
202 202
 			$value = isset( $current[ $key ] ) ? $current[ $key ] : NULL;
203 203
 
204
-			$field_output = self::render_field_option( $name_prefix . '['. $key .']' , $option, $value);
204
+			$field_output = self::render_field_option( $name_prefix . '[' . $key . ']', $option, $value );
205 205
 
206 206
 			// The setting is empty
207
-			if( empty( $field_output ) ) {
207
+			if ( empty( $field_output ) ) {
208 208
 				continue;
209 209
 			}
210 210
 
211
-			switch( $option['type'] ) {
211
+			switch ( $option[ 'type' ] ) {
212 212
 				// Hide hidden fields
213 213
 				case 'hidden':
214
-					$output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . ' screen-reader-text">'. $field_output . '</div>';
214
+					$output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>';
215 215
 					break;
216 216
 				default:
217
-					$output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . '">'. $field_output .'</div>';
217
+					$output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . '">' . $field_output . '</div>';
218 218
 			}
219 219
 		}
220 220
 
@@ -243,17 +243,17 @@  discard block
 block discarded – undo
243 243
 		 * @deprecated setting index 'default' was replaced by 'value'
244 244
 		 * @see GravityView_FieldType::get_field_defaults
245 245
 		 */
246
-		if( !empty( $option['default'] ) && empty( $option['value'] ) ) {
247
-			$option['value'] = $option['default'];
248
-			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' );
246
+		if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) {
247
+			$option[ 'value' ] = $option[ 'default' ];
248
+			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' );
249 249
 		}
250 250
 
251 251
 		// prepare to render option field type
252
-		if( isset( $option['type'] ) ) {
252
+		if ( isset( $option[ 'type' ] ) ) {
253 253
 
254 254
 			$type_class = self::load_type_class( $option );
255 255
 
256
-			if( class_exists( $type_class ) ) {
256
+			if ( class_exists( $type_class ) ) {
257 257
 
258 258
 				$render_type = new $type_class( $name, $option, $curr_value );
259 259
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 				 * @param[in,out] string $output field class name
270 270
 				 * @param[in] array $option  option field data
271 271
 				 */
272
-				$output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option );
272
+				$output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option );
273 273
 			}
274 274
 
275 275
 		} // isset option[type]
@@ -296,33 +296,33 @@  discard block
 block discarded – undo
296 296
 		$setting = GravityView_View_Data::get_default_arg( $key, true );
297 297
 
298 298
 		// If the key doesn't exist, there's something wrong.
299
-		if( empty( $setting ) ) { return; }
299
+		if ( empty( $setting ) ) { return; }
300 300
 
301 301
 		/**
302 302
 		 * @deprecated setting index 'name' was replaced by 'label'
303 303
 		 * @see GravityView_FieldType::get_field_defaults
304 304
 		 */
305
-		if( isset( $setting['name'] ) && empty( $setting['label'] ) ) {
306
-			$setting['label'] = $setting['name'];
307
-			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' );
305
+		if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) {
306
+			$setting[ 'label' ] = $setting[ 'name' ];
307
+			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' );
308 308
 		}
309 309
 
310 310
 		$name = esc_attr( sprintf( $name, $key ) );
311
-		$setting['id'] = esc_attr( sprintf( $id, $key ) );
312
-		$setting['tooltip'] = 'gv_' . $key;
311
+		$setting[ 'id' ] = esc_attr( sprintf( $id, $key ) );
312
+		$setting[ 'tooltip' ] = 'gv_' . $key;
313 313
 
314 314
 		// Use default if current setting isn't set.
315
-		$curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value'];
315
+		$curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ];
316 316
 
317 317
 		// default setting type = text
318
-		$setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type'];
318
+		$setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ];
319 319
 
320 320
 		// merge tags
321
-		if( !isset( $setting['merge_tags'] ) ) {
322
-			if( $setting['type'] === 'text' ) {
323
-				$setting['merge_tags'] = true;
321
+		if ( ! isset( $setting[ 'merge_tags' ] ) ) {
322
+			if ( $setting[ 'type' ] === 'text' ) {
323
+				$setting[ 'merge_tags' ] = true;
324 324
 			} else {
325
-				$setting['merge_tags'] = false;
325
+				$setting[ 'merge_tags' ] = false;
326 326
 			}
327 327
 		}
328 328
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 
331 331
 		// render the setting
332 332
 		$type_class = self::load_type_class( $setting );
333
-		if( class_exists( $type_class ) ) {
333
+		if ( class_exists( $type_class ) ) {
334 334
 			/** @var GravityView_FieldType $render_type */
335 335
 			$render_type = new $type_class( $name, $setting, $curr_value );
336 336
 			ob_start();
@@ -339,17 +339,17 @@  discard block
 block discarded – undo
339 339
 		}
340 340
 
341 341
 		// Check if setting is specific for a template
342
-		if( !empty( $setting['show_in_template'] ) ) {
343
-			if( !is_array( $setting['show_in_template'] ) ) {
344
-				$setting['show_in_template'] = array( $setting['show_in_template'] );
342
+		if ( ! empty( $setting[ 'show_in_template' ] ) ) {
343
+			if ( ! is_array( $setting[ 'show_in_template' ] ) ) {
344
+				$setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] );
345 345
 			}
346
-			$show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"';
346
+			$show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"';
347 347
 		} else {
348 348
 			$show_if = '';
349 349
 		}
350 350
 
351 351
 		// output
352
-		echo '<tr valign="top" '. $show_if .'>' . $output . '</tr>';
352
+		echo '<tr valign="top" ' . $show_if . '>' . $output . '</tr>';
353 353
 
354 354
 	}
355 355
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 	 */
362 362
 	public static function load_type_class( $field = NULL ) {
363 363
 
364
-		if( empty( $field['type'] ) ) {
364
+		if ( empty( $field[ 'type' ] ) ) {
365 365
 			return NULL;
366 366
 		}
367 367
 
@@ -370,19 +370,19 @@  discard block
 block discarded – undo
370 370
 		 * @param string $class_suffix  field class suffix; `GravityView_FieldType_{$class_suffix}`
371 371
 		 * @param array $field   field data
372 372
 		 */
373
-		$type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field );
373
+		$type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field );
374 374
 
375
-		if( !class_exists( $type_class ) ) {
375
+		if ( ! class_exists( $type_class ) ) {
376 376
 
377 377
 			/**
378 378
 			 * @filter `gravityview/setting/class_file/{field_type}`
379 379
 			 * @param string  $field_type_include_path field class file path
380 380
 			 * @param array $field  field data
381 381
 			 */
382
-			$class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field );
382
+			$class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field );
383 383
 
384
-			if( $class_file ) {
385
-				if( file_exists( $class_file ) ) {
384
+			if ( $class_file ) {
385
+				if ( file_exists( $class_file ) ) {
386 386
 					require_once( $class_file );
387 387
 				}
388 388
 			}
@@ -405,8 +405,8 @@  discard block
 block discarded – undo
405 405
 	 */
406 406
 	public static function render_checkbox_option( $name = '', $id = '', $current = '' ) {
407 407
 
408
-		$output  = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">';
409
-		$output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >';
408
+		$output  = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">';
409
+		$output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >';
410 410
 
411 411
 		return $output;
412 412
 	}
@@ -424,22 +424,22 @@  discard block
 block discarded – undo
424 424
 	public static function render_text_option( $name = '', $id = '', $current = '', $add_merge_tags = NULL, $args = array() ) {
425 425
 
426 426
 		// Show the merge tags if the field is a list view
427
-		$is_list = ( preg_match( '/_list-/ism', $name ));
427
+		$is_list = ( preg_match( '/_list-/ism', $name ) );
428 428
 
429 429
 		// Or is a single entry view
430
-		$is_single = ( preg_match( '/single_/ism', $name ));
430
+		$is_single = ( preg_match( '/single_/ism', $name ) );
431 431
 		$show = ( $is_single || $is_list );
432 432
 
433 433
 		$class = '';
434 434
 		// and $add_merge_tags is not false
435
-		if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
435
+		if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
436 436
 			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
437 437
 		}
438 438
 
439
-		$class .= !empty( $args['class'] ) ? $args['class'] : 'widefat';
440
-		$type = !empty( $args['type'] ) ? $args['type'] : 'text';
439
+		$class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat';
440
+		$type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text';
441 441
 
442
-		return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">';
442
+		return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">';
443 443
 	}
444 444
 
445 445
 	/**
@@ -454,21 +454,21 @@  discard block
 block discarded – undo
454 454
 	public static function render_textarea_option( $name = '', $id = '', $current = '', $add_merge_tags = NULL, $args = array() ) {
455 455
 
456 456
 		// Show the merge tags if the field is a list view
457
-		$is_list = ( preg_match( '/_list-/ism', $name ));
457
+		$is_list = ( preg_match( '/_list-/ism', $name ) );
458 458
 
459 459
 		// Or is a single entry view
460
-		$is_single = ( preg_match( '/single_/ism', $name ));
460
+		$is_single = ( preg_match( '/single_/ism', $name ) );
461 461
 		$show = ( $is_single || $is_list );
462 462
 
463 463
 		$class = '';
464 464
 		// and $add_merge_tags is not false
465
-		if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
465
+		if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
466 466
 			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
467 467
 		}
468 468
 
469
-		$class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat';
469
+		$class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat';
470 470
 
471
-		return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>';
471
+		return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>';
472 472
 	}
473 473
 
474 474
 	/**
@@ -482,9 +482,9 @@  discard block
 block discarded – undo
482 482
 	 */
483 483
 	public static function render_select_option( $name = '', $id = '', $choices, $current = '' ) {
484 484
 
485
-		$output = '<select name="'. $name .'" id="'. $id .'">';
486
-		foreach( $choices as $value => $label ) {
487
-			$output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>';
485
+		$output = '<select name="' . $name . '" id="' . $id . '">';
486
+		foreach ( $choices as $value => $label ) {
487
+			$output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>';
488 488
 		}
489 489
 		$output .= '</select>';
490 490
 
Please login to merge, or discard this patch.
includes/admin/class-gravityview-support-port.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 		) );
116 116
 
117 117
 		// This is just HTML we don't need.
118
-		unset( $response['message'] );
118
+		unset( $response[ 'message' ] );
119 119
 
120
-		switch ( intval( $response['license_limit'] ) ) {
120
+		switch ( intval( $response[ 'license_limit' ] ) ) {
121 121
 			case 1:
122 122
 				$package = 'Sol';
123 123
 				break;
@@ -128,24 +128,24 @@  discard block
 block discarded – undo
128 128
 				$package = 'Interstellar';
129 129
 				break;
130 130
 			default:
131
-				$package = sprintf( '%d-Site License', $response['license_limit'] );
131
+				$package = sprintf( '%d-Site License', $response[ 'license_limit' ] );
132 132
 		}
133 133
 
134 134
 		$data = array(
135 135
 			'email'                 => GravityView_Settings::getSetting( 'support-email' ),
136
-			'name'                  => $response['customer_name'],
137
-			'Valid License?'        => ucwords( $response['license'] ),
138
-			'License Key'           => $response['license_key'],
136
+			'name'                  => $response[ 'customer_name' ],
137
+			'Valid License?'        => ucwords( $response[ 'license' ] ),
138
+			'License Key'           => $response[ 'license_key' ],
139 139
 			'License Level'         => $package,
140 140
 			'Site Admin Email'      => get_bloginfo( 'admin_email' ),
141 141
 			'Support Email'         => GravityView_Settings::getSetting( 'support-email' ),
142
-			'License Limit'         => $response['license_limit'],
143
-			'Site Count'            => $response['site_count'],
144
-			'License Expires'       => $response['expires'],
145
-			'Activations Left'      => $response['activations_left'],
146
-			'Payment ID'            => $response['payment_id'],
147
-			'Payment Name'          => $response['customer_name'],
148
-			'Payment Email'         => $response['customer_email'],
142
+			'License Limit'         => $response[ 'license_limit' ],
143
+			'Site Count'            => $response[ 'site_count' ],
144
+			'License Expires'       => $response[ 'expires' ],
145
+			'Activations Left'      => $response[ 'activations_left' ],
146
+			'Payment ID'            => $response[ 'payment_id' ],
147
+			'Payment Name'          => $response[ 'customer_name' ],
148
+			'Payment Email'         => $response[ 'customer_email' ],
149 149
 			'WordPress Version'     => get_bloginfo( 'version', 'display' ),
150 150
 			'PHP Version'           => phpversion(),
151 151
 			'GravityView Version'   => GravityView_Plugin::version,
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
 
193 193
 				$plugin_data = get_plugin_data( $active_plugin );
194 194
 
195
-				$extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] );
195
+				$extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] );
196 196
 			}
197 197
 
198
-			if( ! empty( $extensions ) ) {
198
+			if ( ! empty( $extensions ) ) {
199 199
 				set_site_transient( self::related_plugins_key, $extensions, HOUR_IN_SECONDS );
200 200
 			} else {
201 201
 				return 'There was an error fetching related plugins.';
Please login to merge, or discard this patch.
includes/admin/entry-list.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 		add_action( 'gform_entries_first_column_actions', array( $this, 'add_edit_link' ), 10, 5 );
12 12
 
13 13
 		// Add script to enable edit link
14
-		add_action( 'admin_head-forms_page_gf_entries', array( $this, 'add_edit_script') );
14
+		add_action( 'admin_head-forms_page_gf_entries', array( $this, 'add_edit_script' ) );
15 15
 
16 16
 	}
17 17
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	public function add_edit_script() {
27 27
 
28 28
 		// We're on a single entry page, or at least not the Entries page.
29
-		if( !empty( $_GET['view'] ) && $_GET['view'] !== 'entries' ) { return; }
29
+		if ( ! empty( $_GET[ 'view' ] ) && $_GET[ 'view' ] !== 'entries' ) { return; }
30 30
 	?>
31 31
 		<script>
32 32
 		jQuery( document ).ready( function( $ ) {
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
 			'page' => 'gf_entries',
57 57
 			'view' => 'entry',
58 58
 			'id'	=> (int)$form_id,
59
-			'lid'	=>	(int)$lead["id"],
59
+			'lid'	=>	(int)$lead[ "id" ],
60 60
 			'screen_mode'	=> 'edit',
61 61
 		);
62 62
 		?>
63 63
 
64 64
 		<span class="edit edit_entry">
65 65
 			|
66
-		    <a title="<?php esc_attr_e( 'Edit this entry', 'gravityview'); ?>" href="<?php echo esc_url( add_query_arg( $params, admin_url( 'admin.php?page='.$query_string ) ) ); ?>"><?php esc_html_e( 'Edit', 'gravityview' ); ?></a>
66
+		    <a title="<?php esc_attr_e( 'Edit this entry', 'gravityview' ); ?>" href="<?php echo esc_url( add_query_arg( $params, admin_url( 'admin.php?page=' . $query_string ) ) ); ?>"><?php esc_html_e( 'Edit', 'gravityview' ); ?></a>
67 67
 		</span>
68 68
 		<?php
69 69
 	}
Please login to merge, or discard this patch.
includes/class-gravityview-entry-link-shortcode.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * @copydoc GravityView_Entry_Link_Shortcode::shortcode
73 73
 	 */
74 74
 	public function edit_shortcode( $atts, $content = null, $context = 'gv_edit_entry_link' ) {
75
-		$atts['action'] = 'edit';
75
+		$atts[ 'action' ] = 'edit';
76 76
 
77 77
 		return $this->shortcode( $atts, $content, $context );
78 78
 	}
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * @copydoc GravityView_Entry_Link_Shortcode::shortcode
86 86
 	 */
87 87
 	public function delete_shortcode( $atts, $content = null, $context = 'gv_delete_entry_link' ) {
88
-		$atts['action'] = 'delete';
88
+		$atts[ 'action' ] = 'delete';
89 89
 
90 90
 		return $this->shortcode( $atts, $content, $context );
91 91
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
 		$this->settings = shortcode_atts( self::$defaults, $atts, $context );
128 128
 
129
-		$this->view_id = empty( $this->settings['view_id'] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings['view_id'] );
129
+		$this->view_id = empty( $this->settings[ 'view_id' ] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings[ 'view_id' ] );
130 130
 
131 131
 		if ( empty( $this->view_id ) ) {
132 132
 			do_action( 'gravityview_log_error', __METHOD__ . ' A View ID was not defined and we are not inside a View' );
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
 			return null;
135 135
 		}
136 136
 
137
-		$this->entry = $this->get_entry( $this->settings['entry_id'] );
137
+		$this->entry = $this->get_entry( $this->settings[ 'entry_id' ] );
138 138
 
139 139
 		do_action( 'gravityview_log_debug', __METHOD__ . ' ' . $context . ' $atts: ', $atts );
140 140
 
141 141
 		if ( ! $this->has_cap() ) {
142
-			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the capability to ' . esc_attr( $this->settings['action'] ) . ' this entry: ' . $this->entry['id'] );
142
+			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the capability to ' . esc_attr( $this->settings[ 'action' ] ) . ' this entry: ' . $this->entry[ 'id' ] );
143 143
 
144 144
 			return null;
145 145
 		}
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 		}
154 154
 
155 155
 		// Get just the URL, not the tag
156
-		if ( 'url' === $this->settings['return'] ) {
156
+		if ( 'url' === $this->settings[ 'return' ] ) {
157 157
 			return $url;
158 158
 		}
159 159
 
@@ -174,13 +174,13 @@  discard block
 block discarded – undo
174 174
 	 */
175 175
 	private function get_link_atts() {
176 176
 
177
-		wp_parse_str( $this->settings['link_atts'], $link_atts );
177
+		wp_parse_str( $this->settings[ 'link_atts' ], $link_atts );
178 178
 
179
-		if ( 'delete' === $this->settings['action'] ) {
180
-			$link_atts['onclick'] = isset( $link_atts['onclick'] ) ? $link_atts['onclick'] : GravityView_Delete_Entry::get_confirm_dialog();
179
+		if ( 'delete' === $this->settings[ 'action' ] ) {
180
+			$link_atts[ 'onclick' ] = isset( $link_atts[ 'onclick' ] ) ? $link_atts[ 'onclick' ] : GravityView_Delete_Entry::get_confirm_dialog();
181 181
 		}
182 182
 
183
-		return (array) $link_atts;
183
+		return (array)$link_atts;
184 184
 	}
185 185
 
186 186
 	/**
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 			return $content;
201 201
 		}
202 202
 
203
-		switch ( $this->settings['action'] ) {
203
+		switch ( $this->settings[ 'action' ] ) {
204 204
 			case 'edit':
205 205
 				$anchor_text = __( 'Edit Entry', 'gravityview' );
206 206
 				break;
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
 	private function get_url() {
229 229
 
230 230
 		// if post_id is not defined, default to view_id
231
-		$post_id = empty( $this->settings['post_id'] ) ? $this->view_id : absint( $this->settings['post_id'] );
231
+		$post_id = empty( $this->settings[ 'post_id' ] ) ? $this->view_id : absint( $this->settings[ 'post_id' ] );
232 232
 
233
-		switch ( $this->settings['action'] ) {
233
+		switch ( $this->settings[ 'action' ] ) {
234 234
 			case 'edit':
235 235
 				$url = GravityView_Edit_Entry::get_edit_link( $this->entry, $this->view_id, $post_id );
236 236
 				break;
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 */
256 256
 	private function has_cap() {
257 257
 
258
-		switch ( $this->settings['action'] ) {
258
+		switch ( $this->settings[ 'action' ] ) {
259 259
 			case 'edit':
260 260
 				$has_cap = GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view_id );
261 261
 				break;
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
 	 */
321 321
 	private function maybe_add_field_values_query_args( $url ) {
322 322
 
323
-		if ( $url && ! empty( $this->settings['field_values'] ) ) {
323
+		if ( $url && ! empty( $this->settings[ 'field_values' ] ) ) {
324 324
 
325
-			wp_parse_str( $this->settings['field_values'], $field_values );
325
+			wp_parse_str( $this->settings[ 'field_values' ], $field_values );
326 326
 
327 327
 			$url = add_query_arg( $field_values, $url );
328 328
 		}
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-admin.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     function load() {
26 26
 
27
-        if( !is_admin() ) {
27
+        if ( ! is_admin() ) {
28 28
             return;
29 29
         }
30 30
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 );
39 39
 
40 40
         // add tooltips
41
-        add_filter( 'gravityview_tooltips', array( $this, 'tooltips') );
41
+        add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) );
42 42
 
43 43
         // custom fields' options for zone EDIT
44 44
         add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 5 );
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
      */
53 53
     function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
54 54
 
55
-        if( $zone !== 'edit' ) {
55
+        if ( $zone !== 'edit' ) {
56 56
 
57
-            $entry_default_fields['edit_link'] = array(
58
-                'label' => __('Edit Entry', 'gravityview'),
57
+            $entry_default_fields[ 'edit_link' ] = array(
58
+                'label' => __( 'Edit Entry', 'gravityview' ),
59 59
                 'type' => 'edit_link',
60
-                'desc'	=> __('A link to edit the entry. Visible based on View settings.', 'gravityview'),
60
+                'desc'	=> __( 'A link to edit the entry. Visible based on View settings.', 'gravityview' ),
61 61
             );
62 62
 
63 63
         }
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
         $caps = $visibility_caps;
82 82
 
83 83
         // If we're configuring fields in the edit context, we want a limited selection
84
-        if( $context === 'edit' ) {
84
+        if ( $context === 'edit' ) {
85 85
 
86 86
             // Remove other built-in caps.
87
-            unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] );
87
+            unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] );
88 88
 
89
-            $caps['read'] = _x('Entry Creator','User capability', 'gravityview');
89
+            $caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' );
90 90
         }
91 91
 
92 92
         return $caps;
@@ -104,16 +104,16 @@  discard block
 block discarded – undo
104 104
     function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
105 105
 
106 106
         // Always a link, never a filter
107
-        unset( $field_options['show_as_link'], $field_options['search_filter'] );
107
+        unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] );
108 108
 
109 109
         // Edit Entry link should only appear to visitors capable of editing entries
110
-        unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
110
+        unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
111 111
 
112
-        $add_option['edit_link'] = array(
112
+        $add_option[ 'edit_link' ] = array(
113 113
             'type' => 'text',
114 114
             'label' => __( 'Edit Link Text', 'gravityview' ),
115 115
             'desc' => NULL,
116
-            'value' => __('Edit Entry', 'gravityview'),
116
+            'value' => __( 'Edit Entry', 'gravityview' ),
117 117
             'merge_tags' => true,
118 118
         );
119 119
 
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 
130 130
         $return = $tooltips;
131 131
 
132
-        $return['allow_edit_cap'] = array(
133
-            'title' => __('Limiting Edit Access', 'gravityview'),
134
-            'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'),
132
+        $return[ 'allow_edit_cap' ] = array(
133
+            'title' => __( 'Limiting Edit Access', 'gravityview' ),
134
+            'value' => __( 'Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview' ),
135 135
         );
136 136
 
137 137
         return $return;
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
     function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
150 150
 
151 151
         // We only want to modify the settings for the edit context
152
-        if( 'edit' !== $context ) {
152
+        if ( 'edit' !== $context ) {
153 153
 
154 154
             /**
155 155
              * @since 1.8.4
156 156
              */
157
-            $field_options['new_window'] = array(
157
+            $field_options[ 'new_window' ] = array(
158 158
                 'type' => 'checkbox',
159 159
                 'label' => __( 'Open link in a new tab or window?', 'gravityview' ),
160 160
                 'value' => false,
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         }
165 165
 
166 166
         //  Entry field is only for logged in users
167
-        unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
167
+        unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
168 168
 
169 169
         $add_options = array(
170 170
             'allow_edit_cap' => array(
Please login to merge, or discard this patch.