Completed
Pull Request — develop (#1656)
by
unknown
17:57
created
includes/extensions/edit-entry/class-edit-entry.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
39
+        if ( is_admin() ) {
40 40
             $this->load_components( 'admin' );
41 41
         }
42 42
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
     static function getInstance() {
58 58
 
59
-        if( empty( self::$instance ) ) {
59
+        if ( empty( self::$instance ) ) {
60 60
             self::$instance = new GravityView_Edit_Entry;
61 61
         }
62 62
 
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
     private function add_hooks() {
83 83
 
84 84
         // Add front-end access to Gravity Forms delete file action
85
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
85
+        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file' ) );
86 86
 
87 87
         // Make sure this hook is run for non-admins
88
-        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
88
+        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file' ) );
89 89
 
90 90
         add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
91 91
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function add_reserved_arg( $args ) {
110 110
 
111
-		$args[] = 'edit';
111
+		$args[ ] = 'edit';
112 112
 
113 113
 		return $args;
114 114
 	}
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	private function addon_specific_hooks() {
121 121
 
122
-		if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
123
-			add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script'));
122
+		if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
123
+			add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) );
124 124
 		}
125 125
 
126 126
 	}
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
209 209
 
210
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
210
+        $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] );
211 211
 
212
-        $base = gv_entry_link( $entry, $post_id ? : $view_id  );
212
+        $base = gv_entry_link( $entry, $post_id ?: $view_id );
213 213
 
214 214
         $url = add_query_arg( array(
215 215
             'edit' => wp_create_nonce( $nonce_key )
216 216
         ), $base );
217 217
 
218
-        if( $post_id ) {
218
+        if ( $post_id ) {
219 219
 	        $url = add_query_arg( array( 'gvid' => $view_id ), $url );
220 220
         }
221 221
 
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 	     * Allow passing params to dynamically populate entry with values
224 224
 	     * @since 1.9.2
225 225
 	     */
226
-	    if( !empty( $field_values ) ) {
226
+	    if ( ! empty( $field_values ) ) {
227 227
 
228
-		    if( is_array( $field_values ) ) {
228
+		    if ( is_array( $field_values ) ) {
229 229
 			    // If already an array, no parse_str() needed
230 230
 			    $params = $field_values;
231 231
 		    } else {
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		 * @param array $entry The entry.
242 242
 		 * @param \GV\View $view The View.
243 243
 		 */
244
-		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id  ) );
244
+		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ) );
245 245
     }
246 246
 
247 247
 	/**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	public function modify_field_blacklist( $fields = array(), $context = NULL ) {
254 254
 
255
-		if( empty( $context ) || $context !== 'edit' ) {
255
+		if ( empty( $context ) || $context !== 'edit' ) {
256 256
 			return $fields;
257 257
 		}
258 258
 
@@ -330,15 +330,15 @@  discard block
 block discarded – undo
330 330
         // If they can edit any entries (as defined in Gravity Forms)
331 331
         // Or if they can edit other people's entries
332 332
         // Then we're good.
333
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
333
+        if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) {
334 334
 
335 335
             gravityview()->log->debug( 'User has ability to edit all entries.' );
336 336
 
337 337
             $user_can_edit = true;
338 338
 
339
-        } else if( !isset( $entry['created_by'] ) ) {
339
+        } else if ( ! isset( $entry[ 'created_by' ] ) ) {
340 340
 
341
-            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
341
+            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
342 342
 
343 343
             $user_can_edit = false;
344 344
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
             $current_user = wp_get_current_user();
348 348
 
349 349
             // User edit is disabled
350
-            if( empty( $user_edit ) ) {
350
+            if ( empty( $user_edit ) ) {
351 351
 
352 352
                 gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
353 353
 
@@ -355,13 +355,13 @@  discard block
 block discarded – undo
355 355
             }
356 356
 
357 357
             // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
358
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
358
+            else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
359 359
 
360 360
                 gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
361 361
 
362 362
                 $user_can_edit = true;
363 363
 
364
-            } else if( ! is_user_logged_in() ) {
364
+            } else if ( ! is_user_logged_in() ) {
365 365
 
366 366
                 gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
367 367
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
          */
380 380
         $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
381 381
 
382
-        return (bool) $user_can_edit;
382
+        return (bool)$user_can_edit;
383 383
     }
384 384
 
385 385
 
Please login to merge, or discard this patch.
includes/extensions/duplicate-entry/class-duplicate-entry.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function add_reserved_arg( $args ) {
85 85
 
86
-		$args[] = 'duplicate';
86
+		$args[ ] = 'duplicate';
87 87
 
88 88
 		return $args;
89 89
 	}
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function _filter_sortable_fields( $fields ) {
157 157
 
158
-		$fields = (array) $fields;
158
+		$fields = (array)$fields;
159 159
 
160
-		$fields[] = 'duplicate_link';
160
+		$fields[ ] = 'duplicate_link';
161 161
 
162 162
 		return $fields;
163 163
 	}
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
 	public function duplicate_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
197 197
 
198 198
 		// Always a link, never a filter, always same window
199
-		unset( $field_options['show_as_link'], $field_options['search_filter'], $field_options['new_window'] );
199
+		unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ], $field_options[ 'new_window' ] );
200 200
 
201 201
 		// Duplicate Entry link should only appear to visitors capable of editing entries
202
-		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
202
+		unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
203 203
 
204
-		$add_option['duplicate_link'] = array(
204
+		$add_option[ 'duplicate_link' ] = array(
205 205
 			'type' => 'text',
206 206
 			'label' => __( 'Duplicate Link Text', 'gravityview' ),
207 207
 			'desc' => NULL,
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 			'merge_tags' => true,
210 210
 		);
211 211
 
212
-		$field_options['allow_duplicate_cap'] = array(
212
+		$field_options[ 'allow_duplicate_cap' ] = array(
213 213
 			'type' => 'select',
214 214
 			'label' => __( 'Allow the following users to duplicate the entry:', 'gravityview' ),
215 215
 			'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	public function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
237 237
 
238 238
 		if ( 'edit' !== $zone ) {
239
-			$entry_default_fields['duplicate_link'] = array(
239
+			$entry_default_fields[ 'duplicate_link' ] = array(
240 240
 				'label' => __( 'Duplicate Entry', 'gravityview' ),
241 241
 				'type'  => 'duplicate_link',
242 242
 				'desc'  => __( 'A link to duplicate the entry. Respects the Duplicate Entry permissions.', 'gravityview' ),
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public function add_available_field( $available_fields = array() ) {
260 260
 
261
-		$available_fields['duplicate_link'] = array(
261
+		$available_fields[ 'duplicate_link' ] = array(
262 262
 			'label_text' => __( 'Duplicate Entry', 'gravityview' ),
263 263
 			'field_id' => 'duplicate_link',
264 264
 			'label_type' => 'field',
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 		if ( 'duplicate_link' === $field_id ) {
292 292
 
293 293
 			// Remove other built-in caps.
294
-			unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['duplicate_others_posts'] );
294
+			unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'duplicate_others_posts' ] );
295 295
 
296
-			$caps['read'] = _x( 'Entry Creator', 'User capability', 'gravityview' );
296
+			$caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' );
297 297
 		}
298 298
 
299 299
 		return $caps;
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	 */
329 329
 	public static function get_duplicate_link( $entry, $view_id, $post_id = null ) {
330 330
 
331
-        $base = GravityView_API::directory_link( $post_id ? : $view_id, true );
331
+        $base = GravityView_API::directory_link( $post_id ?: $view_id, true );
332 332
 
333 333
 		if ( empty( $base ) ) {
334 334
 			gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) );
@@ -337,12 +337,12 @@  discard block
 block discarded – undo
337 337
 
338 338
 		$actionurl = add_query_arg( array(
339 339
 			'action'	=> 'duplicate',
340
-			'entry_id'	=> $entry['id'],
340
+			'entry_id'	=> $entry[ 'id' ],
341 341
 			'gvid' => $view_id,
342 342
             'view_id' => $view_id,
343 343
 		), $base );
344 344
 
345
-		return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry['id'] ) ), $actionurl );
345
+		return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry[ 'id' ] ) ), $actionurl );
346 346
 	}
347 347
 
348 348
 	/**
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
 	public function process_duplicate() {
364 364
 
365 365
 		// If the form is submitted
366
-		if ( ( ! isset( $_GET['action'] ) ) || 'duplicate' !== $_GET['action'] || ( ! isset( $_GET['entry_id'] ) ) ) {
366
+		if ( ( ! isset( $_GET[ 'action' ] ) ) || 'duplicate' !== $_GET[ 'action' ] || ( ! isset( $_GET[ 'entry_id' ] ) ) ) {
367 367
 			return;
368 368
 		}
369 369
 
370 370
 		// Make sure it's a GravityView request
371
-		$valid_nonce_key = wp_verify_nonce( \GV\Utils::_GET( 'duplicate' ), self::get_nonce_key( $_GET['entry_id'] ) );
371
+		$valid_nonce_key = wp_verify_nonce( \GV\Utils::_GET( 'duplicate' ), self::get_nonce_key( $_GET[ 'entry_id' ] ) );
372 372
 
373 373
 		if ( ! $valid_nonce_key ) {
374 374
 			gravityview()->log->debug( 'Duplicate entry not processed: nonce validation failed.' );
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 		}
377 377
 
378 378
 		// Get the entry slug
379
-		$entry_slug = esc_attr( $_GET['entry_id'] );
379
+		$entry_slug = esc_attr( $_GET[ 'entry_id' ] );
380 380
 
381 381
 		// See if there's an entry there
382 382
 		$entry = gravityview_get_entry( $entry_slug, true, false );
@@ -470,17 +470,17 @@  discard block
 block discarded – undo
470 470
 			return new WP_Error( 'gravityview-duplicate-entry-missing', __( 'The entry does not exist.', 'gravityview' ) );
471 471
 		}
472 472
 
473
-		$form = GFAPI::get_form( $entry['form_id'] );
473
+		$form = GFAPI::get_form( $entry[ 'form_id' ] );
474 474
 
475
-		$row['id'] = null;
476
-		$row['date_created'] = date( 'Y-m-d H:i:s', time() );
477
-		$row['date_updated'] = $row['date_created'];
478
-		$row['is_starred'] = false;
479
-		$row['is_read'] = false;
480
-		$row['ip'] = rgars( $form, 'personalData/preventIP' ) ? '' : GFFormsModel::get_ip();
481
-		$row['source_url'] = esc_url_raw( remove_query_arg( array( 'action', 'gvid', 'result', 'duplicate', 'entry_id' ) ) );
482
-		$row['user_agent'] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' );
483
-		$row['created_by'] = wp_get_current_user()->ID;
475
+		$row[ 'id' ] = null;
476
+		$row[ 'date_created' ] = date( 'Y-m-d H:i:s', time() );
477
+		$row[ 'date_updated' ] = $row[ 'date_created' ];
478
+		$row[ 'is_starred' ] = false;
479
+		$row[ 'is_read' ] = false;
480
+		$row[ 'ip' ] = rgars( $form, 'personalData/preventIP' ) ? '' : GFFormsModel::get_ip();
481
+		$row[ 'source_url' ] = esc_url_raw( remove_query_arg( array( 'action', 'gvid', 'result', 'duplicate', 'entry_id' ) ) );
482
+		$row[ 'user_agent' ] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' );
483
+		$row[ 'created_by' ] = wp_get_current_user()->ID;
484 484
 
485 485
 		/**
486 486
 		 * @filter `gravityview/entry/duplicate/details` Modify the new entry details before it's created.
@@ -508,15 +508,15 @@  discard block
 block discarded – undo
508 508
 
509 509
 		$save_this_meta = array();
510 510
 		foreach ( $duplicate_meta->get_output() as $m ) {
511
-			$save_this_meta[] = array(
512
-				'meta_key' => $m['meta_key'],
513
-				'meta_value' => $m['meta_value'],
514
-				'item_index' => $m['item_index'],
511
+			$save_this_meta[ ] = array(
512
+				'meta_key' => $m[ 'meta_key' ],
513
+				'meta_value' => $m[ 'meta_value' ],
514
+				'item_index' => $m[ 'item_index' ],
515 515
 			);
516 516
 		}
517 517
 
518 518
 		// Update the row ID for later usage
519
-		$row['id'] = $duplicated_id;
519
+		$row[ 'id' ] = $duplicated_id;
520 520
 
521 521
 		/**
522 522
 		 * @filter `gravityview/entry/duplicate/meta` Modify the new entry meta details.
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
 		$save_this_meta = apply_filters( 'gravityview/entry/duplicate/meta', $save_this_meta, $row, $entry );
528 528
 
529 529
 		foreach ( $save_this_meta as $data ) {
530
-			$data['form_id'] = $entry['form_id'];
531
-			$data['entry_id'] = $duplicated_id;
530
+			$data[ 'form_id' ] = $entry[ 'form_id' ];
531
+			$data[ 'entry_id' ] = $duplicated_id;
532 532
 
533 533
 			if ( ! $wpdb->insert( $entry_meta_table, $data ) ) {
534 534
 				return new WP_Error( 'gravityview-duplicate-entry-db-meta', __( 'There was an error duplicating the entry.', 'gravityview' ) );
@@ -562,13 +562,13 @@  discard block
 block discarded – undo
562 562
 	public function verify_nonce() {
563 563
 
564 564
 		// No duplicate entry request was made
565
-		if ( empty( $_GET['entry_id'] ) || empty( $_GET['duplicate'] ) ) {
565
+		if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'duplicate' ] ) ) {
566 566
 			return false;
567 567
 		}
568 568
 
569
-		$nonce_key = self::get_nonce_key( $_GET['entry_id'] );
569
+		$nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] );
570 570
 
571
-		$valid = wp_verify_nonce( $_GET['duplicate'], $nonce_key );
571
+		$valid = wp_verify_nonce( $_GET[ 'duplicate' ], $nonce_key );
572 572
 
573 573
 		/**
574 574
 		 * @filter `gravityview/duplicate-entry/verify_nonce` Override Duplicate Entry nonce validation. Return true to declare nonce valid.
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 			return '';
605 605
 		}
606 606
 
607
-		return 'return window.confirm(\''. esc_js( $confirm ) .'\');';
607
+		return 'return window.confirm(\'' . esc_js( $confirm ) . '\');';
608 608
 	}
609 609
 
610 610
 	/**
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 	public static function check_user_cap_duplicate_entry( $entry, $field = array(), $view_id = 0 ) {
659 659
 		$current_user = wp_get_current_user();
660 660
 
661
-		$entry_id = isset( $entry['id'] ) ? $entry['id'] : null;
661
+		$entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : null;
662 662
 
663 663
 		// Or if they can duplicate any entries (as defined in Gravity Forms), we're good.
664 664
 		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gform_full_access', 'gravityview_full_access' ), $entry_id ) ) {
@@ -673,17 +673,17 @@  discard block
 block discarded – undo
673 673
 		if ( ! empty( $field ) ) {
674 674
 
675 675
 			// If capability is not defined, something is not right!
676
-			if ( empty( $field['allow_duplicate_cap'] ) ) {
676
+			if ( empty( $field[ 'allow_duplicate_cap' ] ) ) {
677 677
 
678 678
 				gravityview()->log->error( 'Cannot read duplicate entry field caps', array( 'data' => $field ) );
679 679
 
680 680
 				return false;
681 681
 			}
682 682
 
683
-			if ( GVCommon::has_cap( $field['allow_duplicate_cap'] ) ) {
683
+			if ( GVCommon::has_cap( $field[ 'allow_duplicate_cap' ] ) ) {
684 684
 
685 685
 				// Do not return true if cap is read, as we need to check if the current user created the entry
686
-				if ( 'read' !== $field['allow_duplicate_cap'] ) {
686
+				if ( 'read' !== $field[ 'allow_duplicate_cap' ] ) {
687 687
 					return true;
688 688
 				}
689 689
 
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 
697 697
 		}
698 698
 
699
-		if ( ! isset( $entry['created_by'] ) ) {
699
+		if ( ! isset( $entry[ 'created_by' ] ) ) {
700 700
 
701 701
 			gravityview()->log->error( 'Cannot duplicate entry; entry `created_by` doesn\'t exist.' );
702 702
 
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 		}
722 722
 
723 723
 		// If the logged-in user is the same as the user who created the entry, we're good.
724
-		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
724
+		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
725 725
 
726 726
 			gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) );
727 727
 
@@ -745,12 +745,12 @@  discard block
 block discarded – undo
745 745
 	 * @return void
746 746
 	 */
747 747
 	public function maybe_display_message( $current_view_id = 0 ) {
748
-		if ( empty( $_GET['status'] ) || ! self::verify_nonce() ) {
748
+		if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) {
749 749
 			return;
750 750
 		}
751 751
 
752 752
 		// Entry wasn't duplicated from current View
753
-		if ( isset( $_GET['view_id'] ) && ( intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) ) {
753
+		if ( isset( $_GET[ 'view_id' ] ) && ( intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) ) {
754 754
 			return;
755 755
 		}
756 756
 
@@ -758,11 +758,11 @@  discard block
 block discarded – undo
758 758
 	}
759 759
 
760 760
 	public function display_message() {
761
-		if ( empty( $_GET['status'] ) || empty( $_GET['duplicate'] ) ) {
761
+		if ( empty( $_GET[ 'status' ] ) || empty( $_GET[ 'duplicate' ] ) ) {
762 762
 			return;
763 763
 		}
764 764
 
765
-		$status = esc_attr( $_GET['status'] );
765
+		$status = esc_attr( $_GET[ 'status' ] );
766 766
 		$message_from_url = \GV\Utils::_GET( 'message' );
767 767
 		$message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) );
768 768
 		$class = '';
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 		$message = apply_filters( 'gravityview/duplicate-entry/message', esc_attr( $message ), $status, $message_from_url );
789 789
 
790 790
 		// DISPLAY ERROR/SUCCESS MESSAGE
791
-		echo '<div class="gv-notice' . esc_attr( $class ) .'">'. $message .'</div>';
791
+		echo '<div class="gv-notice' . esc_attr( $class ) . '">' . $message . '</div>';
792 792
 	}
793 793
 
794 794
 	/**
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 		?>
819 819
 		<span class="gv-duplicate">
820 820
 			|
821
-			<a href="<?php echo wp_nonce_url( add_query_arg( 'entry_id', $entry['id'] ), self::get_nonce_key( $entry['id'] ), 'duplicate' ); ?>"><?php esc_html_e( 'Duplicate', 'gravityview' ); ?></a>
821
+			<a href="<?php echo wp_nonce_url( add_query_arg( 'entry_id', $entry[ 'id' ] ), self::get_nonce_key( $entry[ 'id' ] ), 'duplicate' ); ?>"><?php esc_html_e( 'Duplicate', 'gravityview' ); ?></a>
822 822
 		</span>
823 823
 		<?php
824 824
 	}
@@ -840,9 +840,9 @@  discard block
 block discarded – undo
840 840
 
841 841
 		if ( 'success' === \GV\Utils::_GET( 'result' ) ) {
842 842
 			add_filter( 'gform_admin_messages', function( $messages ) {
843
-				$messages = (array) $messages;
843
+				$messages = (array)$messages;
844 844
 
845
-				$messages[] = esc_html__( 'Entry duplicated.', 'gravityview' );
845
+				$messages[ ] = esc_html__( 'Entry duplicated.', 'gravityview' );
846 846
 				return $messages;
847 847
 			} );
848 848
 		}
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
 
854 854
 			$check_logs_message = '';
855 855
 
856
-			if( $is_logging_active ) {
856
+			if ( $is_logging_active ) {
857 857
 				$check_logs_message = sprintf( ' <a href="%s">%s</a>',
858 858
 					esc_url( admin_url( 'admin.php?page=gf_settings&subview=gravityformslogging' ) ),
859 859
 					esc_html_x( 'Check the GravityView logs for more information.', 'Error message links to logging page', 'gravityview' )
@@ -861,9 +861,9 @@  discard block
 block discarded – undo
861 861
 			}
862 862
 
863 863
 			add_filter( 'gform_admin_error_messages', function( $messages ) use ( $check_logs_message ) {
864
-				$messages = (array) $messages;
864
+				$messages = (array)$messages;
865 865
 
866
-				$messages[] = esc_html__( 'There was an error duplicating the entry.', 'gravityview' ) . $check_logs_message;
866
+				$messages[ ] = esc_html__( 'There was an error duplicating the entry.', 'gravityview' ) . $check_logs_message;
867 867
 
868 868
 				return $messages;
869 869
 			} );
Please login to merge, or discard this patch.
includes/class-api.php 1 patch
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$form = $gravityview_view->getForm();
32 32
 
33
-		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS['GravityView_API_field_label_override'] ) ) {
33
+		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS[ 'GravityView_API_field_label_override' ] ) ) {
34 34
 			/** Allow to fall through for back compatibility testing purposes. */
35 35
 		} else {
36 36
 			return \GV\Mocks\GravityView_API_field_label( $form, $field, $entry, $force_show_label );
@@ -38,29 +38,29 @@  discard block
 block discarded – undo
38 38
 
39 39
 		$label = '';
40 40
 
41
-		if( !empty( $field['show_label'] ) || $force_show_label ) {
41
+		if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) {
42 42
 
43
-			$label = $field['label'];
43
+			$label = $field[ 'label' ];
44 44
 
45 45
 			// Support Gravity Forms 1.9+
46
-			if( class_exists( 'GF_Field' ) ) {
46
+			if ( class_exists( 'GF_Field' ) ) {
47 47
 
48
-				$field_object = RGFormsModel::get_field( $form, $field['id'] );
48
+				$field_object = RGFormsModel::get_field( $form, $field[ 'id' ] );
49 49
 
50
-				if( $field_object ) {
50
+				if ( $field_object ) {
51 51
 
52
-					$input = GFFormsModel::get_input( $field_object, $field['id'] );
52
+					$input = GFFormsModel::get_input( $field_object, $field[ 'id' ] );
53 53
 
54 54
 					// This is a complex field, with labels on a per-input basis
55
-					if( $input ) {
55
+					if ( $input ) {
56 56
 
57 57
 						// Does the input have a custom label on a per-input basis? Otherwise, default label.
58
-						$label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label'];
58
+						$label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ];
59 59
 
60 60
 					} else {
61 61
 
62 62
 						// This is a field with one label
63
-						$label = $field_object->get_field_label( true, $field['label'] );
63
+						$label = $field_object->get_field_label( true, $field[ 'label' ] );
64 64
 
65 65
 					}
66 66
 
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 			}
70 70
 
71 71
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
72
-			if ( !empty( $field['custom_label'] ) ) {
72
+			if ( ! empty( $field[ 'custom_label' ] ) ) {
73 73
 
74
-				$label = self::replace_variables( $field['custom_label'], $form, $entry );
74
+				$label = self::replace_variables( $field[ 'custom_label' ], $form, $entry );
75 75
 
76 76
 			}
77 77
 
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 
134 134
 		$width = NULL;
135 135
 
136
-		if( !empty( $field['width'] ) ) {
137
-			$width = absint( $field['width'] );
136
+		if ( ! empty( $field[ 'width' ] ) ) {
137
+			$width = absint( $field[ 'width' ] );
138 138
 
139 139
 			// If using percentages, limit to 100%
140
-			if( '%d%%' === $format && $width > 100 ) {
140
+			if ( '%d%%' === $format && $width > 100 ) {
141 141
 				$width = 100;
142 142
 			}
143 143
 
@@ -157,42 +157,42 @@  discard block
 block discarded – undo
157 157
 	public static function field_class( $field, $form = NULL, $entry = NULL ) {
158 158
 		$classes = array();
159 159
 
160
-		if( !empty( $field['custom_class'] ) ) {
160
+		if ( ! empty( $field[ 'custom_class' ] ) ) {
161 161
 
162
-            $custom_class = $field['custom_class'];
162
+            $custom_class = $field[ 'custom_class' ];
163 163
 
164
-            if( !empty( $entry ) ) {
164
+            if ( ! empty( $entry ) ) {
165 165
 
166 166
                 // We want the merge tag to be formatted as a class. The merge tag may be
167 167
                 // replaced by a multiple-word value that should be output as a single class.
168 168
                 // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
169
-                add_filter('gform_merge_tag_filter', 'sanitize_html_class');
169
+                add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
170 170
 
171
-                $custom_class = self::replace_variables( $custom_class, $form, $entry);
171
+                $custom_class = self::replace_variables( $custom_class, $form, $entry );
172 172
 
173 173
                 // And then we want life to return to normal
174
-                remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
174
+                remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
175 175
             }
176 176
 
177 177
 			// And now we want the spaces to be handled nicely.
178
-			$classes[] = gravityview_sanitize_html_class( $custom_class );
178
+			$classes[ ] = gravityview_sanitize_html_class( $custom_class );
179 179
 
180 180
 		}
181 181
 
182
-		if(!empty($field['id'])) {
183
-			if( !empty( $form ) && !empty( $form['id'] ) ) {
184
-				$form_id = '-'.$form['id'];
182
+		if ( ! empty( $field[ 'id' ] ) ) {
183
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
184
+				$form_id = '-' . $form[ 'id' ];
185 185
 			} else {
186 186
 				// @deprecated path. Form should always be given.
187 187
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
188 188
 				$gravityview_view = GravityView_View::getInstance();
189
-				$form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : '';
189
+				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
190 190
 			}
191 191
 
192
-			$classes[] = 'gv-field'.$form_id.'-'.$field['id'];
192
+			$classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ];
193 193
 		}
194 194
 
195
-		return esc_attr(implode(' ', $classes));
195
+		return esc_attr( implode( ' ', $classes ) );
196 196
 	}
197 197
 
198 198
 	/**
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
 	 * @return string Sanitized unique HTML `id` attribute for the field
208 208
 	 */
209 209
 	public static function field_html_attr_id( $field, $form = array(), $entry = array() ) {
210
-		$id = $field['id'];
210
+		$id = $field[ 'id' ];
211 211
 
212 212
 		if ( ! empty( $id ) ) {
213
-			if ( ! empty( $form ) && ! empty( $form['id'] ) ) {
214
-				$form_id = '-' . $form['id'];
213
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
214
+				$form_id = '-' . $form[ 'id' ];
215 215
 			} else {
216 216
 				// @deprecated path. Form should always be given.
217 217
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
220 220
 			}
221 221
 
222
-			$id = 'gv-field' . $form_id . '-' . $field['id'];
222
+			$id = 'gv-field' . $form_id . '-' . $field[ 'id' ];
223 223
 		}
224 224
 
225 225
 		return esc_attr( $id );
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array(), $base_id = null ) {
260 260
 
261
-		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) {
261
+		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) {
262 262
 			gravityview()->log->debug( 'Entry not defined; returning null', array( 'data' => $entry ) );
263 263
 			return NULL;
264 264
 		}
265 265
 
266 266
 		$href = self::entry_link( $entry, $base_id );
267 267
 
268
-		if( '' === $href ) {
268
+		if ( '' === $href ) {
269 269
 			return NULL;
270 270
 		}
271 271
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 		} else {
303 303
 			$gravityview_view = GravityView_View::getInstance();
304 304
 
305
-			if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
305
+			if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
306 306
 				$is_search = true;
307 307
 			}
308 308
 		}
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
 			$output = esc_html__( 'This search returned no results.', 'gravityview' );
315 315
 
316
-			if( $context ) {
316
+			if ( $context ) {
317 317
 				$setting = $context->view->settings->get( 'no_search_results_text', $output );
318 318
 			}
319 319
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
 			$output = esc_html__( 'No entries match your request.', 'gravityview' );
323 323
 
324
-			if( $context ) {
324
+			if ( $context ) {
325 325
 				$setting = $context->view->settings->get( 'no_results_text', $output );
326 326
 			}
327 327
 		}
@@ -439,9 +439,9 @@  discard block
 block discarded – undo
439 439
 
440 440
 		// If we've saved the permalink in memory, use it
441 441
 		// @since 1.3
442
-		$link = wp_cache_get( 'gv_directory_link_'.$post_id );
442
+		$link = wp_cache_get( 'gv_directory_link_' . $post_id );
443 443
 
444
-		if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) {
444
+		if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) {
445 445
 			$link = home_url();
446 446
 		}
447 447
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 
451 451
 			// If not yet saved, cache the permalink.
452 452
 			// @since 1.3
453
-			wp_cache_set( 'gv_directory_link_'.$post_id, $link );
453
+			wp_cache_set( 'gv_directory_link_' . $post_id, $link );
454 454
 		}
455 455
 
456 456
 		// Deal with returning to proper pagination for embedded views
@@ -458,13 +458,13 @@  discard block
 block discarded – undo
458 458
 
459 459
 			$args = array();
460 460
 
461
-			if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
462
-				$args['pagenum'] = intval( $pagenum );
461
+			if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
462
+				$args[ 'pagenum' ] = intval( $pagenum );
463 463
 			}
464 464
 
465
-			if( $sort = \GV\Utils::_GET( 'sort' ) ) {
466
-				$args['sort'] = $sort;
467
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
465
+			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
466
+				$args[ 'sort' ] = $sort;
467
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
468 468
 			}
469 469
 
470 470
 			$link = add_query_arg( $args, $link );
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 	private static function get_custom_entry_slug( $id, $entry = array() ) {
502 502
 
503 503
 		// Generate an unique hash to use as the default value
504
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
504
+		$slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 );
505 505
 
506 506
 		/**
507 507
 		 * @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}`
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
513 513
 
514 514
 		// Make sure we have something - use the original ID as backup.
515
-		if( empty( $slug ) ) {
515
+		if ( empty( $slug ) ) {
516 516
 			$slug = $id;
517 517
 		}
518 518
 
@@ -606,15 +606,15 @@  discard block
 block discarded – undo
606 606
          * @param boolean $custom Should we process the custom entry slug?
607 607
          */
608 608
         $custom = apply_filters( 'gravityview_custom_entry_slug', false );
609
-        if( $custom ) {
609
+        if ( $custom ) {
610 610
             // create the gravityview_unique_id and save it
611 611
 
612 612
             // Get the entry hash
613
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
613
+            $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry );
614 614
 
615
-	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) );
615
+	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) );
616 616
 
617
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
617
+            gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
618 618
 
619 619
         }
620 620
     }
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 
641 641
 		if ( ! empty( $entry ) && ! is_array( $entry ) ) {
642 642
 			$entry = GVCommon::get_entry( $entry );
643
-		} else if( empty( $entry ) ) {
643
+		} else if ( empty( $entry ) ) {
644 644
 			// @deprecated path
645 645
 			$entry = GravityView_frontend::getInstance()->getEntry();
646 646
 		}
@@ -660,32 +660,32 @@  discard block
 block discarded – undo
660 660
 
661 661
 		$query_arg_name = \GV\Entry::get_endpoint_name();
662 662
 
663
-		if ( ! empty( $entry['_multi'] ) ) {
663
+		if ( ! empty( $entry[ '_multi' ] ) ) {
664 664
 			$entry_slugs = array();
665 665
 
666
-			foreach ( $entry['_multi'] as $_multi ) {
666
+			foreach ( $entry[ '_multi' ] as $_multi ) {
667 667
 
668
-				if( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) {
669
-					$entry_slugs[] = $gv_multi->get_slug();
668
+				if ( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) {
669
+					$entry_slugs[ ] = $gv_multi->get_slug();
670 670
 				} else {
671 671
 					// TODO: This path isn't covered by unit tests
672
-					$entry_slugs[] = \GravityView_API::get_entry_slug( $_multi['id'], $_multi );
672
+					$entry_slugs[ ] = \GravityView_API::get_entry_slug( $_multi[ 'id' ], $_multi );
673 673
 				}
674 674
 
675 675
 				unset( $gv_multi );
676 676
 
677
-				$forms[] = $_multi['form_id'];
677
+				$forms[ ] = $_multi[ 'form_id' ];
678 678
 			}
679 679
 
680 680
 			$entry_slug = implode( ',', $entry_slugs );
681 681
 		} else {
682 682
 
683 683
 			// Fallback when
684
-			if( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) {
684
+			if ( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) {
685 685
 				$entry_slug = $gv_entry->get_slug();
686 686
 			} else {
687 687
 				// TODO: This path isn't covered by unit tests
688
-				$entry_slug = \GravityView_API::get_entry_slug( $entry['id'], $entry );
688
+				$entry_slug = \GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
689 689
 			}
690 690
 
691 691
 			unset( $gv_entry );
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 			$args = gv_get_query_args();
705 705
 		}
706 706
 
707
-		if ( get_option('permalink_structure') && ! is_preview() ) {
707
+		if ( get_option( 'permalink_structure' ) && ! is_preview() ) {
708 708
 
709 709
 			/**
710 710
 			 * Make sure the $directory_link doesn't contain any query otherwise it will break when adding the entry slug.
@@ -712,13 +712,13 @@  discard block
 block discarded – undo
712 712
 			 */
713 713
 			$link_parts = explode( '?', $directory_link );
714 714
 
715
-			$query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : '';
715
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
716 716
 
717
-			$directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query;
717
+			$directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query;
718 718
 
719 719
 		} else {
720 720
 
721
-			$args[] = array( $query_arg_name => $entry_slug );
721
+			$args[ ] = array( $query_arg_name => $entry_slug );
722 722
 		}
723 723
 
724 724
 		/**
@@ -726,21 +726,21 @@  discard block
 block discarded – undo
726 726
 		 */
727 727
 		if ( $add_directory_args ) {
728 728
 
729
-			if ( ! empty( $_GET['pagenum'] ) ) {
730
-				$args['pagenum'] = intval( $_GET['pagenum'] );
729
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
730
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
731 731
 			}
732 732
 
733 733
 			/**
734 734
 			 * @since 1.7
735 735
 			 */
736 736
 			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
737
-				$args['sort'] = $sort;
738
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
737
+				$args[ 'sort' ] = $sort;
738
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
739 739
 			}
740 740
 
741 741
 		}
742 742
 
743
-		if( $post_id ) {
743
+		if ( $post_id ) {
744 744
 			$passed_post = get_post( $post_id );
745 745
 			$views       = \GV\View_Collection::from_post( $passed_post );
746 746
 			$has_multiple_views = $views->count() > 1;
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 		}
750 750
 
751 751
 		if ( $has_multiple_views ) {
752
-			$args['gvid'] = $view_id ? $view_id : gravityview_get_view_id();
752
+			$args[ 'gvid' ] = $view_id ? $view_id : gravityview_get_view_id();
753 753
 		}
754 754
 
755 755
 		return add_query_arg( $args, $directory_link );
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 }
820 820
 
821 821
 function gv_class( $field, $form = NULL, $entry = array() ) {
822
-	return GravityView_API::field_class( $field, $form, $entry  );
822
+	return GravityView_API::field_class( $field, $form, $entry );
823 823
 }
824 824
 
825 825
 /**
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 		$view_id = 0;
843 843
 		if ( $context->view ) {
844 844
 			$view_id = $context->view->ID;
845
-			if( $context->view->settings->get( 'hide_until_searched' ) ) {
845
+			if ( $context->view->settings->get( 'hide_until_searched' ) ) {
846 846
 				$hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() );
847 847
 			}
848 848
 		}
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 		$default_css_class .= ' ' . $context->view->settings->get( 'class', '' );
875 875
 	}
876 876
 
877
-	$css_class = trim( $passed_css_class . ' '. $default_css_class );
877
+	$css_class = trim( $passed_css_class . ' ' . $default_css_class );
878 878
 
879 879
 	/**
880 880
 	 * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 
902 902
 	$value = GravityView_API::field_value( $entry, $field );
903 903
 
904
-	if( $value === '' ) {
904
+	if ( $value === '' ) {
905 905
 		/**
906 906
 		 * @filter `gravityview_empty_value` What to display when a field is empty
907 907
 		 * @param string $value (empty string)
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
  */
1015 1015
 function gravityview_get_field_value( $entry, $field_id, $display_value ) {
1016 1016
 
1017
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
1017
+	if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
1018 1018
 
1019 1019
 		// For the complete field value as generated by Gravity Forms
1020 1020
 		return $display_value;
@@ -1048,16 +1048,16 @@  discard block
 block discarded – undo
1048 1048
 		$terms = explode( ', ', $value );
1049 1049
 	}
1050 1050
 
1051
-	foreach ($terms as $term_name ) {
1051
+	foreach ( $terms as $term_name ) {
1052 1052
 
1053 1053
 		// If we're processing a category,
1054
-		if( $taxonomy === 'category' ) {
1054
+		if ( $taxonomy === 'category' ) {
1055 1055
 
1056 1056
 			// Use rgexplode to prevent errors if : doesn't exist
1057 1057
 			list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 );
1058 1058
 
1059 1059
 			// The explode was succesful; we have the category ID
1060
-			if( !empty( $term_id )) {
1060
+			if ( ! empty( $term_id ) ) {
1061 1061
 				$term = get_term_by( 'id', $term_id, $taxonomy );
1062 1062
 			} else {
1063 1063
 			// We have to fall back to the name
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
 		}
1071 1071
 
1072 1072
 		// There's still a tag/category here.
1073
-		if( $term ) {
1073
+		if ( $term ) {
1074 1074
 
1075 1075
 			$term_link = get_term_link( $term, $taxonomy );
1076 1076
 
@@ -1079,11 +1079,11 @@  discard block
 block discarded – undo
1079 1079
 			    continue;
1080 1080
 			}
1081 1081
 
1082
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
1082
+			$output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) );
1083 1083
 		}
1084 1084
 	}
1085 1085
 
1086
-	return implode(', ', $output );
1086
+	return implode( ', ', $output );
1087 1087
 }
1088 1088
 
1089 1089
 /**
@@ -1097,8 +1097,8 @@  discard block
 block discarded – undo
1097 1097
 
1098 1098
 	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
1099 1099
 
1100
-	if( empty( $link ) ) {
1101
-		return strip_tags( $output);
1100
+	if ( empty( $link ) ) {
1101
+		return strip_tags( $output );
1102 1102
 	}
1103 1103
 
1104 1104
 	return $output;
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 	$fe = GravityView_frontend::getInstance();
1118 1118
 
1119 1119
 	// Solve problem when loading content via admin-ajax.php
1120
-	if( ! $fe->getGvOutputData() ) {
1120
+	if ( ! $fe->getGvOutputData() ) {
1121 1121
 
1122 1122
 		gravityview()->log->debug( 'gv_output_data not defined; parsing content.' );
1123 1123
 
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 	}
1126 1126
 
1127 1127
 	// Make 100% sure that we're dealing with a properly called situation
1128
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
1128
+	if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
1129 1129
 
1130 1130
 		gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) );
1131 1131
 
@@ -1356,12 +1356,12 @@  discard block
 block discarded – undo
1356 1356
 function gravityview_get_files_array( $value, $gv_class = '', $context = null ) {
1357 1357
 	/** @define "GRAVITYVIEW_DIR" "../" */
1358 1358
 
1359
-	if( !class_exists( 'GravityView_Field' ) ) {
1360
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1359
+	if ( ! class_exists( 'GravityView_Field' ) ) {
1360
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' );
1361 1361
 	}
1362 1362
 
1363
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1364
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' );
1363
+	if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) {
1364
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' );
1365 1365
 	}
1366 1366
 
1367 1367
 	if ( is_null( $context ) ) {
@@ -1464,21 +1464,21 @@  discard block
 block discarded – undo
1464 1464
 	} else {
1465 1465
 		// @deprecated path
1466 1466
 		// Required fields.
1467
-		if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1467
+		if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) {
1468 1468
 			gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) );
1469 1469
 			return '';
1470 1470
 		}
1471 1471
 	}
1472 1472
 
1473 1473
 	if ( $context instanceof \GV\Template_Context ) {
1474
-		$entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() );
1475
-		$field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() );
1476
-		$form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() );
1474
+		$entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() );
1475
+		$field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() );
1476
+		$form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() );
1477 1477
 	} else {
1478 1478
 		// @deprecated path
1479
-		$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1480
-		$field = $args['field'];
1481
-		$form = $args['form'];
1479
+		$entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ];
1480
+		$field = $args[ 'field' ];
1481
+		$form = $args[ 'form' ];
1482 1482
 	}
1483 1483
 
1484 1484
 	/**
@@ -1498,43 +1498,43 @@  discard block
 block discarded – undo
1498 1498
 	);
1499 1499
 
1500 1500
 	if ( $context instanceof \GV\Template_Context ) {
1501
-		$placeholders['value'] = \GV\Utils::get( $args, 'value', '' );
1501
+		$placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' );
1502 1502
 	} else {
1503 1503
 		// @deprecated path
1504
-		$placeholders['value'] = gv_value( $entry, $field );
1504
+		$placeholders[ 'value' ] = gv_value( $entry, $field );
1505 1505
 	}
1506 1506
 
1507 1507
 	// If the value is empty and we're hiding empty, return empty.
1508
-	if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1508
+	if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) {
1509 1509
 		return '';
1510 1510
 	}
1511 1511
 
1512
-	if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1513
-		$placeholders['value'] = wpautop( $placeholders['value'] );
1512
+	if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) {
1513
+		$placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] );
1514 1514
 	}
1515 1515
 
1516 1516
 	// Get width setting, if exists
1517
-	$placeholders['width'] = GravityView_API::field_width( $field );
1517
+	$placeholders[ 'width' ] = GravityView_API::field_width( $field );
1518 1518
 
1519 1519
 	// If replacing with CSS inline formatting, let's do it.
1520
-	$placeholders['width:style'] = GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' );
1520
+	$placeholders[ 'width:style' ] = GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' );
1521 1521
 
1522 1522
 	// Grab the Class using `gv_class`
1523
-	$placeholders['class'] = gv_class( $field, $form, $entry );
1524
-	$placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1523
+	$placeholders[ 'class' ] = gv_class( $field, $form, $entry );
1524
+	$placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1525 1525
 
1526 1526
 	if ( $context instanceof \GV\Template_Context ) {
1527
-		$placeholders['label_value'] = \GV\Utils::get( $args, 'label' );
1527
+		$placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label' );
1528 1528
 	} else {
1529 1529
 		// Default Label value
1530
-		$placeholders['label_value'] = gv_label( $field, $entry );
1530
+		$placeholders[ 'label_value' ] = gv_label( $field, $entry );
1531 1531
 	}
1532 1532
 
1533
-	$placeholders['label_value:data-label'] = trim( esc_attr( strip_tags( str_replace( '>&nbsp;', '>', $placeholders['label_value'] ) ) ) );
1534
-	$placeholders['label_value:esc_attr'] = esc_attr( $placeholders['label_value'] );
1533
+	$placeholders[ 'label_value:data-label' ] = trim( esc_attr( strip_tags( str_replace( '>&nbsp;', '>', $placeholders[ 'label_value' ] ) ) ) );
1534
+	$placeholders[ 'label_value:esc_attr' ] = esc_attr( $placeholders[ 'label_value' ] );
1535 1535
 
1536
-	if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){
1537
-		$placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1536
+	if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) {
1537
+		$placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>';
1538 1538
 	}
1539 1539
 
1540 1540
 	/**
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
 	 * @since 2.0
1546 1546
 	 * @param \GV\Template_Context $context The context.
1547 1547
 	 */
1548
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context );
1548
+	$html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context );
1549 1549
 
1550 1550
 	/**
1551 1551
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
@@ -1572,7 +1572,7 @@  discard block
 block discarded – undo
1572 1572
 	foreach ( $placeholders as $tag => $value ) {
1573 1573
 
1574 1574
 		// If the tag doesn't exist just skip it
1575
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1575
+		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) {
1576 1576
 			continue;
1577 1577
 		}
1578 1578
 
Please login to merge, or discard this patch.
future/includes/class-gv-view.php 1 patch
Spacing   +81 added lines, -82 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		$supports = array( 'title', 'revisions' );
126 126
 
127 127
 		if ( $is_hierarchical ) {
128
-			$supports[] = 'page-attributes';
128
+			$supports[ ] = 'page-attributes';
129 129
 		}
130 130
 
131 131
 		/**
@@ -229,12 +229,12 @@  discard block
 block discarded – undo
229 229
 		$tsv_rule = array( sprintf( '%s/([^/]+)/tsv/?', $slug ), 'index.php?gravityview=$matches[1]&tsv=1', 'top' );
230 230
 
231 231
 		add_filter( 'query_vars', function( $query_vars ) {
232
-			$query_vars[] = 'csv';
233
-			$query_vars[] = 'tsv';
232
+			$query_vars[ ] = 'csv';
233
+			$query_vars[ ] = 'tsv';
234 234
 			return $query_vars;
235 235
 		} );
236 236
 
237
-		if ( ! isset( $wp_rewrite->extra_rules_top[ $csv_rule[0] ] ) ) {
237
+		if ( ! isset( $wp_rewrite->extra_rules_top[ $csv_rule[ 0 ] ] ) ) {
238 238
 			call_user_func_array( 'add_rewrite_rule', $csv_rule );
239 239
 			call_user_func_array( 'add_rewrite_rule', $tsv_rule );
240 240
 		}
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
 						$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' );
297 297
 
298
-						$image =  sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', esc_attr__( 'Data Source', 'gravityview' ), esc_url( plugins_url( 'assets/images/screenshots/data-source.png', GRAVITYVIEW_FILE ) ) );
298
+						$image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', esc_attr__( 'Data Source', 'gravityview' ), esc_url( plugins_url( 'assets/images/screenshots/data-source.png', GRAVITYVIEW_FILE ) ) );
299 299
 
300 300
 						return \GVCommon::generate_notice( '<h3>' . $title . '</h3>' . wpautop( $message . $image ), 'notice' );
301 301
 					}
@@ -321,13 +321,13 @@  discard block
 block discarded – undo
321 321
 			return $content;
322 322
 		}
323 323
 
324
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
324
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
325 325
 
326 326
 		/**
327 327
 		 * Editing a single entry.
328 328
 		 */
329 329
 		if ( $entry = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ) ) {
330
-			if ( $entry['status'] != 'active' ) {
330
+			if ( $entry[ 'status' ] != 'active' ) {
331 331
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
332 332
 				return __( 'You are not allowed to view this content.', 'gravityview' );
333 333
 			}
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 			}
339 339
 
340 340
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
341
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
341
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
342 342
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
343 343
 					return __( 'You are not allowed to view this content.', 'gravityview' );
344 344
 				}
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 
362 362
 			foreach ( $entryset as $e ) {
363 363
 
364
-				if ( 'active' !== $e['status'] ) {
364
+				if ( 'active' !== $e[ 'status' ] ) {
365 365
 					gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $e->ID ) );
366 366
 					return __( 'You are not allowed to view this content.', 'gravityview' );
367 367
 				}
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 				}
373 373
 
374 374
 				if ( $show_only_approved && ! $is_admin_and_can_view ) {
375
-					if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
375
+					if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
376 376
 						gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $e->ID ) );
377 377
 						return __( 'You are not allowed to view this content.', 'gravityview' );
378 378
 					}
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 			$join_column    = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field::by_id( $join_column );
548 548
 			$join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field::by_id( $join_on_column );
549 549
 
550
-			$joins [] = new Join( $join, $join_column, $join_on, $join_on_column );
550
+			$joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column );
551 551
 		}
552 552
 
553 553
 		return $joins;
@@ -637,13 +637,13 @@  discard block
 block discarded – undo
637 637
 			}
638 638
 
639 639
 			foreach ( $_fields as $field ) {
640
-				if ( ! empty( $field['unions'] ) ) {
641
-					foreach ( $field['unions'] as $form_id => $field_id ) {
640
+				if ( ! empty( $field[ 'unions' ] ) ) {
641
+					foreach ( $field[ 'unions' ] as $form_id => $field_id ) {
642 642
 						if ( ! isset( $unions[ $form_id ] ) ) {
643 643
 							$unions[ $form_id ] = array();
644 644
 						}
645 645
 
646
-						$unions[ $form_id ][ $field['id'] ] =
646
+						$unions[ $form_id ][ $field[ 'id' ] ] =
647 647
 							is_numeric( $field_id ) ? \GV\GF_Field::by_id( \GV\GF_Form::by_id( $form_id ), $field_id ) : \GV\Internal_Field::by_id( $field_id );
648 648
 					}
649 649
 				}
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 		if ( ! $view->form ) {
699 699
 			gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array(
700 700
 				'view_id' => $view->ID,
701
-				'form_id' => $view->_gravityview_form_id ? : 0,
701
+				'form_id' => $view->_gravityview_form_id ?: 0,
702 702
 			) );
703 703
 		}
704 704
 
@@ -937,11 +937,11 @@  discard block
 block discarded – undo
937 937
 			 * Remove multiple sorting before calling legacy filters.
938 938
 			 * This allows us to fake it till we make it.
939 939
 			 */
940
-			if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) {
940
+			if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) {
941 941
 				$has_multisort = true;
942
-				$parameters['sort_field'] = reset( $parameters['sort_field'] );
943
-				if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) {
944
-					$parameters['sort_direction'] = reset( $parameters['sort_direction'] );
942
+				$parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] );
943
+				if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) {
944
+					$parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] );
945 945
 				}
946 946
 			}
947 947
 
@@ -950,31 +950,30 @@  discard block
 block discarded – undo
950 950
 			 */
951 951
 			$parameters = \GravityView_frontend::get_view_entries_parameters( $parameters, $this->form->ID );
952 952
 
953
-			$parameters['context_view_id'] = $this->ID;
953
+			$parameters[ 'context_view_id' ] = $this->ID;
954 954
 			$parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID );
955 955
 
956 956
 			if ( ! is_array( $parameters ) ) {
957 957
 				$parameters = array();
958 958
 			}
959 959
 
960
-			if ( ! is_array( $parameters['search_criteria'] ) ) {
961
-				$parameters['search_criteria'] = array();
960
+			if ( ! is_array( $parameters[ 'search_criteria' ] ) ) {
961
+				$parameters[ 'search_criteria' ] = array();
962 962
 			}
963 963
 
964
-			if ( ( ! isset( $parameters['search_criteria']['field_filters'] ) ) || ( ! is_array( $parameters['search_criteria']['field_filters'] ) ) ) {
965
-				$parameters['search_criteria']['field_filters'] = array();
964
+			if ( ( ! isset( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) || ( ! is_array( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) ) {
965
+				$parameters[ 'search_criteria' ][ 'field_filters' ] = array();
966 966
 			}
967 967
 
968 968
 			if ( $request instanceof REST\Request ) {
969 969
 				$atts = $this->settings->as_atts();
970 970
 				$paging_parameters = wp_parse_args( $request->get_paging(), array(
971
-						'paging' => array( 'page_size' => $atts['page_size'] ),
971
+						'paging' => array( 'page_size' => $atts[ 'page_size' ] ),
972 972
 					) );
973
-				$parameters['paging'] = $paging_parameters['paging'];
973
+				$parameters[ 'paging' ] = $paging_parameters[ 'paging' ];
974 974
 			}
975 975
 
976
-			$page = Utils::get( $parameters['paging'], 'current_page' ) ?
977
-				: ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 );
976
+			$page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 );
978 977
 
979 978
 			/**
980 979
 			 * Cleanup duplicate field_filter parameters to simplify the query.
@@ -982,14 +981,14 @@  discard block
 block discarded – undo
982 981
 			$unique_field_filters = array();
983 982
 			foreach ( Utils::get( $parameters, 'search_criteria/field_filters', array() ) as $key => $filter ) {
984 983
 				if ( 'mode' === $key ) {
985
-					$unique_field_filters['mode'] = $filter;
984
+					$unique_field_filters[ 'mode' ] = $filter;
986 985
 				} else if ( ! in_array( $filter, $unique_field_filters ) ) {
987
-					$unique_field_filters[] = $filter;
986
+					$unique_field_filters[ ] = $filter;
988 987
 				}
989 988
 			}
990
-			$parameters['search_criteria']['field_filters'] = $unique_field_filters;
989
+			$parameters[ 'search_criteria' ][ 'field_filters' ] = $unique_field_filters;
991 990
 
992
-			if ( ! empty( $parameters['search_criteria']['field_filters'] ) ) {
991
+			if ( ! empty( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) {
993 992
 				gravityview()->log->notice( 'search_criteria/field_filters is not empty, third-party code may be using legacy search_criteria filters.' );
994 993
 			}
995 994
 
@@ -998,7 +997,7 @@  discard block
 block discarded – undo
998 997
 				$query_class = $this->get_query_class();
999 998
 
1000 999
 				/** @type \GF_Query $query */
1001
-				$query = new $query_class( $this->form->ID, $parameters['search_criteria'], Utils::get( $parameters, 'sorting' ) );
1000
+				$query = new $query_class( $this->form->ID, $parameters[ 'search_criteria' ], Utils::get( $parameters, 'sorting' ) );
1002 1001
 
1003 1002
 				/**
1004 1003
 				 * Apply multisort.
@@ -1009,15 +1008,15 @@  discard block
 block discarded – undo
1009 1008
 					$view_setting_sort_field_ids = \GV\Utils::get( $atts, 'sort_field', array() );
1010 1009
 					$view_setting_sort_directions = \GV\Utils::get( $atts, 'sort_direction', array() );
1011 1010
 
1012
-					$has_sort_query_param = ! empty( $_GET['sort'] ) && is_array( $_GET['sort'] );
1011
+					$has_sort_query_param = ! empty( $_GET[ 'sort' ] ) && is_array( $_GET[ 'sort' ] );
1013 1012
 
1014
-					if( $has_sort_query_param ) {
1015
-						$has_sort_query_param = array_filter( array_values( $_GET['sort'] ) );
1013
+					if ( $has_sort_query_param ) {
1014
+						$has_sort_query_param = array_filter( array_values( $_GET[ 'sort' ] ) );
1016 1015
 					}
1017 1016
 
1018 1017
 					if ( $this->settings->get( 'sort_columns' ) && $has_sort_query_param ) {
1019
-						$sort_field_ids = array_keys( $_GET['sort'] );
1020
-						$sort_directions = array_values( $_GET['sort'] );
1018
+						$sort_field_ids = array_keys( $_GET[ 'sort' ] );
1019
+						$sort_directions = array_values( $_GET[ 'sort' ] );
1021 1020
 					} else {
1022 1021
 						$sort_field_ids = $view_setting_sort_field_ids;
1023 1022
 						$sort_directions = $view_setting_sort_directions;
@@ -1025,7 +1024,7 @@  discard block
 block discarded – undo
1025 1024
 
1026 1025
 					$skip_first = false;
1027 1026
 
1028
-					foreach ( (array) $sort_field_ids as $key => $sort_field_id ) {
1027
+					foreach ( (array)$sort_field_ids as $key => $sort_field_id ) {
1029 1028
 
1030 1029
 						if ( ! $skip_first && ! $has_sort_query_param ) {
1031 1030
 							$skip_first = true; // Skip the first one, it's already in the query
@@ -1055,15 +1054,15 @@  discard block
 block discarded – undo
1055 1054
 
1056 1055
 					$merged_time = false;
1057 1056
 
1058
-					foreach ( $q['order'] as $oid => $order ) {
1059
-						if ( $order[0] instanceof \GF_Query_Column ) {
1060
-							$column = $order[0];
1061
-						} else if ( $order[0] instanceof \GF_Query_Call ) {
1062
-							if ( count( $order[0]->columns ) != 1 || ! $order[0]->columns[0] instanceof \GF_Query_Column ) {
1057
+					foreach ( $q[ 'order' ] as $oid => $order ) {
1058
+						if ( $order[ 0 ] instanceof \GF_Query_Column ) {
1059
+							$column = $order[ 0 ];
1060
+						} else if ( $order[ 0 ] instanceof \GF_Query_Call ) {
1061
+							if ( count( $order[ 0 ]->columns ) != 1 || ! $order[ 0 ]->columns[ 0 ] instanceof \GF_Query_Column ) {
1063 1062
 								$orders[ $oid ] = $order;
1064 1063
 								continue; // Need something that resembles a single sort
1065 1064
 							}
1066
-							$column = $order[0]->columns[0];
1065
+							$column = $order[ 0 ]->columns[ 0 ];
1067 1066
 						}
1068 1067
 
1069 1068
 						if ( ( ! $field = \GFAPI::get_field( $column->source, $column->field_id ) ) || $field->type !== 'time' ) {
@@ -1077,7 +1076,7 @@  discard block
 block discarded – undo
1077 1076
 
1078 1077
 						$orders[ $oid ] = array(
1079 1078
 							new \GV\Mocks\GF_Query_Call_TIMESORT( 'timesort', array( $column, $sql ) ),
1080
-							$order[1] // Mock it!
1079
+							$order[ 1 ] // Mock it!
1081 1080
 						);
1082 1081
 
1083 1082
 						$merged_time = true;
@@ -1088,15 +1087,15 @@  discard block
 block discarded – undo
1088 1087
 						 * ORDER again.
1089 1088
 						 */
1090 1089
 						if ( ! empty( $orders ) && $_orders = $query->_order_generate( $orders ) ) {
1091
-							$sql['order'] = 'ORDER BY ' . implode( ', ', $_orders );
1090
+							$sql[ 'order' ] = 'ORDER BY ' . implode( ', ', $_orders );
1092 1091
 						}
1093 1092
 					}
1094 1093
 
1095 1094
 					return $sql;
1096 1095
 				} );
1097 1096
 
1098
-				$query->limit( $parameters['paging']['page_size'] )
1099
-					->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) );
1097
+				$query->limit( $parameters[ 'paging' ][ 'page_size' ] )
1098
+					->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) );
1100 1099
 
1101 1100
 				/**
1102 1101
 				 * Any joins?
@@ -1119,7 +1118,7 @@  discard block
 block discarded – undo
1119 1118
 
1120 1119
 							$query_parameters = $query->_introspect();
1121 1120
 
1122
-							$query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) );
1121
+							$query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) );
1123 1122
 						}
1124 1123
 
1125 1124
 						/**
@@ -1153,7 +1152,7 @@  discard block
 block discarded – undo
1153 1152
 						}
1154 1153
 
1155 1154
 						$q = $query->_introspect();
1156
-						$query->where( \GF_Query_Condition::_and( $q['where'], $condition ) );
1155
+						$query->where( \GF_Query_Condition::_and( $q[ 'where' ], $condition ) );
1157 1156
 
1158 1157
 						if ( $this->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
1159 1158
 
@@ -1178,7 +1177,7 @@  discard block
 block discarded – undo
1178 1177
 
1179 1178
 							$query_parameters = $query->_introspect();
1180 1179
 
1181
-							$query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) );
1180
+							$query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) );
1182 1181
 						}
1183 1182
 					}
1184 1183
 
@@ -1202,7 +1201,7 @@  discard block
 block discarded – undo
1202 1201
 							$conditions = array();
1203 1202
 
1204 1203
 							foreach ( $condition->expressions as $_condition ) {
1205
-								$conditions[] = $recurse( $_condition, $fields, $recurse );
1204
+								$conditions[ ] = $recurse( $_condition, $fields, $recurse );
1206 1205
 							}
1207 1206
 
1208 1207
 							return call_user_func_array(
@@ -1231,10 +1230,10 @@  discard block
 block discarded – undo
1231 1230
 						$q = new $query_class( $form_id );
1232 1231
 
1233 1232
 						// Copy the WHERE clauses but substitute the field_ids to the respective ones
1234
-						$q->where( $where_union_substitute( $query_parameters['where'], $fields, $where_union_substitute ) );
1233
+						$q->where( $where_union_substitute( $query_parameters[ 'where' ], $fields, $where_union_substitute ) );
1235 1234
 
1236 1235
 						// Copy the ORDER clause and substitute the field_ids to the respective ones
1237
-						foreach ( $query_parameters['order'] as $order ) {
1236
+						foreach ( $query_parameters[ 'order' ] as $order ) {
1238 1237
 							list( $column, $_order ) = $order;
1239 1238
 
1240 1239
 							if ( $column && $column instanceof \GF_Query_Column ) {
@@ -1248,15 +1247,15 @@  discard block
 block discarded – undo
1248 1247
 
1249 1248
 						add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( &$unions_sql ) {
1250 1249
 							// Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses
1251
-							$select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] );
1250
+							$select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] );
1252 1251
 
1253 1252
 							// Record the SQL
1254
-							$unions_sql[] = array(
1253
+							$unions_sql[ ] = array(
1255 1254
 								// Remove columns, we'll rebuild them
1256 1255
 								'select'  => preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $select ),
1257
-								'from'    => $sql['from'],
1258
-								'join'    => $sql['join'],
1259
-								'where'   => $sql['where'],
1256
+								'from'    => $sql[ 'from' ],
1257
+								'join'    => $sql[ 'join' ],
1258
+								'where'   => $sql[ 'where' ],
1260 1259
 								// Remove order and limit
1261 1260
 							);
1262 1261
 
@@ -1273,11 +1272,11 @@  discard block
 block discarded – undo
1273 1272
 
1274 1273
 					add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( $unions_sql ) {
1275 1274
 						// Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses
1276
-						$sql['select'] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] );
1275
+						$sql[ 'select' ] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] );
1277 1276
 
1278 1277
 						// Remove columns, we'll rebuild them
1279
-						preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql['select'], $select_match );
1280
-						$sql['select'] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql['select'] );
1278
+						preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql[ 'select' ], $select_match );
1279
+						$sql[ 'select' ] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql[ 'select' ] );
1281 1280
 
1282 1281
 						$unions = array();
1283 1282
 
@@ -1288,30 +1287,30 @@  discard block
 block discarded – undo
1288 1287
 						};
1289 1288
 
1290 1289
 						// Add all the order columns into the selects, so we can order by the whole union group
1291
-						preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql['order'], $order_matches );
1290
+						preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql[ 'order' ], $order_matches );
1292 1291
 
1293 1292
 						$columns = array(
1294
-							sprintf( '%s AS %s', $select_match[1], $column_to_alias( $select_match[1] ) )
1293
+							sprintf( '%s AS %s', $select_match[ 1 ], $column_to_alias( $select_match[ 1 ] ) )
1295 1294
 						);
1296 1295
 
1297 1296
 						foreach ( array_slice( $order_matches, 1 ) as $match ) {
1298
-							$columns[] = sprintf( '%s AS %s', $match[0], $column_to_alias( $match[0] ) );
1297
+							$columns[ ] = sprintf( '%s AS %s', $match[ 0 ], $column_to_alias( $match[ 0 ] ) );
1299 1298
 
1300 1299
 							// Rewrite the order columns to the shared aliases
1301
-							$sql['order'] = str_replace( $match[0], $column_to_alias( $match[0] ), $sql['order'] );
1300
+							$sql[ 'order' ] = str_replace( $match[ 0 ], $column_to_alias( $match[ 0 ] ), $sql[ 'order' ] );
1302 1301
 						}
1303 1302
 
1304 1303
 						$columns = array_unique( $columns );
1305 1304
 
1306 1305
 						// Add the columns to every UNION
1307 1306
 						foreach ( $unions_sql as $union_sql ) {
1308
-							$union_sql['select'] .= implode( ', ', $columns );
1309
-							$unions []= implode( ' ', $union_sql );
1307
+							$union_sql[ 'select' ] .= implode( ', ', $columns );
1308
+							$unions [ ] = implode( ' ', $union_sql );
1310 1309
 						}
1311 1310
 
1312 1311
 						// Add the columns to the main SELECT, but only grab the entry id column
1313
-						$sql['select'] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql['select'] . implode( ', ', $columns );
1314
-						$sql['order'] = implode( ' ', $unions ) . ') AS u ' . $sql['order'];
1312
+						$sql[ 'select' ] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql[ 'select' ] . implode( ', ', $columns );
1313
+						$sql[ 'order' ] = implode( ' ', $unions ) . ') AS u ' . $sql[ 'order' ];
1315 1314
 
1316 1315
 						return $sql;
1317 1316
 					} );
@@ -1356,20 +1355,20 @@  discard block
 block discarded – undo
1356 1355
 				} );
1357 1356
 			} else {
1358 1357
 				$entries = $this->form->entries
1359
-					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) )
1358
+					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) )
1360 1359
 					->offset( $this->settings->get( 'offset' ) )
1361
-					->limit( $parameters['paging']['page_size'] )
1360
+					->limit( $parameters[ 'paging' ][ 'page_size' ] )
1362 1361
 					->page( $page );
1363 1362
 
1364
-				if ( ! empty( $parameters['sorting'] ) && is_array( $parameters['sorting'] && ! isset( $parameters['sorting']['key'] ) ) ) {
1363
+				if ( ! empty( $parameters[ 'sorting' ] ) && is_array( $parameters[ 'sorting' ] && ! isset( $parameters[ 'sorting' ][ 'key' ] ) ) ) {
1365 1364
 					// Pluck off multisort arrays
1366
-					$parameters['sorting'] = $parameters['sorting'][0];
1365
+					$parameters[ 'sorting' ] = $parameters[ 'sorting' ][ 0 ];
1367 1366
 				}
1368 1367
 
1369
-				if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) {
1368
+				if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) {
1370 1369
 					$field = new \GV\Field();
1371
-					$field->ID = $parameters['sorting']['key'];
1372
-					$direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
1370
+					$field->ID = $parameters[ 'sorting' ][ 'key' ];
1371
+					$direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
1373 1372
 					$entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) );
1374 1373
 				}
1375 1374
 			}
@@ -1454,7 +1453,7 @@  discard block
 block discarded – undo
1454 1453
 		$allowed = $headers = array();
1455 1454
 
1456 1455
 		foreach ( $view->fields->by_position( "directory_*" )->by_visible( $view )->all() as $id => $field ) {
1457
-			$allowed[] = $field;
1456
+			$allowed[ ] = $field;
1458 1457
 		}
1459 1458
 
1460 1459
 		$renderer = new Field_Renderer();
@@ -1476,17 +1475,17 @@  discard block
 block discarded – undo
1476 1475
 			} );
1477 1476
 
1478 1477
 			foreach ( array_diff( $allowed_field_ids, wp_list_pluck( $allowed, 'ID' ) ) as $field_id ) {
1479
-				$allowed[] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id );
1478
+				$allowed[ ] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id );
1480 1479
 			}
1481 1480
 
1482 1481
 			foreach ( $allowed as $field ) {
1483 1482
 				$source = is_numeric( $field->ID ) ? $view->form : new \GV\Internal_Source();
1484 1483
 
1485
-				$return[] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' );
1484
+				$return[ ] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' );
1486 1485
 
1487 1486
 				if ( ! $headers_done ) {
1488 1487
 					$label = $field->get_label( $view, $source, $entry );
1489
-					$headers[] = $label ? $label : $field->ID;
1488
+					$headers[ ] = $label ? $label : $field->ID;
1490 1489
 				}
1491 1490
 			}
1492 1491
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-sequence.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		$this->label = esc_html__( 'Number Sequence', 'gravityview' );
42 42
 		$this->description = esc_html__( 'Display a sequential result number for each entry.', 'gravityview' );
43 43
 
44
-		add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'field_tooltips') );
44
+		add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'field_tooltips' ) );
45 45
 
46 46
 		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
47 47
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 			return $entry_default_fields;
66 66
 		}
67 67
 
68
-		$entry_default_fields['sequence'] = array(
68
+		$entry_default_fields[ 'sequence' ] = array(
69 69
 			'label' => __( 'Result Number', 'gravityview' ),
70 70
 			'type'  => $this->name,
71 71
 			'desc'  => $this->description,
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 
85 85
 		$return = $tooltips;
86 86
 
87
-		$return['reverse_sequence'] = array(
88
-			'title' => __('Reverse the order of the result numbers', 'gravityview'),
89
-			'value' => __('Output the number sequence in descending order. If enabled, numbers will count down from high to low.', 'gravityview'),
87
+		$return[ 'reverse_sequence' ] = array(
88
+			'title' => __( 'Reverse the order of the result numbers', 'gravityview' ),
89
+			'value' => __( 'Output the number sequence in descending order. If enabled, numbers will count down from high to low.', 'gravityview' ),
90 90
 		);
91 91
 
92 92
 		return $return;
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 
95 95
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
96 96
 
97
-		unset ( $field_options['search_filter'] );
97
+		unset ( $field_options[ 'search_filter' ] );
98 98
 
99 99
 		$new_fields = array(
100 100
 			'start' => array(
101 101
 				'type' => 'number',
102 102
 				'label' => __( 'First Number in the Sequence', 'gravityview' ),
103
-				'desc' => __('For each entry, the displayed number will increase by one. When displaying ten entries, the first entry will display "1", and the last entry will show "10".', 'gravityview'),
103
+				'desc' => __( 'For each entry, the displayed number will increase by one. When displaying ten entries, the first entry will display "1", and the last entry will show "10".', 'gravityview' ),
104 104
 				'value' => '1',
105 105
 				'merge_tags' => false,
106 106
 			),
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
 		$return = $text;
157 157
 
158 158
 		$context = new \GV\Template_Context();
159
-		$context->view = \GV\View::by_id( $view_data['view_id'] );
159
+		$context->view = \GV\View::by_id( $view_data[ 'view_id' ] );
160 160
 		$context->entry = \GV\GF_Entry::from_entry( $entry );
161 161
 
162 162
 		$gv_field = \GV\Internal_Field::by_id( 'sequence' );
163 163
 		$merge_tag_context = \GV\Utils::get( $legacy_field, 'UID' );
164
-		$merge_tag_context = $entry['id'] . "/{$merge_tag_context}";
164
+		$merge_tag_context = $entry[ 'id' ] . "/{$merge_tag_context}";
165 165
 
166 166
 		foreach ( $matches as $match ) {
167 167
 
168
-			$full_tag = $match[0];
169
-			$property = $match[1];
168
+			$full_tag = $match[ 0 ];
169
+			$property = $match[ 1 ];
170 170
 
171 171
 			$gv_field->reverse = false;
172 172
 			$gv_field->start = 1;
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
 
186 186
 				// If there is a field with the ID of the start number, the merge tag won't work.
187 187
 				// In that case, you can use "=" instead: `{sequence start=10}`
188
-				if( 1 === sizeof( $maybe_start ) ) {
188
+				if ( 1 === sizeof( $maybe_start ) ) {
189 189
 					$maybe_start = explode( '=', $modifier );
190 190
 				}
191 191
 
192 192
 				if ( 'start' === rgar( $maybe_start, 0 ) && is_numeric( rgar( $maybe_start, 1 ) ) ) {
193
-					$gv_field->start = (int) rgar( $maybe_start, 1 );
193
+					$gv_field->start = (int)rgar( $maybe_start, 1 );
194 194
 				}
195 195
 			}
196 196
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 			$merge_tag_context_modifiers = $merge_tag_context . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start;
202 202
 
203 203
 			if ( ! isset( $merge_tag_sequences[ $merge_tag_context_modifiers ] ) ) {
204
-				$gv_field->UID = $legacy_field['UID'] . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start;
204
+				$gv_field->UID = $legacy_field[ 'UID' ] . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start;
205 205
 				$context->field = $gv_field;
206 206
 				$sequence = $merge_tag_sequences[ $merge_tag_context_modifiers ] = $this->get_sequence( $context );
207 207
 			} else {
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 			$total = $context->view->get_entries()->total();
247 247
 			remove_filter( 'gform_gf_query_sql', $callback );
248 248
 
249
-			unset( $sql_query['paginate'] );
249
+			unset( $sql_query[ 'paginate' ] );
250 250
 
251 251
 			global $wpdb;
252 252
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-consent.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,13 +97,13 @@
 block discarded – undo
97 97
 		// Set the $_field_id var
98 98
 		$field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id );
99 99
 
100
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
100
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
101 101
 			$default = 'tick';
102 102
 		} else {
103 103
 			$default = 'both';
104 104
 		}
105 105
 
106
-		$field_options['choice_display'] = array(
106
+		$field_options[ 'choice_display' ] = array(
107 107
 			'type'    => 'radio',
108 108
 			'class'   => 'vertical',
109 109
 			'label'   => __( 'What should be displayed:', 'gravityview' ),
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-view-field.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,42 +14,42 @@
 block discarded – undo
14 14
 
15 15
 		$field_info_items = array();
16 16
 
17
-		if( !empty( $this->item['adminLabel'] ) ) {
18
-			$field_info_items[] = array(
19
-				'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ),
17
+		if ( ! empty( $this->item[ 'adminLabel' ] ) ) {
18
+			$field_info_items[ ] = array(
19
+				'value' => sprintf( __( 'Admin Label: %s', 'gravityview' ), $this->item[ 'adminLabel' ] ),
20 20
 				'class'	=> 'gv-sublabel'
21 21
 			);
22 22
 		}
23 23
 
24 24
 		// Fields with IDs, not like Source URL or Entry ID
25
-		if( is_numeric( $this->id ) ) {
25
+		if ( is_numeric( $this->id ) ) {
26 26
 
27
-			$field_type_title = GFCommon::get_field_type_title( $this->item['input_type'] );
27
+			$field_type_title = GFCommon::get_field_type_title( $this->item[ 'input_type' ] );
28 28
 
29
-			if ( ! empty( $this->item['parent'] ) ) {
30
-				$field_info_items[] = array(
31
-					'value' => sprintf( esc_html__( 'Parent: %s', 'gravityview' ), esc_attr( $this->item['parent']['label'] ) ),
29
+			if ( ! empty( $this->item[ 'parent' ] ) ) {
30
+				$field_info_items[ ] = array(
31
+					'value' => sprintf( esc_html__( 'Parent: %s', 'gravityview' ), esc_attr( $this->item[ 'parent' ][ 'label' ] ) ),
32 32
 				);
33 33
 			}
34 34
 
35
-			$field_info_items[] = array(
36
-				'value' => sprintf( __('Type: %s', 'gravityview'), $field_type_title ),
37
-				'hide_in_picker' => ! empty( $this->item['parent'] ),
35
+			$field_info_items[ ] = array(
36
+				'value' => sprintf( __( 'Type: %s', 'gravityview' ), $field_type_title ),
37
+				'hide_in_picker' => ! empty( $this->item[ 'parent' ] ),
38 38
 			);
39 39
 
40
-			$field_info_items[] = array(
41
-				'value' => sprintf( __('Field ID: %s', 'gravityview'), $this->id ),
40
+			$field_info_items[ ] = array(
41
+				'value' => sprintf( __( 'Field ID: %s', 'gravityview' ), $this->id ),
42 42
 			);
43 43
 		}
44 44
 
45
-		if( !empty( $this->item['desc'] ) ) {
46
-			$field_info_items[] = array(
47
-				'value' => $this->item['desc']
45
+		if ( ! empty( $this->item[ 'desc' ] ) ) {
46
+			$field_info_items[ ] = array(
47
+				'value' => $this->item[ 'desc' ]
48 48
 			);
49 49
 		}
50 50
 
51
-		$field_info_items[] = array(
52
-			'value'          => sprintf( __('Form ID: %s', 'gravityview' ), $this->form_id ),
51
+		$field_info_items[ ] = array(
52
+			'value'          => sprintf( __( 'Form ID: %s', 'gravityview' ), $this->form_id ),
53 53
 			'hide_in_picker' => true,
54 54
 		);
55 55
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-source-url.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,24 +29,24 @@
 block discarded – undo
29 29
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
30 30
 
31 31
 		// Don't link to entry; doesn't make sense.
32
-		unset( $field_options['show_as_link'] );
32
+		unset( $field_options[ 'show_as_link' ] );
33 33
 
34
-		if( 'edit' === $context ) {
34
+		if ( 'edit' === $context ) {
35 35
 			return $field_options;
36 36
 		}
37 37
 
38 38
 		$add_options = array();
39
-		$add_options['link_to_source'] = array(
39
+		$add_options[ 'link_to_source' ] = array(
40 40
 			'type' => 'checkbox',
41 41
 			'label' => __( 'Link to URL:', 'gravityview' ),
42
-			'desc' => __('Display as a link to the Source URL', 'gravityview'),
42
+			'desc' => __( 'Display as a link to the Source URL', 'gravityview' ),
43 43
 			'value' => false,
44 44
 			'merge_tags' => false,
45 45
 		);
46
-		$add_options['source_link_text'] = array(
46
+		$add_options[ 'source_link_text' ] = array(
47 47
 			'type' => 'text',
48 48
 			'label' => __( 'Link Text:', 'gravityview' ),
49
-			'desc' => __('Customize the link text. If empty, the link text will be the URL.', 'gravityview'),
49
+			'desc' => __( 'Customize the link text. If empty, the link text will be the URL.', 'gravityview' ),
50 50
 			'value' => NULL,
51 51
 			'merge_tags' => true,
52 52
 			'requires' => 'link_to_source',
Please login to merge, or discard this patch.
future/includes/class-gv-settings-addon.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		$setting_tabs = parent::get_app_settings_tabs();
119 119
 
120 120
 		foreach ( $setting_tabs as &$tab ) {
121
-			if ( 'uninstall' !== $tab['name'] ) {
121
+			if ( 'uninstall' !== $tab[ 'name' ] ) {
122 122
 				continue;
123 123
 			}
124 124
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 			}
130 130
 
131 131
 			// Add trash can icon to resemble the look and feel of the GF Settings page
132
-			$tab['icon'] = 'dashicons-trash';
132
+			$tab[ 'icon' ] = 'dashicons-trash';
133 133
 		}
134 134
 
135 135
 		return array_filter( $setting_tabs );
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function register_no_conflict( $items ) {
146 146
 
147
-		$items[] = 'gform_settings';
148
-		$items[] = 'gv-admin-edd-license';
147
+		$items[ ] = 'gform_settings';
148
+		$items[ ] = 'gv-admin-edd-license';
149 149
 
150 150
 		return $items;
151 151
 	}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
 		$href = add_query_arg( array( 'post_type' => 'gravityview', 'page' => 'gravityview_settings', 'view' => 'uninstall' ), admin_url( 'edit.php' ) );
198 198
 
199
-		$uninstall_button = '<a href="' . esc_url( $href ) . '" class="' . gravityview_sanitize_html_class( $html_class ). '">' . esc_html__( 'Uninstall GravityView', 'gravityview' ) . '</a>';
199
+		$uninstall_button = '<a href="' . esc_url( $href ) . '" class="' . gravityview_sanitize_html_class( $html_class ) . '">' . esc_html__( 'Uninstall GravityView', 'gravityview' ) . '</a>';
200 200
 
201 201
 		$html .= $uninstall_button;
202 202
 
@@ -215,10 +215,10 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	public function settings_save( $field, $echo = true ) {
217 217
 
218
-		$field['type']  = 'submit';
219
-		$field['name']  = 'gform-settings-save';
220
-		$field['class'] = 'button button-primary primary button-hero';
221
-		$field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
218
+		$field[ 'type' ]  = 'submit';
219
+		$field[ 'name' ]  = 'gform-settings-save';
220
+		$field[ 'class' ] = 'button button-primary primary button-hero';
221
+		$field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
222 222
 
223 223
 		$html = $this->as_html( $field, false );
224 224
 
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	public function modify_app_settings_menu_title( $setting_tabs ) {
242 242
 
243
-		$setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' );
244
-		$setting_tabs[0]['icon']  = 'dashicons-admin-settings';
243
+		$setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' );
244
+		$setting_tabs[ 0 ][ 'icon' ]  = 'dashicons-admin-settings';
245 245
 
246 246
 		return $setting_tabs;
247 247
 	}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 					$i = 0;
490 490
 					while ( $i < 11 ) {
491 491
 						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>';
492
-						$i ++;
492
+						$i++;
493 493
 					}
494 494
 					?>
495 495
 				</ul>
@@ -694,14 +694,14 @@  discard block
 block discarded – undo
694 694
 	 */
695 695
 	public function as_html( $field, $echo = true ) {
696 696
 
697
-		$field['type'] = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit', 'reset', 'button' ) ) ) ? $field['type'] : 'submit';
697
+		$field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit';
698 698
 
699 699
 		$attributes    = $this->get_field_attributes( $field );
700 700
 		$default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) );
701
-		$value         = $this->get( $field['name'], $default_value );
701
+		$value         = $this->get( $field[ 'name' ], $default_value );
702 702
 
703
-		$attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary primary gfbutton';
704
-		$name                = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name'];
703
+		$attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary primary gfbutton';
704
+		$name                = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ];
705 705
 
706 706
 		if ( empty( $value ) ) {
707 707
 			$value = __( 'Update Settings', 'gravityview' );
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 		$attributes = $this->get_field_attributes( $field );
711 711
 
712 712
 		$html = '<input
713
-                    type="' . $field['type'] . '"
713
+                    type="' . $field[ 'type' ] . '"
714 714
                     name="' . esc_attr( $name ) . '"
715 715
                     value="' . $value . '" ' .
716 716
 				implode( ' ', $attributes ) .
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 	 */
745 745
 	public function is_save_postback() {
746 746
 
747
-		return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] );
747
+		return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] );
748 748
 	}
749 749
 
750 750
 	/**
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 
857 857
 		$scripts = parent::scripts();
858 858
 
859
-		$scripts[] = array(
859
+		$scripts[ ] = array(
860 860
 				'handle'  => 'gform_tooltip_init',
861 861
 				'enqueue' => array(
862 862
 						array(
@@ -884,11 +884,11 @@  discard block
 block discarded – undo
884 884
 		);
885 885
 
886 886
 		// This file was removed from 2.5
887
-		if( ! gravityview()->plugin->is_GF_25() ) {
888
-			$deps[] = 'gform_tooltip';
887
+		if ( ! gravityview()->plugin->is_GF_25() ) {
888
+			$deps[ ] = 'gform_tooltip';
889 889
 		}
890 890
 
891
-		$styles[] = array(
891
+		$styles[ ] = array(
892 892
 			'handle'  => 'gravityview_settings',
893 893
 			'src'     => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
894 894
 			'version' => Plugin::$version,
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
 						'name'          => 'support-email',
976 976
 						'type'          => 'text',
977 977
 						'validate'      => 'email',
978
-						'default_value' => $default_settings['support-email'],
978
+						'default_value' => $default_settings[ 'support-email' ],
979 979
 						'label'         => __( 'Support Email', 'gravityview' ),
980 980
 						'description'   => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ),
981 981
 						'class'         => 'code regular-text',
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 						'name'          => 'support_port',
988 988
 						'type'          => 'radio',
989 989
 						'label'         => __( 'Show Support Port?', 'gravityview' ),
990
-						'default_value' => $default_settings['support_port'],
990
+						'default_value' => $default_settings[ 'support_port' ],
991 991
 						'horizontal'    => 1,
992 992
 						'choices'       => array(
993 993
 								array(
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 						'name'          => 'no-conflict-mode',
1007 1007
 						'type'          => 'radio',
1008 1008
 						'label'         => __( 'No-Conflict Mode', 'gravityview' ),
1009
-						'default_value' => $default_settings['no-conflict-mode'],
1009
+						'default_value' => $default_settings[ 'no-conflict-mode' ],
1010 1010
 						'horizontal'    => 1,
1011 1011
 						'choices'       => array(
1012 1012
 								array(
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 								'name'          => 'rest_api',
1029 1029
 								'type'          => 'radio',
1030 1030
 								'label'         => __( 'REST API', 'gravityview' ),
1031
-								'default_value' => $default_settings['rest_api'],
1031
+								'default_value' => $default_settings[ 'rest_api' ],
1032 1032
 								'horizontal'    => 1,
1033 1033
 								'choices'       => array(
1034 1034
 										array(
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 					'name' => 'powered_by',
1048 1048
 					'type' => 'checkbox',
1049 1049
 					'label' => __( 'Display "Powered By" Link', 'gravityview' ),
1050
-					'default_value' => $default_settings['powered_by'],
1050
+					'default_value' => $default_settings[ 'powered_by' ],
1051 1051
 					'choices' => array(
1052 1052
 						array(
1053 1053
 							'label' => esc_html__( 'Display a "Powered by GravityView" link', 'gravityview' ),
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
 						'name'          => 'beta',
1073 1073
 						'type'          => 'checkbox',
1074 1074
 						'label'         => __( 'Become a Beta Tester', 'gravityview' ),
1075
-						'default_value' => $default_settings['beta'],
1075
+						'default_value' => $default_settings[ 'beta' ],
1076 1076
 						'horizontal'    => 1,
1077 1077
 						'choices'       => array(
1078 1078
 								array(
@@ -1106,17 +1106,17 @@  discard block
 block discarded – undo
1106 1106
 		 * @since 1.7.4
1107 1107
 		 */
1108 1108
 		foreach ( $fields as &$field ) {
1109
-			$field['name']          = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' );
1110
-			$field['label']         = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' );
1111
-			$field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' );
1112
-			$field['description']   = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' );
1109
+			$field[ 'name' ]          = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' );
1110
+			$field[ 'label' ]         = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' );
1111
+			$field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' );
1112
+			$field[ 'description' ]   = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' );
1113 1113
 
1114 1114
 			if ( $disabled_attribute ) {
1115
-				$field['disabled'] = $disabled_attribute;
1115
+				$field[ 'disabled' ] = $disabled_attribute;
1116 1116
 			}
1117 1117
 
1118
-			if ( empty( $field['disabled'] ) ) {
1119
-				unset( $field['disabled'] );
1118
+			if ( empty( $field[ 'disabled' ] ) ) {
1119
+				unset( $field[ 'disabled' ] );
1120 1120
 			}
1121 1121
 		}
1122 1122
 
@@ -1128,23 +1128,23 @@  discard block
 block discarded – undo
1128 1128
 					'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates &amp; support.', 'gravityview' ),
1129 1129
 					'type' => 'edd_license',
1130 1130
 					'data-pending-text' => __( 'Verifying license&hellip;', 'gravityview' ),
1131
-					'default_value' => $default_settings['license_key'],
1131
+					'default_value' => $default_settings[ 'license_key' ],
1132 1132
 					'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key',
1133 1133
 			),
1134 1134
 			array(
1135 1135
 					'name' => 'license_key_response',
1136
-					'default_value' => $default_settings['license_key_response'],
1136
+					'default_value' => $default_settings[ 'license_key_response' ],
1137 1137
 					'type' => 'hidden',
1138 1138
 			),
1139 1139
 			array(
1140 1140
 					'name' => 'license_key_status',
1141
-					'default_value' => $default_settings['license_key_status'],
1141
+					'default_value' => $default_settings[ 'license_key_status' ],
1142 1142
 					'type' => 'hidden',
1143 1143
 			),
1144 1144
 		);
1145 1145
 
1146 1146
 		if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1147
-			$license_fields[0] = array_merge( $license_fields[0], array(
1147
+			$license_fields[ 0 ] = array_merge( $license_fields[ 0 ], array(
1148 1148
 				'disabled' => true,
1149 1149
 				'title'    => __( 'The license key is defined by your site\'s configuration file.', 'gravityview' ),
1150 1150
 			) );
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 
1156 1156
 		if ( \gravityview()->plugin->is_GF_25() ) {
1157 1157
 
1158
-			$sections[] = array(
1158
+			$sections[ ] = array(
1159 1159
 					'title'       => __( 'GravityView License', 'gravityview' ),
1160 1160
 					'class'       => 'gform-settings-panel--full gv-settings-panel--license',
1161 1161
 					'description' => $version_info,
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
 			) );
1174 1174
 		}
1175 1175
 
1176
-		$sections[] = array(
1176
+		$sections[ ] = array(
1177 1177
 			'title' => ( gravityview()->plugin->is_GF_25() ? __( 'GravityView Settings', 'gravityview' ) : null ),
1178 1178
 			'class' => 'gform-settings-panel--full gv-settings-panel--core',
1179 1179
 			'fields'      => $fields,
@@ -1197,8 +1197,8 @@  discard block
 block discarded – undo
1197 1197
 
1198 1198
 			if ( $disabled_attribute ) {
1199 1199
 				foreach ( $extension_sections as &$section ) {
1200
-					foreach ( $section['fields'] as &$field ) {
1201
-						$field['disabled'] = $disabled_attribute;
1200
+					foreach ( $section[ 'fields' ] as &$field ) {
1201
+						$field[ 'disabled' ] = $disabled_attribute;
1202 1202
 					}
1203 1203
 				}
1204 1204
 			}
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
 	public function settings_edd_license( $field, $echo = true ) {
1265 1265
 
1266 1266
 		if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1267
-			$field['input_type'] = 'password';
1267
+			$field[ 'input_type' ] = 'password';
1268 1268
 		}
1269 1269
 
1270 1270
 		$text = $this->settings_text( $field, false );
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
 
1317 1317
 		?>
1318 1318
 
1319
-		<tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>">
1319
+		<tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>">
1320 1320
 			<td colspan="2">
1321 1321
 				<?php $this->single_setting( $field ); ?>
1322 1322
 			</td>
@@ -1342,8 +1342,8 @@  discard block
 block discarded – undo
1342 1342
 	 */
1343 1343
 	public function single_setting_row( $field ) {
1344 1344
 
1345
-		$field['gv_description'] = Utils::get( $field, 'description' );
1346
-		$field['description']    = Utils::get( $field, 'subtitle' );
1345
+		$field[ 'gv_description' ] = Utils::get( $field, 'description' );
1346
+		$field[ 'description' ]    = Utils::get( $field, 'subtitle' );
1347 1347
 		parent::single_setting_row( $field );
1348 1348
 	}
1349 1349
 
@@ -1404,8 +1404,8 @@  discard block
 block discarded – undo
1404 1404
 		// then we assume it's changed. If it's changed, unset the status and the previous response.
1405 1405
 		if ( ! $added_message && ( $local_key !== $response_key ) ) {
1406 1406
 
1407
-			unset( $posted_settings['license_key_response'] );
1408
-			unset( $posted_settings['license_key_status'] );
1407
+			unset( $posted_settings[ 'license_key_response' ] );
1408
+			unset( $posted_settings[ 'license_key_status' ] );
1409 1409
 
1410 1410
 			\GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
1411 1411
 
Please login to merge, or discard this patch.