Completed
Pull Request — master (#822)
by Zack
23:55 queued 20:40
created
includes/fields/class-gravityview-field-post-custom-field.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @return void
31 31
 	 */
32 32
 	private function add_hooks() {
33
-		add_filter( 'gravityview/edit_entry/field_value_post_custom_field', array( $this, 'edit_entry_field_value'), 10, 2 );
33
+		add_filter( 'gravityview/edit_entry/field_value_post_custom_field', array( $this, 'edit_entry_field_value' ), 10, 2 );
34 34
 	}
35 35
 
36 36
 	/**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public function edit_entry_field_value( $field_value, $field ) {
47 47
 
48
-		if( 'list' === $field->inputType ) {
48
+		if ( 'list' === $field->inputType ) {
49 49
 			$field_value = is_string( $field_value ) ? json_decode( $field_value, true ) : $field_value;
50 50
 
51 51
 			if ( ! is_array( $field_value ) ) {
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-post-category.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 	var $name = 'post_category';
11 11
 
12
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
12
+	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' );
13 13
 
14 14
 	var $_gf_field_class_name = 'GF_Field_Post_Category';
15 15
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		$entry = GFAPI::get_entry( $entry_id );
43 43
 		$post_id = rgar( $entry, 'post_id' );
44 44
 
45
-		if( empty( $post_id ) ) {
45
+		if ( empty( $post_id ) ) {
46 46
 			return false;
47 47
 		}
48 48
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 		$post_category_fields = GFAPI::get_fields_by_type( $form, 'post_category' );
52 52
 
53
-		if( $post_category_fields ) {
53
+		if ( $post_category_fields ) {
54 54
 
55 55
 			$updated_categories = array();
56 56
 
@@ -117,18 +117,18 @@  discard block
 block discarded – undo
117 117
 	 *
118 118
 	 * @return mixed
119 119
 	 */
120
-	function edit_entry_post_category_choices( $choices, $field, $form_id  ) {
120
+	function edit_entry_post_category_choices( $choices, $field, $form_id ) {
121 121
 
122
-		$entry = GravityView_Edit_Entry::getInstance()->instances['render']->get_entry();
122
+		$entry = GravityView_Edit_Entry::getInstance()->instances[ 'render' ]->get_entry();
123 123
 
124 124
 		// $entry['post_id'] should always be set, but we check to make sure.
125
-		if( $entry && isset( $entry['post_id'] ) && $post_id = $entry['post_id'] ) {
125
+		if ( $entry && isset( $entry[ 'post_id' ] ) && $post_id = $entry[ 'post_id' ] ) {
126 126
 
127 127
 			$post_categories = wp_get_post_categories( $post_id, array( 'fields' => 'ids' ) );
128 128
 
129 129
 			// Always use the live value
130 130
 			foreach ( $choices as &$choice ) {
131
-				$choice['isSelected'] = in_array( $choice['value'], array_values( $post_categories ) );
131
+				$choice[ 'isSelected' ] = in_array( $choice[ 'value' ], array_values( $post_categories ) );
132 132
 			}
133 133
 		}
134 134
 
@@ -137,12 +137,12 @@  discard block
 block discarded – undo
137 137
 
138 138
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
139 139
 
140
-		if( 'edit' === $context ) {
140
+		if ( 'edit' === $context ) {
141 141
 			return $field_options;
142 142
 		}
143 143
 
144
-		$this->add_field_support('dynamic_data', $field_options );
145
-		$this->add_field_support('link_to_term', $field_options );
144
+		$this->add_field_support( 'dynamic_data', $field_options );
145
+		$this->add_field_support( 'link_to_term', $field_options );
146 146
 
147 147
 		return $field_options;
148 148
 	}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-checkbox.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 	var $name = 'checkbox';
11 11
 
12
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
12
+	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' );
13 13
 
14 14
 	var $_gf_field_class_name = 'GF_Field_Checkbox';
15 15
 
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 		$field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type );
40 40
 
41 41
 		// It's not the parent field; it's an input
42
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
42
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
43 43
 
44
-			if( $this->is_choice_value_enabled() ) {
44
+			if ( $this->is_choice_value_enabled() ) {
45 45
 
46 46
 				$desc = esc_html__( 'This input has a label and a value. What should be displayed?', 'gravityview' );
47 47
 				$default = 'value';
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 				);
60 60
 			}
61 61
 
62
-			$field_options['choice_display'] = array(
62
+			$field_options[ 'choice_display' ] = array(
63 63
 				'type'    => 'radio',
64 64
 				'class'   => 'vertical',
65 65
 				'label'   => __( 'What should be displayed:', 'gravityview' ),
Please login to merge, or discard this patch.
includes/class-api.php 1 patch
Spacing   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -30,29 +30,29 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$label = '';
32 32
 
33
-		if( !empty( $field['show_label'] ) || $force_show_label ) {
33
+		if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) {
34 34
 
35
-			$label = $field['label'];
35
+			$label = $field[ 'label' ];
36 36
 
37 37
 			// Support Gravity Forms 1.9+
38
-			if( class_exists( 'GF_Field' ) ) {
38
+			if ( class_exists( 'GF_Field' ) ) {
39 39
 
40
-				$field_object = RGFormsModel::get_field( $form, $field['id'] );
40
+				$field_object = RGFormsModel::get_field( $form, $field[ 'id' ] );
41 41
 
42
-				if( $field_object ) {
42
+				if ( $field_object ) {
43 43
 
44
-					$input = GFFormsModel::get_input( $field_object, $field['id'] );
44
+					$input = GFFormsModel::get_input( $field_object, $field[ 'id' ] );
45 45
 
46 46
 					// This is a complex field, with labels on a per-input basis
47
-					if( $input ) {
47
+					if ( $input ) {
48 48
 
49 49
 						// Does the input have a custom label on a per-input basis? Otherwise, default label.
50
-						$label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label'];
50
+						$label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ];
51 51
 
52 52
 					} else {
53 53
 
54 54
 						// This is a field with one label
55
-						$label = $field_object->get_field_label( true, $field['label'] );
55
+						$label = $field_object->get_field_label( true, $field[ 'label' ] );
56 56
 
57 57
 					}
58 58
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 			}
62 62
 
63 63
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
64
-			if ( !empty( $field['custom_label'] ) ) {
64
+			if ( ! empty( $field[ 'custom_label' ] ) ) {
65 65
 
66
-				$label = self::replace_variables( $field['custom_label'], $form, $entry );
66
+				$label = self::replace_variables( $field[ 'custom_label' ], $form, $entry );
67 67
 
68 68
 			}
69 69
 
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 
118 118
 		$width = NULL;
119 119
 
120
-		if( !empty( $field['width'] ) ) {
121
-			$width = absint( $field['width'] );
120
+		if ( ! empty( $field[ 'width' ] ) ) {
121
+			$width = absint( $field[ 'width' ] );
122 122
 
123 123
 			// If using percentages, limit to 100%
124
-			if( '%d%%' === $format && $width > 100 ) {
124
+			if ( '%d%%' === $format && $width > 100 ) {
125 125
 				$width = 100;
126 126
 			}
127 127
 
@@ -144,39 +144,39 @@  discard block
 block discarded – undo
144 144
 
145 145
 		$classes = array();
146 146
 
147
-		if( !empty( $field['custom_class'] ) ) {
147
+		if ( ! empty( $field[ 'custom_class' ] ) ) {
148 148
 
149
-            $custom_class = $field['custom_class'];
149
+            $custom_class = $field[ 'custom_class' ];
150 150
 
151
-            if( !empty( $entry ) ) {
151
+            if ( ! empty( $entry ) ) {
152 152
 
153 153
                 // We want the merge tag to be formatted as a class. The merge tag may be
154 154
                 // replaced by a multiple-word value that should be output as a single class.
155 155
                 // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
156
-                add_filter('gform_merge_tag_filter', 'sanitize_html_class');
156
+                add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
157 157
 
158
-                $custom_class = self::replace_variables( $custom_class, $form, $entry);
158
+                $custom_class = self::replace_variables( $custom_class, $form, $entry );
159 159
 
160 160
                 // And then we want life to return to normal
161
-                remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
161
+                remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
162 162
             }
163 163
 
164 164
 			// And now we want the spaces to be handled nicely.
165
-			$classes[] = gravityview_sanitize_html_class( $custom_class );
165
+			$classes[ ] = gravityview_sanitize_html_class( $custom_class );
166 166
 
167 167
 		}
168 168
 
169
-		if(!empty($field['id'])) {
170
-			if( !empty( $form ) && !empty( $form['id'] ) ) {
171
-				$form_id = '-'.$form['id'];
169
+		if ( ! empty( $field[ 'id' ] ) ) {
170
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
171
+				$form_id = '-' . $form[ 'id' ];
172 172
 			} else {
173
-				$form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : '';
173
+				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
174 174
 			}
175 175
 
176
-			$classes[] = 'gv-field'.$form_id.'-'.$field['id'];
176
+			$classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ];
177 177
 		}
178 178
 
179
-		return esc_attr(implode(' ', $classes));
179
+		return esc_attr( implode( ' ', $classes ) );
180 180
 	}
181 181
 
182 182
 	/**
@@ -193,16 +193,16 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	public static function field_html_attr_id( $field, $form = array(), $entry = array() ) {
195 195
 		$gravityview_view = GravityView_View::getInstance();
196
-		$id = $field['id'];
196
+		$id = $field[ 'id' ];
197 197
 
198 198
 		if ( ! empty( $id ) ) {
199
-			if ( ! empty( $form ) && ! empty( $form['id'] ) ) {
200
-				$form_id = '-' . $form['id'];
199
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
200
+				$form_id = '-' . $form[ 'id' ];
201 201
 			} else {
202 202
 				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
203 203
 			}
204 204
 
205
-			$id = 'gv-field' . $form_id . '-' . $field['id'];
205
+			$id = 'gv-field' . $form_id . '-' . $field[ 'id' ];
206 206
 		}
207 207
 
208 208
 		return esc_attr( $id );
@@ -219,17 +219,17 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	public static function field_value( $entry, $field_settings, $format = 'html' ) {
221 221
 
222
-		if( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) {
222
+		if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) {
223 223
 			return NULL;
224 224
 		}
225 225
 
226 226
 		$gravityview_view = GravityView_View::getInstance();
227 227
 
228
-		$field_id = $field_settings['id'];
228
+		$field_id = $field_settings[ 'id' ];
229 229
 		$form = $gravityview_view->getForm();
230 230
 		$field = gravityview_get_field( $form, $field_id );
231 231
 
232
-		if( $field && is_numeric( $field_id ) ) {
232
+		if ( $field && is_numeric( $field_id ) ) {
233 233
 			// Used as file name of field template in GV.
234 234
 			// Don't use RGFormsModel::get_input_type( $field ); we don't care if it's a radio input; we want to know it's a 'quiz' field
235 235
 			$field_type = $field->type;
@@ -240,12 +240,12 @@  discard block
 block discarded – undo
240 240
 		}
241 241
 
242 242
 		// If a Gravity Forms Field is found, get the field display
243
-		if( $field ) {
243
+		if ( $field ) {
244 244
 
245 245
 			// Prevent any PHP warnings that may be generated
246 246
 			ob_start();
247 247
 
248
-			$display_value = GFCommon::get_lead_field_display( $field, $value, $entry["currency"], false, $format );
248
+			$display_value = GFCommon::get_lead_field_display( $field, $value, $entry[ "currency" ], false, $format );
249 249
 
250 250
 			if ( $errors = ob_get_clean() ) {
251 251
 				do_action( 'gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors );
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 			$display_value = apply_filters( "gform_entry_field_value", $display_value, $field, $entry, $form );
255 255
 
256 256
 			// prevent the use of merge_tags for non-admin fields
257
-			if( !empty( $field->adminOnly ) ) {
257
+			if ( ! empty( $field->adminOnly ) ) {
258 258
 				$display_value = self::replace_variables( $display_value, $form, $entry );
259 259
 			}
260 260
 		} else {
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 
265 265
 		// Check whether the field exists in /includes/fields/{$field_type}.php
266 266
 		// This can be overridden by user template files.
267
-		$field_path = $gravityview_view->locate_template("fields/{$field_type}.php");
267
+		$field_path = $gravityview_view->locate_template( "fields/{$field_type}.php" );
268 268
 
269 269
 		// Set the field data to be available in the templates
270 270
 		$gravityview_view->setCurrentField( array(
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
 			'entry' => $entry,
279 279
 			'field_type' => $field_type, /** {@since 1.6} */
280 280
 		    'field_path' => $field_path, /** {@since 1.16} */
281
-		));
281
+		) );
282 282
 
283
-		if( ! empty( $field_path ) ) {
283
+		if ( ! empty( $field_path ) ) {
284 284
 
285
-			do_action( 'gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path ) );
285
+			do_action( 'gravityview_log_debug', sprintf( '[field_value] Rendering %s', $field_path ) );
286 286
 
287 287
 			ob_start();
288 288
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 		}
299 299
 
300 300
 		// Get the field settings again so that the field template can override the settings
301
-		$field_settings = $gravityview_view->getCurrentField('field_settings');
301
+		$field_settings = $gravityview_view->getCurrentField( 'field_settings' );
302 302
 
303 303
 		/**
304 304
 		 * @filter `gravityview_field_entry_value_{$field_type}_pre_link` Modify the field value output for a field type before Show As Link setting is applied. Example: `gravityview_field_entry_value_number_pre_link`
@@ -316,9 +316,9 @@  discard block
 block discarded – undo
316 316
 		 * Fields can override this by modifying the field data variable inside the field. See /templates/fields/post_image.php for an example.
317 317
 		 *
318 318
 		 */
319
-		if( !empty( $field_settings['show_as_link'] ) && ! gv_empty( $output, false, false ) ) {
319
+		if ( ! empty( $field_settings[ 'show_as_link' ] ) && ! gv_empty( $output, false, false ) ) {
320 320
 
321
-			$link_atts = empty( $field_settings['new_window'] ) ? array() : array( 'target' => '_blank' );
321
+			$link_atts = empty( $field_settings[ 'new_window' ] ) ? array() : array( 'target' => '_blank' );
322 322
 
323 323
 			$output = self::entry_link_html( $entry, $output, $link_atts, $field_settings );
324 324
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 		 * @param  array $field_settings Settings for the particular GV field
333 333
 		 * @param array $field Current field being displayed
334 334
 		 */
335
-		$output = apply_filters( 'gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() );
335
+		$output = apply_filters( 'gravityview_field_entry_value_' . $field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() );
336 336
 
337 337
 		/**
338 338
 		 * @filter `gravityview_field_entry_value` Modify the field value output for all field types
@@ -361,14 +361,14 @@  discard block
 block discarded – undo
361 361
 	 */
362 362
 	public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array() ) {
363 363
 
364
-		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) {
364
+		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) {
365 365
 			do_action( 'gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry );
366 366
 			return NULL;
367 367
 		}
368 368
 
369 369
 		$href = self::entry_link( $entry );
370 370
 
371
-		if( '' === $href ) {
371
+		if ( '' === $href ) {
372 372
 			return NULL;
373 373
 		}
374 374
 
@@ -391,19 +391,19 @@  discard block
 block discarded – undo
391 391
 	 * @param  boolean     $wpautop Apply wpautop() to the output?
392 392
 	 * @return string               HTML of "no results" text
393 393
 	 */
394
-	public static function no_results($wpautop = true) {
394
+	public static function no_results( $wpautop = true ) {
395 395
 		$gravityview_view = GravityView_View::getInstance();
396 396
 
397 397
 		$is_search = false;
398 398
 
399
-		if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
399
+		if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
400 400
 			$is_search = true;
401 401
 		}
402 402
 
403
-		if($is_search) {
404
-			$output = __('This search returned no results.', 'gravityview');
403
+		if ( $is_search ) {
404
+			$output = __( 'This search returned no results.', 'gravityview' );
405 405
 		} else {
406
-			$output = __('No entries match your request.', 'gravityview');
406
+			$output = __( 'No entries match your request.', 'gravityview' );
407 407
 		}
408 408
 
409 409
 		/**
@@ -411,9 +411,9 @@  discard block
 block discarded – undo
411 411
 		 * @param string $output The existing "No Entries" text
412 412
 		 * @param boolean $is_search Is the current page a search result, or just a multiple entries screen?
413 413
 		 */
414
-		$output = apply_filters( 'gravitview_no_entries_text', $output, $is_search);
414
+		$output = apply_filters( 'gravitview_no_entries_text', $output, $is_search );
415 415
 
416
-		return $wpautop ? wpautop($output) : $output;
416
+		return $wpautop ? wpautop( $output ) : $output;
417 417
 	}
418 418
 
419 419
 	/**
@@ -430,37 +430,37 @@  discard block
 block discarded – undo
430 430
 
431 431
 		$gravityview_view = GravityView_View::getInstance();
432 432
 
433
-		if( empty( $post_id ) ) {
433
+		if ( empty( $post_id ) ) {
434 434
 
435 435
 			$post_id = false;
436 436
 
437 437
 			// DataTables passes the Post ID
438
-			if( defined('DOING_AJAX') && DOING_AJAX ) {
438
+			if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
439 439
 
440
-				$post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : false;
440
+				$post_id = isset( $_POST[ 'post_id' ] ) ? (int)$_POST[ 'post_id' ] : false;
441 441
 
442 442
 			} else {
443 443
 
444 444
 				// The Post ID has been passed via the shortcode
445
-				if( !empty( $gravityview_view ) && $gravityview_view->getPostId() ) {
445
+				if ( ! empty( $gravityview_view ) && $gravityview_view->getPostId() ) {
446 446
 
447 447
 					$post_id = $gravityview_view->getPostId();
448 448
 
449 449
 				} else {
450 450
 
451 451
 					// This is a GravityView post type
452
-					if( GravityView_frontend::getInstance()->isGravityviewPostType() ) {
452
+					if ( GravityView_frontend::getInstance()->isGravityviewPostType() ) {
453 453
 
454 454
 						$post_id = isset( $gravityview_view ) ? $gravityview_view->getViewId() : $post->ID;
455 455
 
456 456
 					} else {
457 457
 
458 458
 						// This is an embedded GravityView; use the embedded post's ID as the base.
459
-						if( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) {
459
+						if ( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) {
460 460
 
461 461
 							$post_id = $post->ID;
462 462
 
463
-						} elseif( $gravityview_view->getViewId() ) {
463
+						} elseif ( $gravityview_view->getViewId() ) {
464 464
 
465 465
 							// The GravityView has been embedded in a widget or in a template, and
466 466
 							// is not in the current content. Thus, we defer to the View's own ID.
@@ -475,36 +475,36 @@  discard block
 block discarded – undo
475 475
 		}
476 476
 
477 477
 		// No post ID, get outta here.
478
-		if( empty( $post_id ) ) {
478
+		if ( empty( $post_id ) ) {
479 479
 			return NULL;
480 480
 		}
481 481
 
482 482
 		// If we've saved the permalink in memory, use it
483 483
 		// @since 1.3
484
-		$link = wp_cache_get( 'gv_directory_link_'.$post_id );
484
+		$link = wp_cache_get( 'gv_directory_link_' . $post_id );
485 485
 
486
-		if( empty( $link ) ) {
486
+		if ( empty( $link ) ) {
487 487
 
488 488
 			$link = get_permalink( $post_id );
489 489
 
490 490
 			// If not yet saved, cache the permalink.
491 491
 			// @since 1.3
492
-			wp_cache_set( 'gv_directory_link_'.$post_id, $link );
492
+			wp_cache_set( 'gv_directory_link_' . $post_id, $link );
493 493
 
494 494
 		}
495 495
 
496 496
 		// Deal with returning to proper pagination for embedded views
497
-		if( $link && $add_query_args ) {
497
+		if ( $link && $add_query_args ) {
498 498
 
499 499
 			$args = array();
500 500
 
501
-			if( $pagenum = rgget('pagenum') ) {
502
-				$args['pagenum'] = intval( $pagenum );
501
+			if ( $pagenum = rgget( 'pagenum' ) ) {
502
+				$args[ 'pagenum' ] = intval( $pagenum );
503 503
 			}
504 504
 
505
-			if( $sort = rgget('sort') ) {
506
-				$args['sort'] = $sort;
507
-				$args['dir'] = rgget('dir');
505
+			if ( $sort = rgget( 'sort' ) ) {
506
+				$args[ 'sort' ] = $sort;
507
+				$args[ 'dir' ] = rgget( 'dir' );
508 508
 			}
509 509
 
510 510
 			$link = add_query_arg( $args, $link );
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	private static function get_custom_entry_slug( $id, $entry = array() ) {
528 528
 
529 529
 		// Generate an unique hash to use as the default value
530
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
530
+		$slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 );
531 531
 
532 532
 		/**
533 533
 		 * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}`
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
539 539
 
540 540
 		// Make sure we have something - use the original ID as backup.
541
-		if( empty( $slug ) ) {
541
+		if ( empty( $slug ) ) {
542 542
 			$slug = $id;
543 543
 		}
544 544
 
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 		 * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs.
568 568
 		 * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default)
569 569
 		 */
570
-		$custom = apply_filters('gravityview_custom_entry_slug', false );
570
+		$custom = apply_filters( 'gravityview_custom_entry_slug', false );
571 571
 
572 572
 		// If we're using custom slug...
573 573
 		if ( $custom ) {
@@ -581,8 +581,8 @@  discard block
 block discarded – undo
581 581
 			// If it does have a hash set, and the hash is expected, use it.
582 582
 			// This check allows users to change the hash structure using the
583 583
 			// gravityview_entry_hash filter and have the old hashes expire.
584
-			if( empty( $value ) || $value !== $hash ) {
585
-				do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "'.$id_or_string.'": ' . $hash );
584
+			if ( empty( $value ) || $value !== $hash ) {
585
+				do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "' . $id_or_string . '": ' . $hash );
586 586
 				gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) );
587 587
 			}
588 588
 
@@ -608,15 +608,15 @@  discard block
 block discarded – undo
608 608
          * @param boolean $custom Should we process the custom entry slug?
609 609
          */
610 610
         $custom = apply_filters( 'gravityview_custom_entry_slug', false );
611
-        if( $custom ) {
611
+        if ( $custom ) {
612 612
             // create the gravityview_unique_id and save it
613 613
 
614 614
             // Get the entry hash
615
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
615
+            $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry );
616 616
 
617
-	        do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "'.$entry['id'].'": ' . $hash );
617
+	        do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "' . $entry[ 'id' ] . '": ' . $hash );
618 618
 
619
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) );
619
+            gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) );
620 620
 
621 621
         }
622 622
     }
@@ -633,14 +633,14 @@  discard block
 block discarded – undo
633 633
 	 */
634 634
 	public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) {
635 635
 
636
-		if( ! empty( $entry ) && ! is_array( $entry ) ) {
636
+		if ( ! empty( $entry ) && ! is_array( $entry ) ) {
637 637
 			$entry = GVCommon::get_entry( $entry );
638
-		} else if( empty( $entry ) ) {
638
+		} else if ( empty( $entry ) ) {
639 639
 			$entry = GravityView_frontend::getInstance()->getEntry();
640 640
 		}
641 641
 
642 642
 		// Second parameter used to be passed as $field; this makes sure it's not an array
643
-		if( !is_numeric( $post_id ) ) {
643
+		if ( ! is_numeric( $post_id ) ) {
644 644
 			$post_id = NULL;
645 645
 		}
646 646
 
@@ -648,15 +648,15 @@  discard block
 block discarded – undo
648 648
 		$directory_link = self::directory_link( $post_id, false );
649 649
 
650 650
 		// No post ID? Get outta here.
651
-		if( empty( $directory_link ) ) {
651
+		if ( empty( $directory_link ) ) {
652 652
 			return '';
653 653
 		}
654 654
 
655 655
 		$query_arg_name = GravityView_Post_Types::get_entry_var_name();
656 656
 
657
-		$entry_slug = self::get_entry_slug( $entry['id'], $entry );
657
+		$entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry );
658 658
 
659
-		if( get_option('permalink_structure') && !is_preview() ) {
659
+		if ( get_option( 'permalink_structure' ) && ! is_preview() ) {
660 660
 
661 661
 			$args = array();
662 662
 
@@ -666,9 +666,9 @@  discard block
 block discarded – undo
666 666
 			 */
667 667
 			$link_parts = explode( '?', $directory_link );
668 668
 
669
-			$query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : '';
669
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
670 670
 
671
-			$directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query;
671
+			$directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query;
672 672
 
673 673
 		} else {
674 674
 
@@ -678,18 +678,18 @@  discard block
 block discarded – undo
678 678
 		/**
679 679
 		 * @since 1.7.3
680 680
 		 */
681
-		if( $add_directory_args ) {
681
+		if ( $add_directory_args ) {
682 682
 
683
-			if( !empty( $_GET['pagenum'] ) ) {
684
-				$args['pagenum'] = intval( $_GET['pagenum'] );
683
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
684
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
685 685
 			}
686 686
 
687 687
 			/**
688 688
 			 * @since 1.7
689 689
 			 */
690
-			if( $sort = rgget('sort') ) {
691
-				$args['sort'] = $sort;
692
-				$args['dir'] = rgget('dir');
690
+			if ( $sort = rgget( 'sort' ) ) {
691
+				$args[ 'sort' ] = $sort;
692
+				$args[ 'dir' ] = rgget( 'dir' );
693 693
 			}
694 694
 
695 695
 		}
@@ -699,8 +699,8 @@  discard block
 block discarded – undo
699 699
 		 * has the view id so that Advanced Filters can be applied correctly when rendering the single view
700 700
 		 * @see GravityView_frontend::get_context_view_id()
701 701
 		 */
702
-		if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) {
703
-			$args['gvid'] = gravityview_get_view_id();
702
+		if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) {
703
+			$args[ 'gvid' ] = gravityview_get_view_id();
704 704
 		}
705 705
 
706 706
 		return add_query_arg( $args, $directory_link );
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 }
719 719
 
720 720
 function gv_class( $field, $form = NULL, $entry = array() ) {
721
-	return GravityView_API::field_class( $field, $form, $entry  );
721
+	return GravityView_API::field_class( $field, $form, $entry );
722 722
 }
723 723
 
724 724
 /**
@@ -740,15 +740,15 @@  discard block
 block discarded – undo
740 740
 
741 741
 	$default_css_class = ! empty( $view_id ) ? sprintf( 'gv-container gv-container-%d', $view_id ) : 'gv-container';
742 742
 
743
-	if( GravityView_View::getInstance()->isHideUntilSearched() ) {
743
+	if ( GravityView_View::getInstance()->isHideUntilSearched() ) {
744 744
 		$default_css_class .= ' hidden';
745 745
 	}
746 746
 
747
-	if( 0 === GravityView_View::getInstance()->getTotalEntries() ) {
747
+	if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) {
748 748
 		$default_css_class .= ' gv-container-no-results';
749 749
 	}
750 750
 
751
-	$css_class = trim( $passed_css_class . ' '. $default_css_class );
751
+	$css_class = trim( $passed_css_class . ' ' . $default_css_class );
752 752
 
753 753
 	/**
754 754
 	 * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 
760 760
 	$css_class = gravityview_sanitize_html_class( $css_class );
761 761
 
762
-	if( $echo ) {
762
+	if ( $echo ) {
763 763
 		echo $css_class;
764 764
 	}
765 765
 
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 
771 771
 	$value = GravityView_API::field_value( $entry, $field );
772 772
 
773
-	if( $value === '' ) {
773
+	if ( $value === '' ) {
774 774
 		/**
775 775
 		 * @filter `gravityview_empty_value` What to display when a field is empty
776 776
 		 * @param string $value (empty string)
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 	return GravityView_API::entry_link( $entry, $post_id );
790 790
 }
791 791
 
792
-function gv_no_results($wpautop = true) {
792
+function gv_no_results( $wpautop = true ) {
793 793
 	return GravityView_API::no_results( $wpautop );
794 794
 }
795 795
 
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 
803 803
 	$href = gv_directory_link();
804 804
 
805
-	if( empty( $href ) ) { return NULL; }
805
+	if ( empty( $href ) ) { return NULL; }
806 806
 
807 807
 	// calculate link label
808 808
 	$gravityview_view = GravityView_View::getInstance();
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 
819 819
 	$link = gravityview_get_link( $href, esc_html( $label ), array(
820 820
 		'data-viewid' => $gravityview_view->getViewId()
821
-	));
821
+	) );
822 822
 
823 823
 	return $link;
824 824
 }
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
  */
838 838
 function gravityview_get_field_value( $entry, $field_id, $display_value ) {
839 839
 
840
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
840
+	if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
841 841
 
842 842
 		// For the complete field value as generated by Gravity Forms
843 843
 		return $display_value;
@@ -867,16 +867,16 @@  discard block
 block discarded – undo
867 867
 
868 868
 	$terms = explode( ', ', $value );
869 869
 
870
-	foreach ($terms as $term_name ) {
870
+	foreach ( $terms as $term_name ) {
871 871
 
872 872
 		// If we're processing a category,
873
-		if( $taxonomy === 'category' ) {
873
+		if ( $taxonomy === 'category' ) {
874 874
 
875 875
 			// Use rgexplode to prevent errors if : doesn't exist
876 876
 			list( $term_name, $term_id ) = rgexplode( ':', $value, 2 );
877 877
 
878 878
 			// The explode was succesful; we have the category ID
879
-			if( !empty( $term_id )) {
879
+			if ( ! empty( $term_id ) ) {
880 880
 				$term = get_term_by( 'id', $term_id, $taxonomy );
881 881
 			} else {
882 882
 			// We have to fall back to the name
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
 		}
890 890
 
891 891
 		// There's still a tag/category here.
892
-		if( $term ) {
892
+		if ( $term ) {
893 893
 
894 894
 			$term_link = get_term_link( $term, $taxonomy );
895 895
 
@@ -898,11 +898,11 @@  discard block
 block discarded – undo
898 898
 			    continue;
899 899
 			}
900 900
 
901
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
901
+			$output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) );
902 902
 		}
903 903
 	}
904 904
 
905
-	return implode(', ', $output );
905
+	return implode( ', ', $output );
906 906
 }
907 907
 
908 908
 /**
@@ -916,8 +916,8 @@  discard block
 block discarded – undo
916 916
 
917 917
 	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
918 918
 
919
-	if( empty( $link ) ) {
920
-		return strip_tags( $output);
919
+	if ( empty( $link ) ) {
920
+		return strip_tags( $output );
921 921
 	}
922 922
 
923 923
 	return $output;
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 	$fe = GravityView_frontend::getInstance();
937 937
 
938 938
 	// Solve problem when loading content via admin-ajax.php
939
-	if( ! $fe->getGvOutputData() ) {
939
+	if ( ! $fe->getGvOutputData() ) {
940 940
 
941 941
 		do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' );
942 942
 
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
 	}
945 945
 
946 946
 	// Make 100% sure that we're dealing with a properly called situation
947
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
947
+	if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
948 948
 
949 949
 		do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() );
950 950
 
@@ -964,10 +964,10 @@  discard block
 block discarded – undo
964 964
 
965 965
 	$fe = GravityView_frontend::getInstance();
966 966
 
967
-	if( ! $fe->getGvOutputData() ) { return array(); }
967
+	if ( ! $fe->getGvOutputData() ) { return array(); }
968 968
 
969 969
 	// If not set, grab the current view ID
970
-	if( empty( $view_id ) ) {
970
+	if ( empty( $view_id ) ) {
971 971
 		$view_id = $fe->get_context_view_id();
972 972
 	}
973 973
 
@@ -1032,11 +1032,11 @@  discard block
 block discarded – undo
1032 1032
 	 */
1033 1033
 	$is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false );
1034 1034
 
1035
-	if( $is_edit_entry ) {
1035
+	if ( $is_edit_entry ) {
1036 1036
 		$context = 'edit';
1037
-	} else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) {
1037
+	} else if ( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) {
1038 1038
 		$context = 'single';
1039
-	} else if( class_exists( 'GravityView_View' ) ) {
1039
+	} else if ( class_exists( 'GravityView_View' ) ) {
1040 1040
 		$context = GravityView_View::getInstance()->getContext();
1041 1041
 	}
1042 1042
 
@@ -1064,12 +1064,12 @@  discard block
 block discarded – undo
1064 1064
 function gravityview_get_files_array( $value, $gv_class = '' ) {
1065 1065
 	/** @define "GRAVITYVIEW_DIR" "../" */
1066 1066
 
1067
-	if( !class_exists( 'GravityView_Field' ) ) {
1068
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1067
+	if ( ! class_exists( 'GravityView_Field' ) ) {
1068
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' );
1069 1069
 	}
1070 1070
 
1071
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1072
-		include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' );
1071
+	if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) {
1072
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/fileupload.php' );
1073 1073
 	}
1074 1074
 
1075 1075
 	return GravityView_Field_FileUpload::get_files_array( $value, $gv_class );
@@ -1147,12 +1147,12 @@  discard block
 block discarded – undo
1147 1147
 	$args = apply_filters( 'gravityview/field_output/args', $args, $passed_args );
1148 1148
 
1149 1149
 	// Required fields.
1150
-	if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1150
+	if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) {
1151 1151
 		do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args );
1152 1152
 		return '';
1153 1153
 	}
1154 1154
 
1155
-	$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1155
+	$entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ];
1156 1156
 
1157 1157
 	/**
1158 1158
 	 * Create the content variables for replacing.
@@ -1168,37 +1168,37 @@  discard block
 block discarded – undo
1168 1168
 		'field_id' => '',
1169 1169
 	);
1170 1170
 
1171
-	$context['value'] = gv_value( $entry, $args['field'] );
1171
+	$context[ 'value' ] = gv_value( $entry, $args[ 'field' ] );
1172 1172
 
1173 1173
 	// If the value is empty and we're hiding empty, return empty.
1174
-	if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1174
+	if ( $context[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) {
1175 1175
 		return '';
1176 1176
 	}
1177 1177
 
1178
-	if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1179
-		$context['value'] = wpautop( $context['value'] );
1178
+	if ( $context[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) {
1179
+		$context[ 'value' ] = wpautop( $context[ 'value' ] );
1180 1180
 	}
1181 1181
 
1182 1182
 	// Get width setting, if exists
1183
-	$context['width'] = GravityView_API::field_width( $args['field'] );
1183
+	$context[ 'width' ] = GravityView_API::field_width( $args[ 'field' ] );
1184 1184
 
1185 1185
 	// If replacing with CSS inline formatting, let's do it.
1186
-	$context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' );
1186
+	$context[ 'width:style' ] = GravityView_API::field_width( $args[ 'field' ], 'width:' . $context[ 'width' ] . '%;' );
1187 1187
 
1188 1188
 	// Grab the Class using `gv_class`
1189
-	$context['class'] = gv_class( $args['field'], $args['form'], $entry );
1190
-	$context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry );
1189
+	$context[ 'class' ] = gv_class( $args[ 'field' ], $args[ 'form' ], $entry );
1190
+	$context[ 'field_id' ] = GravityView_API::field_html_attr_id( $args[ 'field' ], $args[ 'form' ], $entry );
1191 1191
 
1192 1192
 	// Get field label if needed
1193
-	if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) {
1194
-		$context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] );
1193
+	if ( ! empty( $args[ 'label_markup' ] ) && ! empty( $args[ 'field' ][ 'show_label' ] ) ) {
1194
+		$context[ 'label' ] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args[ 'label_markup' ] );
1195 1195
 	}
1196 1196
 
1197 1197
 	// Default Label value
1198
-	$context['label_value'] = gv_label( $args['field'], $entry );
1198
+	$context[ 'label_value' ] = gv_label( $args[ 'field' ], $entry );
1199 1199
 
1200
-	if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){
1201
-		$context['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1200
+	if ( empty( $context[ 'label' ] ) && ! empty( $context[ 'label_value' ] ) ) {
1201
+		$context[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>';
1202 1202
 	}
1203 1203
 
1204 1204
 	/**
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
 	 * @param string $markup The HTML for the markup
1208 1208
 	 * @param array $args All args for the field output
1209 1209
 	 */
1210
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args );
1210
+	$html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args );
1211 1211
 
1212 1212
 	/**
1213 1213
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
 	foreach ( $context as $tag => $value ) {
1231 1231
 
1232 1232
 		// If the tag doesn't exist just skip it
1233
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1233
+		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) {
1234 1234
 			continue;
1235 1235
 		}
1236 1236
 
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-ultimate-member.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	function parse_um_profile_post_content( $args = array() ) {
44 44
 		global $ultimatemember;
45 45
 
46
-		if( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) {
46
+		if ( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) {
47 47
 			return;
48 48
 		}
49 49
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			return;
60 60
 		}
61 61
 
62
-		GravityView_View_Data::getInstance()->parse_post_content( $active_tab[0]->post_content );
62
+		GravityView_View_Data::getInstance()->parse_post_content( $active_tab[ 0 ]->post_content );
63 63
 
64 64
 		wp_reset_postdata();
65 65
 	}
Please login to merge, or discard this patch.
plugin-and-theme-hooks/abstract-gravityview-plugin-and-theme-hooks.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 	private function maybe_add_hooks() {
92 92
 		$class_exists = $this->class_name && class_exists( $this->class_name );
93 93
 		$function_exists = $this->function_name && function_exists( $this->function_name );
94
-		$constant_defined = $this->constant_name && defined("{$this->constant_name}");
94
+		$constant_defined = $this->constant_name && defined( "{$this->constant_name}" );
95 95
 
96
-		if( $class_exists || $function_exists || $constant_defined ) {
96
+		if ( $class_exists || $function_exists || $constant_defined ) {
97 97
 			$this->add_hooks();
98 98
 		}
99 99
 	}
@@ -104,19 +104,19 @@  discard block
 block discarded – undo
104 104
 	 * @return void
105 105
 	 */
106 106
 	protected function add_hooks() {
107
-		if( $this->content_meta_keys ) {
107
+		if ( $this->content_meta_keys ) {
108 108
 			add_filter( 'gravityview/data/parse/meta_keys', array( $this, 'merge_content_meta_keys' ), 10, 2 );
109 109
 		}
110 110
 
111
-		if( $this->script_handles ) {
111
+		if ( $this->script_handles ) {
112 112
 			add_filter( 'gravityview_noconflict_scripts', array( $this, 'merge_noconflict_scripts' ) );
113 113
 		}
114 114
 
115
-		if( $this->style_handles ) {
115
+		if ( $this->style_handles ) {
116 116
 			add_filter( 'gravityview_noconflict_styles', array( $this, 'merge_noconflict_styles' ) );
117 117
 		}
118 118
 
119
-		if( $this->post_type_support ) {
119
+		if ( $this->post_type_support ) {
120 120
 			add_filter( 'gravityview_post_type_support', array( $this, 'merge_post_type_support' ), 10, 2 );
121 121
 		}
122 122
 	}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-password.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -49,17 +49,17 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @return string If a custom field label isn't set, return the field label for the password field
51 51
 	 */
52
-	function field_label( $label = '', $field = array(), $form = array(), $entry = array() ){
52
+	function field_label( $label = '', $field = array(), $form = array(), $entry = array() ) {
53 53
 
54 54
 		// If using a custom label, no need to fetch the parent label
55
-		if( ! is_numeric( $field['id'] ) || ! empty( $field['custom_label'] ) ) {
55
+		if ( ! is_numeric( $field[ 'id' ] ) || ! empty( $field[ 'custom_label' ] ) ) {
56 56
 			return $label;
57 57
 		}
58 58
 
59
-		$field_object = GFFormsModel::get_field( $form, $field['id'] );
59
+		$field_object = GFFormsModel::get_field( $form, $field[ 'id' ] );
60 60
 
61
-		if( $field_object && 'password' === $field_object->type ) {
62
-			$label = $field['label'];
61
+		if ( $field_object && 'password' === $field_object->type ) {
62
+			$label = $field[ 'label' ];
63 63
 		}
64 64
 
65 65
 		return $label;
@@ -79,17 +79,17 @@  discard block
 block discarded – undo
79 79
 	function add_form_fields( $fields = array(), $form = array(), $include_parent_field = true ) {
80 80
 
81 81
 		foreach ( $fields as $key => $field ) {
82
-			if( 'password' === $field['type'] ) {
82
+			if ( 'password' === $field[ 'type' ] ) {
83 83
 
84 84
 				// The Enter Password input
85
-				if( floor( $key ) === floatval( $key ) ) {
85
+				if ( floor( $key ) === floatval( $key ) ) {
86 86
 
87
-					if( ! empty( $field['parent'] ) ) {
88
-						$field['label']      = $field['parent']->label;
89
-						$field['adminOnly']  = $field['parent']->adminOnly;
90
-						$field['adminLabel'] = $field['parent']->adminLabel;
87
+					if ( ! empty( $field[ 'parent' ] ) ) {
88
+						$field[ 'label' ]      = $field[ 'parent' ]->label;
89
+						$field[ 'adminOnly' ]  = $field[ 'parent' ]->adminOnly;
90
+						$field[ 'adminLabel' ] = $field[ 'parent' ]->adminLabel;
91 91
 						// Don't show as a child input
92
-						unset( $field['parent'] );
92
+						unset( $field[ 'parent' ] );
93 93
 					}
94 94
 
95 95
 					$fields[ $key ] = $field;
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-elegant-themes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
 	 * Prevent Divi from adding their stuff to GV pages
35 35
 	 */
36 36
 	public function add_hooks_admin_init() {
37
-		if( GravityView_Admin::is_admin_page() ) {
37
+		if ( GravityView_Admin::is_admin_page() ) {
38 38
 			// Prevent Divi from adding import/export modal dialog
39 39
 			remove_action( 'admin_init', 'et_pb_register_builder_portabilities' );
40 40
 
Please login to merge, or discard this patch.
includes/class-oembed.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	static function getInstance() {
44 44
 
45
-		if( empty( self::$instance ) ) {
45
+		if ( empty( self::$instance ) ) {
46 46
 			self::$instance = new self;
47 47
 
48 48
 			self::$instance->initialize();
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		// Catch either
95 95
 		$match_regex = "(?:{$using_permalinks}|{$not_using_permalinks})";
96 96
 
97
-		return '#'.$match_regex.'#i';
97
+		return '#' . $match_regex . '#i';
98 98
 	}
99 99
 
100 100
 	/**
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$post_id = url_to_postid( $url );
115 115
 
116
-		if( empty( $post_id ) ) {
116
+		if ( empty( $post_id ) ) {
117 117
 
118 118
 			$args = array(
119 119
 				'post_status' => 'publish',
120 120
 				'name' => $slug,
121
-				'post_type' => array('any', 'gravityview'),
121
+				'post_type' => array( 'any', 'gravityview' ),
122 122
 			);
123 123
 
124 124
 			$posts = get_posts( $args );
125 125
 
126
-			if( !empty( $posts ) ) {
127
-				$post_id = $posts[0]->ID;
126
+			if ( ! empty( $posts ) ) {
127
+				$post_id = $posts[ 0 ]->ID;
128 128
 			}
129 129
 		}
130 130
 
@@ -157,17 +157,17 @@  discard block
 block discarded – undo
157 157
 	public function render_handler( $matches, $attr, $url, $rawattr ) {
158 158
 
159 159
 		// If not using permalinks, re-assign values for matching groups
160
-		if( !empty( $matches['entry_slug2'] ) ) {
161
-			$matches['is_cpt'] = $matches['is_cpt2'];
162
-			$matches['slug'] = $matches['slug2'];
163
-			$matches['entry_slug'] = $matches['entry_slug2'];
164
-			unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] );
160
+		if ( ! empty( $matches[ 'entry_slug2' ] ) ) {
161
+			$matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ];
162
+			$matches[ 'slug' ] = $matches[ 'slug2' ];
163
+			$matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ];
164
+			unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] );
165 165
 		}
166 166
 
167 167
 		// No Entry was found
168
-		if( empty( $matches['entry_slug'] ) ) {
168
+		if ( empty( $matches[ 'entry_slug' ] ) ) {
169 169
 
170
-			do_action('gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches );
170
+			do_action( 'gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches );
171 171
 
172 172
 			return '';
173 173
 		}
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 		// Setup the data used
178 178
 		$this->set_vars( $matches, $attr, $url, $rawattr );
179 179
 
180
-		if( is_admin() && !$this->is_full_oembed_preview ) {
180
+		if ( is_admin() && ! $this->is_full_oembed_preview ) {
181 181
 			$return = $this->render_admin( $matches, $attr, $url, $rawattr );
182 182
 		} else {
183 183
 
184
-			if( $this->is_full_oembed_preview ) {
184
+			if ( $this->is_full_oembed_preview ) {
185 185
 				$return .= $this->generate_preview_notice();
186 186
 			}
187 187
 
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 	private function generate_preview_notice() {
201 201
 		$floaty = GravityView_Admin::get_floaty();
202 202
 		$title = esc_html__( 'This will look better when it is embedded.', 'gravityview' );
203
-		$message = esc_html__('Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview');
204
-		return '<div class="updated notice">'. $floaty. '<h3>'.$title.'</h3><p>'.$message.'</p><br style="clear:both;" /></div>';
203
+		$message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview' );
204
+		return '<div class="updated notice">' . $floaty . '<h3>' . $title . '</h3><p>' . $message . '</p><br style="clear:both;" /></div>';
205 205
 	}
206 206
 
207 207
 	/**
@@ -214,14 +214,14 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	private function set_vars( $matches, $attr, $url, $rawattr ) {
216 216
 
217
-		$this->entry_id = $matches['entry_slug'];
217
+		$this->entry_id = $matches[ 'entry_slug' ];
218 218
 
219
-		$post_id = $this->get_postid_from_url_and_slug( $url, $matches['slug'] );
219
+		$post_id = $this->get_postid_from_url_and_slug( $url, $matches[ 'slug' ] );
220 220
 
221 221
 		// The URL didn't have the View Custom Post Type structure.
222
-		if( empty( $matches['is_cpt'] ) || $matches['is_cpt'] !== 'gravityview' ) {
222
+		if ( empty( $matches[ 'is_cpt' ] ) || $matches[ 'is_cpt' ] !== 'gravityview' ) {
223 223
 
224
-			do_action('gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches );
224
+			do_action( 'gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches );
225 225
 
226 226
 			$this->view_id = GravityView_View_Data::getInstance()->maybe_get_view_id( $post_id );
227 227
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		}
233 233
 
234 234
 		// The inline content has $_POST['type'] set to "embed", while the "Add Media" modal doesn't set that.
235
-		$this->is_full_oembed_preview = ( isset( $_POST['action'] ) && $_POST['action'] === 'parse-embed' && !isset( $_POST['type'] ) );
235
+		$this->is_full_oembed_preview = ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] === 'parse-embed' && ! isset( $_POST[ 'type' ] ) );
236 236
 	}
237 237
 
238 238
 	/**
@@ -250,15 +250,15 @@  discard block
 block discarded – undo
250 250
 		// Floaty the astronaut
251 251
 		$image = GravityView_Admin::get_floaty();
252 252
 
253
-		$embed_heading = sprintf( esc_html__('Embed Entry %d', 'gravityview'), $this->entry_id );
253
+		$embed_heading = sprintf( esc_html__( 'Embed Entry %d', 'gravityview' ), $this->entry_id );
254 254
 
255
-		$embed_text = sprintf( esc_html__('This entry will be displayed as it is configured in View %d', 'gravityview'), $this->view_id );
255
+		$embed_text = sprintf( esc_html__( 'This entry will be displayed as it is configured in View %d', 'gravityview' ), $this->view_id );
256 256
 
257 257
 		return '
258 258
 		<div class="loading-placeholder" style="background-color:#e6f0f5;">
259
-			<h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image.$embed_heading.'</h3>
259
+			<h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image . $embed_heading . '</h3>
260 260
 			<p style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">
261
-				'.$embed_text.'
261
+				'.$embed_text . '
262 262
 			</p>
263 263
 			<br style="clear: both;">
264 264
 		</div>';
@@ -313,14 +313,14 @@  discard block
 block discarded – undo
313 313
 	private function render_frontend( $matches, $attr, $url, $rawattr ) {
314 314
 
315 315
 		// If it's already been parsed, don't re-output it.
316
-		if( !empty( $this->output[ $this->entry_id ] ) ) {
316
+		if ( ! empty( $this->output[ $this->entry_id ] ) ) {
317 317
 			return $this->output[ $this->entry_id ];
318 318
 		}
319 319
 
320 320
 		$entry_output = $this->generate_entry_output();
321 321
 
322 322
 		// Wrap a container div around the output to allow for custom styling
323
-		$output = sprintf('<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-'.$this->entry_id.'">%s</div>', $entry_output );
323
+		$output = sprintf( '<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-' . $this->entry_id . '">%s</div>', $entry_output );
324 324
 
325 325
 		/**
326 326
 		 * @filter `gravityview/oembed/entry` Filter the output of the oEmbed entry embed
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 		 *  @var string $url The original URL that was matched by the regex. \n
334 334
 		 *  @var array $rawattr The original unmodified attributes.
335 335
 		 */
336
-		$output = apply_filters('gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) );
336
+		$output = apply_filters( 'gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) );
337 337
 
338 338
 		unset( $entry_output );
339 339
 
Please login to merge, or discard this patch.