Completed
Push — develop ( b6d173...c20624 )
by
unknown
18:28
created
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
 
@@ -942,11 +942,11 @@  discard block
 block discarded – undo
942 942
 		 * Remove multiple sorting before calling legacy filters.
943 943
 		 * This allows us to fake it till we make it.
944 944
 		 */
945
-		if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) {
945
+		if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) {
946 946
 			$has_multisort = true;
947
-			$parameters['sort_field'] = reset( $parameters['sort_field'] );
948
-			if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) {
949
-				$parameters['sort_direction'] = reset( $parameters['sort_direction'] );
947
+			$parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] );
948
+			if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) {
949
+				$parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] );
950 950
 			}
951 951
 		}
952 952
 
@@ -955,31 +955,30 @@  discard block
 block discarded – undo
955 955
 		 */
956 956
 		$parameters = \GravityView_frontend::get_view_entries_parameters( $parameters, $this->form->ID );
957 957
 
958
-		$parameters['context_view_id'] = $this->ID;
958
+		$parameters[ 'context_view_id' ] = $this->ID;
959 959
 		$parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID );
960 960
 
961 961
 		if ( ! is_array( $parameters ) ) {
962 962
 			$parameters = array();
963 963
 		}
964 964
 
965
-		if ( ! is_array( $parameters['search_criteria'] ) ) {
966
-			$parameters['search_criteria'] = array();
965
+		if ( ! is_array( $parameters[ 'search_criteria' ] ) ) {
966
+			$parameters[ 'search_criteria' ] = array();
967 967
 		}
968 968
 
969
-		if ( ( ! isset( $parameters['search_criteria']['field_filters'] ) ) || ( ! is_array( $parameters['search_criteria']['field_filters'] ) ) ) {
970
-			$parameters['search_criteria']['field_filters'] = array();
969
+		if ( ( ! isset( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) || ( ! is_array( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) ) {
970
+			$parameters[ 'search_criteria' ][ 'field_filters' ] = array();
971 971
 		}
972 972
 
973 973
 		if ( $request instanceof REST\Request ) {
974 974
 			$atts = $this->settings->as_atts();
975 975
 			$paging_parameters = wp_parse_args( $request->get_paging(), array(
976
-					'paging' => array( 'page_size' => $atts['page_size'] ),
976
+					'paging' => array( 'page_size' => $atts[ 'page_size' ] ),
977 977
 				) );
978
-			$parameters['paging'] = $paging_parameters['paging'];
978
+			$parameters[ 'paging' ] = $paging_parameters[ 'paging' ];
979 979
 		}
980 980
 
981
-		$page = Utils::get( $parameters['paging'], 'current_page' ) ?
982
-			: ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 );
981
+		$page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 );
983 982
 
984 983
 		/**
985 984
 		 * Cleanup duplicate field_filter parameters to simplify the query.
@@ -987,14 +986,14 @@  discard block
 block discarded – undo
987 986
 		$unique_field_filters = array();
988 987
 		foreach ( Utils::get( $parameters, 'search_criteria/field_filters', array() ) as $key => $filter ) {
989 988
 			if ( 'mode' === $key ) {
990
-				$unique_field_filters['mode'] = $filter;
989
+				$unique_field_filters[ 'mode' ] = $filter;
991 990
 			} else if ( ! in_array( $filter, $unique_field_filters ) ) {
992
-				$unique_field_filters[] = $filter;
991
+				$unique_field_filters[ ] = $filter;
993 992
 			}
994 993
 		}
995
-		$parameters['search_criteria']['field_filters'] = $unique_field_filters;
994
+		$parameters[ 'search_criteria' ][ 'field_filters' ] = $unique_field_filters;
996 995
 
997
-		if ( ! empty( $parameters['search_criteria']['field_filters'] ) ) {
996
+		if ( ! empty( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) {
998 997
 			gravityview()->log->notice( 'search_criteria/field_filters is not empty, third-party code may be using legacy search_criteria filters.' );
999 998
 		}
1000 999
 
@@ -1003,7 +1002,7 @@  discard block
 block discarded – undo
1003 1002
 			$query_class = $this->get_query_class();
1004 1003
 
1005 1004
 			/** @type \GF_Query $query */
1006
-			$query = new $query_class( $this->form->ID, $parameters['search_criteria'], Utils::get( $parameters, 'sorting' ) );
1005
+			$query = new $query_class( $this->form->ID, $parameters[ 'search_criteria' ], Utils::get( $parameters, 'sorting' ) );
1007 1006
 
1008 1007
 			/**
1009 1008
 			 * Apply multisort.
@@ -1014,15 +1013,15 @@  discard block
 block discarded – undo
1014 1013
 				$view_setting_sort_field_ids = \GV\Utils::get( $atts, 'sort_field', array() );
1015 1014
 				$view_setting_sort_directions = \GV\Utils::get( $atts, 'sort_direction', array() );
1016 1015
 
1017
-				$has_sort_query_param = ! empty( $_GET['sort'] ) && is_array( $_GET['sort'] );
1016
+				$has_sort_query_param = ! empty( $_GET[ 'sort' ] ) && is_array( $_GET[ 'sort' ] );
1018 1017
 
1019
-				if( $has_sort_query_param ) {
1020
-					$has_sort_query_param = array_filter( array_values( $_GET['sort'] ) );
1018
+				if ( $has_sort_query_param ) {
1019
+					$has_sort_query_param = array_filter( array_values( $_GET[ 'sort' ] ) );
1021 1020
 				}
1022 1021
 
1023 1022
 				if ( $this->settings->get( 'sort_columns' ) && $has_sort_query_param ) {
1024
-					$sort_field_ids = array_keys( $_GET['sort'] );
1025
-					$sort_directions = array_values( $_GET['sort'] );
1023
+					$sort_field_ids = array_keys( $_GET[ 'sort' ] );
1024
+					$sort_directions = array_values( $_GET[ 'sort' ] );
1026 1025
 				} else {
1027 1026
 					$sort_field_ids = $view_setting_sort_field_ids;
1028 1027
 					$sort_directions = $view_setting_sort_directions;
@@ -1030,7 +1029,7 @@  discard block
 block discarded – undo
1030 1029
 
1031 1030
 				$skip_first = false;
1032 1031
 
1033
-				foreach ( (array) $sort_field_ids as $key => $sort_field_id ) {
1032
+				foreach ( (array)$sort_field_ids as $key => $sort_field_id ) {
1034 1033
 
1035 1034
 					if ( ! $skip_first && ! $has_sort_query_param ) {
1036 1035
 						$skip_first = true; // Skip the first one, it's already in the query
@@ -1060,18 +1059,18 @@  discard block
 block discarded – undo
1060 1059
 
1061 1060
 				$merged_time = false;
1062 1061
 
1063
-				foreach ( $q['order'] as $oid => $order ) {
1062
+				foreach ( $q[ 'order' ] as $oid => $order ) {
1064 1063
 
1065 1064
 					$column = null;
1066 1065
 
1067
-					if ( $order[0] instanceof \GF_Query_Column ) {
1068
-						$column = $order[0];
1069
-					} else if ( $order[0] instanceof \GF_Query_Call ) {
1070
-						if ( count( $order[0]->columns ) != 1 || ! $order[0]->columns[0] instanceof \GF_Query_Column ) {
1066
+					if ( $order[ 0 ] instanceof \GF_Query_Column ) {
1067
+						$column = $order[ 0 ];
1068
+					} else if ( $order[ 0 ] instanceof \GF_Query_Call ) {
1069
+						if ( count( $order[ 0 ]->columns ) != 1 || ! $order[ 0 ]->columns[ 0 ] instanceof \GF_Query_Column ) {
1071 1070
 							$orders[ $oid ] = $order;
1072 1071
 							continue; // Need something that resembles a single sort
1073 1072
 						}
1074
-						$column = $order[0]->columns[0];
1073
+						$column = $order[ 0 ]->columns[ 0 ];
1075 1074
 					}
1076 1075
 
1077 1076
 					if ( ! $column || ( ! $field = \GFAPI::get_field( $column->source, $column->field_id ) ) || $field->type !== 'time' ) {
@@ -1085,7 +1084,7 @@  discard block
 block discarded – undo
1085 1084
 
1086 1085
 					$orders[ $oid ] = array(
1087 1086
 						new \GV\Mocks\GF_Query_Call_TIMESORT( 'timesort', array( $column, $sql ) ),
1088
-						$order[1] // Mock it!
1087
+						$order[ 1 ] // Mock it!
1089 1088
 					);
1090 1089
 
1091 1090
 					$merged_time = true;
@@ -1096,15 +1095,15 @@  discard block
 block discarded – undo
1096 1095
 					 * ORDER again.
1097 1096
 					 */
1098 1097
 					if ( ! empty( $orders ) && $_orders = $query->_order_generate( $orders ) ) {
1099
-						$sql['order'] = 'ORDER BY ' . implode( ', ', $_orders );
1098
+						$sql[ 'order' ] = 'ORDER BY ' . implode( ', ', $_orders );
1100 1099
 					}
1101 1100
 				}
1102 1101
 
1103 1102
 				return $sql;
1104 1103
 			} );
1105 1104
 
1106
-			$query->limit( $parameters['paging']['page_size'] )
1107
-				->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) );
1105
+			$query->limit( $parameters[ 'paging' ][ 'page_size' ] )
1106
+				->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) );
1108 1107
 
1109 1108
 			/**
1110 1109
 			 * Any joins?
@@ -1127,7 +1126,7 @@  discard block
 block discarded – undo
1127 1126
 
1128 1127
 						$query_parameters = $query->_introspect();
1129 1128
 
1130
-						$query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) );
1129
+						$query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) );
1131 1130
 					}
1132 1131
 
1133 1132
 					/**
@@ -1161,7 +1160,7 @@  discard block
 block discarded – undo
1161 1160
 					}
1162 1161
 
1163 1162
 					$q = $query->_introspect();
1164
-					$query->where( \GF_Query_Condition::_and( $q['where'], $condition ) );
1163
+					$query->where( \GF_Query_Condition::_and( $q[ 'where' ], $condition ) );
1165 1164
 
1166 1165
 					if ( $this->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
1167 1166
 
@@ -1186,7 +1185,7 @@  discard block
 block discarded – undo
1186 1185
 
1187 1186
 						$query_parameters = $query->_introspect();
1188 1187
 
1189
-						$query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) );
1188
+						$query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) );
1190 1189
 					}
1191 1190
 				}
1192 1191
 
@@ -1210,7 +1209,7 @@  discard block
 block discarded – undo
1210 1209
 						$conditions = array();
1211 1210
 
1212 1211
 						foreach ( $condition->expressions as $_condition ) {
1213
-							$conditions[] = $recurse( $_condition, $fields, $recurse );
1212
+							$conditions[ ] = $recurse( $_condition, $fields, $recurse );
1214 1213
 						}
1215 1214
 
1216 1215
 						return call_user_func_array(
@@ -1239,10 +1238,10 @@  discard block
 block discarded – undo
1239 1238
 					$q = new $query_class( $form_id );
1240 1239
 
1241 1240
 					// Copy the WHERE clauses but substitute the field_ids to the respective ones
1242
-					$q->where( $where_union_substitute( $query_parameters['where'], $fields, $where_union_substitute ) );
1241
+					$q->where( $where_union_substitute( $query_parameters[ 'where' ], $fields, $where_union_substitute ) );
1243 1242
 
1244 1243
 					// Copy the ORDER clause and substitute the field_ids to the respective ones
1245
-					foreach ( $query_parameters['order'] as $order ) {
1244
+					foreach ( $query_parameters[ 'order' ] as $order ) {
1246 1245
 						list( $column, $_order ) = $order;
1247 1246
 
1248 1247
 						if ( $column && $column instanceof \GF_Query_Column ) {
@@ -1256,15 +1255,15 @@  discard block
 block discarded – undo
1256 1255
 
1257 1256
 					add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( &$unions_sql ) {
1258 1257
 						// Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses
1259
-						$select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] );
1258
+						$select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] );
1260 1259
 
1261 1260
 						// Record the SQL
1262
-						$unions_sql[] = array(
1261
+						$unions_sql[ ] = array(
1263 1262
 							// Remove columns, we'll rebuild them
1264 1263
 							'select'  => preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $select ),
1265
-							'from'    => $sql['from'],
1266
-							'join'    => $sql['join'],
1267
-							'where'   => $sql['where'],
1264
+							'from'    => $sql[ 'from' ],
1265
+							'join'    => $sql[ 'join' ],
1266
+							'where'   => $sql[ 'where' ],
1268 1267
 							// Remove order and limit
1269 1268
 						);
1270 1269
 
@@ -1281,11 +1280,11 @@  discard block
 block discarded – undo
1281 1280
 
1282 1281
 				add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( $unions_sql ) {
1283 1282
 					// Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses
1284
-					$sql['select'] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] );
1283
+					$sql[ 'select' ] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] );
1285 1284
 
1286 1285
 					// Remove columns, we'll rebuild them
1287
-					preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql['select'], $select_match );
1288
-					$sql['select'] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql['select'] );
1286
+					preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql[ 'select' ], $select_match );
1287
+					$sql[ 'select' ] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql[ 'select' ] );
1289 1288
 
1290 1289
 					$unions = array();
1291 1290
 
@@ -1296,30 +1295,30 @@  discard block
 block discarded – undo
1296 1295
 					};
1297 1296
 
1298 1297
 					// Add all the order columns into the selects, so we can order by the whole union group
1299
-					preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql['order'], $order_matches );
1298
+					preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql[ 'order' ], $order_matches );
1300 1299
 
1301 1300
 					$columns = array(
1302
-						sprintf( '%s AS %s', $select_match[1], $column_to_alias( $select_match[1] ) )
1301
+						sprintf( '%s AS %s', $select_match[ 1 ], $column_to_alias( $select_match[ 1 ] ) )
1303 1302
 					);
1304 1303
 
1305 1304
 					foreach ( array_slice( $order_matches, 1 ) as $match ) {
1306
-						$columns[] = sprintf( '%s AS %s', $match[0], $column_to_alias( $match[0] ) );
1305
+						$columns[ ] = sprintf( '%s AS %s', $match[ 0 ], $column_to_alias( $match[ 0 ] ) );
1307 1306
 
1308 1307
 						// Rewrite the order columns to the shared aliases
1309
-						$sql['order'] = str_replace( $match[0], $column_to_alias( $match[0] ), $sql['order'] );
1308
+						$sql[ 'order' ] = str_replace( $match[ 0 ], $column_to_alias( $match[ 0 ] ), $sql[ 'order' ] );
1310 1309
 					}
1311 1310
 
1312 1311
 					$columns = array_unique( $columns );
1313 1312
 
1314 1313
 					// Add the columns to every UNION
1315 1314
 					foreach ( $unions_sql as $union_sql ) {
1316
-						$union_sql['select'] .= implode( ', ', $columns );
1317
-						$unions []= implode( ' ', $union_sql );
1315
+						$union_sql[ 'select' ] .= implode( ', ', $columns );
1316
+						$unions [ ] = implode( ' ', $union_sql );
1318 1317
 					}
1319 1318
 
1320 1319
 					// Add the columns to the main SELECT, but only grab the entry id column
1321
-					$sql['select'] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql['select'] . implode( ', ', $columns );
1322
-					$sql['order'] = implode( ' ', $unions ) . ') AS u ' . $sql['order'];
1320
+					$sql[ 'select' ] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql[ 'select' ] . implode( ', ', $columns );
1321
+					$sql[ 'order' ] = implode( ' ', $unions ) . ') AS u ' . $sql[ 'order' ];
1323 1322
 
1324 1323
 					return $sql;
1325 1324
 				} );
@@ -1364,20 +1363,20 @@  discard block
 block discarded – undo
1364 1363
 			} );
1365 1364
 		} else {
1366 1365
 			$entries = $this->form->entries
1367
-				->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) )
1366
+				->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) )
1368 1367
 				->offset( $this->settings->get( 'offset' ) )
1369
-				->limit( $parameters['paging']['page_size'] )
1368
+				->limit( $parameters[ 'paging' ][ 'page_size' ] )
1370 1369
 				->page( $page );
1371 1370
 
1372
-			if ( ! empty( $parameters['sorting'] ) && is_array( $parameters['sorting'] && ! isset( $parameters['sorting']['key'] ) ) ) {
1371
+			if ( ! empty( $parameters[ 'sorting' ] ) && is_array( $parameters[ 'sorting' ] && ! isset( $parameters[ 'sorting' ][ 'key' ] ) ) ) {
1373 1372
 				// Pluck off multisort arrays
1374
-				$parameters['sorting'] = $parameters['sorting'][0];
1373
+				$parameters[ 'sorting' ] = $parameters[ 'sorting' ][ 0 ];
1375 1374
 			}
1376 1375
 
1377
-			if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) {
1376
+			if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) {
1378 1377
 				$field = new \GV\Field();
1379
-				$field->ID = $parameters['sorting']['key'];
1380
-				$direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
1378
+				$field->ID = $parameters[ 'sorting' ][ 'key' ];
1379
+				$direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
1381 1380
 				$entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) );
1382 1381
 			}
1383 1382
 		}
@@ -1461,7 +1460,7 @@  discard block
 block discarded – undo
1461 1460
 		$allowed = $headers = array();
1462 1461
 
1463 1462
 		foreach ( $view->fields->by_position( "directory_*" )->by_visible( $view )->all() as $id => $field ) {
1464
-			$allowed[] = $field;
1463
+			$allowed[ ] = $field;
1465 1464
 		}
1466 1465
 
1467 1466
 		$renderer = new Field_Renderer();
@@ -1483,17 +1482,17 @@  discard block
 block discarded – undo
1483 1482
 			} );
1484 1483
 
1485 1484
 			foreach ( array_diff( $allowed_field_ids, wp_list_pluck( $allowed, 'ID' ) ) as $field_id ) {
1486
-				$allowed[] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id );
1485
+				$allowed[ ] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id );
1487 1486
 			}
1488 1487
 
1489 1488
 			foreach ( $allowed as $field ) {
1490 1489
 				$source = is_numeric( $field->ID ) ? $view->form : new \GV\Internal_Source();
1491 1490
 
1492
-				$return[] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' );
1491
+				$return[ ] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' );
1493 1492
 
1494 1493
 				if ( ! $headers_done ) {
1495 1494
 					$label = $field->get_label( $view, $source, $entry );
1496
-					$headers[] = $label ? $label : $field->ID;
1495
+					$headers[ ] = $label ? $label : $field->ID;
1497 1496
 				}
1498 1497
 			}
1499 1498
 
Please login to merge, or discard this patch.
future/includes/class-gv-widget.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		$enable_custom_class = apply_filters( 'gravityview/widget/enable_custom_class', false, $this );
166 166
 
167 167
 		if ( $enable_custom_class ) {
168
-			$settings['custom_class'] = array(
168
+			$settings[ 'custom_class' ] = array(
169 169
 				'type'       => 'text',
170 170
 				'label'      => __( 'Custom CSS Class:', 'gravityview' ),
171 171
 				'desc'       => __( 'This class will be added to the widget container', 'gravityview' ),
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 				'1-1' => array(
224 224
 					   array(
225 225
 						   'areaid' => 'top',
226
-						   'title' => __( 'Top', 'gravityview' ) ,
226
+						   'title' => __( 'Top', 'gravityview' ),
227 227
 						   'subtitle' => ''
228 228
 					   ),
229 229
 				   ),
@@ -232,14 +232,14 @@  discard block
 block discarded – undo
232 232
 				'1-2' => array(
233 233
 					array(
234 234
 						'areaid' => 'left',
235
-						'title' => __( 'Left', 'gravityview' ) ,
235
+						'title' => __( 'Left', 'gravityview' ),
236 236
 						'subtitle' => ''
237 237
 					),
238 238
 				),
239 239
 				'2-2' => array(
240 240
 					array(
241 241
 						'areaid' => 'right',
242
-						'title' => __( 'Right', 'gravityview' ) ,
242
+						'title' => __( 'Right', 'gravityview' ),
243 243
 						'subtitle' => ''
244 244
 					),
245 245
 				),
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 		}
275 275
 
276 276
 		$widgets[ $this->get_widget_id() ] = array(
277
-			'label' => $this->widget_label ,
277
+			'label' => $this->widget_label,
278 278
 			'description' => $this->widget_description,
279 279
 			'subtitle' => $this->widget_subtitle,
280 280
 			'icon' => $this->icon,
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	public function assign_widget_options( $options = array(), $template = '', $widget = '' ) {
298 298
 		if ( $this->get_widget_id() === $widget ) {
299
-			if( $settings = $this->get_settings() ) {
299
+			if ( $settings = $this->get_settings() ) {
300 300
 				$options = array_merge( $options, $settings );
301 301
 			}
302 302
 		}
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 			return;
351 351
 		}
352 352
 
353
-		add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode') );
353
+		add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode' ) );
354 354
 	}
355 355
 
356 356
 	/**
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-checkbox.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 		$field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id );
48 48
 
49 49
 		// It's the parent field, not an input
50
-		if( floor( $field_id ) === floatval( $field_id ) ) {
50
+		if ( floor( $field_id ) === floatval( $field_id ) ) {
51 51
 			return $field_options;
52 52
 		}
53 53
 
54
-		if( $this->is_choice_value_enabled() ) {
54
+		if ( $this->is_choice_value_enabled() ) {
55 55
 
56 56
 			$desc = esc_html__( 'This input has a label and a value. What should be displayed?', 'gravityview' );
57 57
 			$default = 'value';
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 			);
70 70
 		}
71 71
 
72
-		$field_options['choice_display'] = array(
72
+		$field_options[ 'choice_display' ] = array(
73 73
 			'type'    => 'radio',
74 74
 			'class'   => 'vertical',
75 75
 			'label'   => __( 'What should be displayed:', 'gravityview' ),
Please login to merge, or discard this patch.
trustedlogin/trustedlogin/client/src/Endpoint.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
 			return;
211 211
 		}
212 212
 
213
-		if ( ! isset( $_REQUEST['_wpnonce'] ) ) {
213
+		if ( ! isset( $_REQUEST[ '_wpnonce' ] ) ) {
214 214
 			return;
215 215
 		}
216 216
 
217
-		$verify_nonce = wp_verify_nonce( $_REQUEST['_wpnonce'], self::REVOKE_SUPPORT_QUERY_PARAM );
217
+		$verify_nonce = wp_verify_nonce( $_REQUEST[ '_wpnonce' ], self::REVOKE_SUPPORT_QUERY_PARAM );
218 218
 
219 219
 		if ( ! $verify_nonce ) {
220 220
 			$this->logging->log( 'Removing user failed: Nonce expired (Nonce value: ' . $verify_nonce . ')', __METHOD__, 'error' );
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	 * @return string
307 307
 	 */
308 308
 	public function get() {
309
-		return (string) get_site_option( $this->option_name );
309
+		return (string)get_site_option( $this->option_name );
310 310
 	}
311 311
 
312 312
 	/**
Please login to merge, or discard this patch.
trustedlogin/trustedlogin/client/src/SupportUser.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 
130 130
 		$user_ids = get_users( $args );
131 131
 
132
-		return empty( $user_ids ) ? false : (int) $user_ids[0];
132
+		return empty( $user_ids ) ? false : (int)$user_ids[ 0 ];
133 133
 	}
134 134
 
135 135
 	/**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 			return false;
154 154
 		}
155 155
 
156
-		if ( time() > (int) $expiration ) {
156
+		if ( time() > (int)$expiration ) {
157 157
 			return false;
158 158
 		}
159 159
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 
380 380
 		$user = get_users( $args );
381 381
 
382
-		return empty( $user ) ? null : $user[0];
382
+		return empty( $user ) ? null : $user[ 0 ];
383 383
 	}
384 384
 
385 385
 	/**
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 		$support_users = $this->get_all();
438 438
 
439 439
 		if ( $support_users ) {
440
-			return $support_users[0];
440
+			return $support_users[ 0 ];
441 441
 		}
442 442
 
443 443
 		return null;
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 			'number'  => 1,
525 525
 		) );
526 526
 
527
-		$reassign_id = empty( $admins ) ? null : $admins[0]->ID;
527
+		$reassign_id = empty( $admins ) ? null : $admins[ 0 ]->ID;
528 528
 
529 529
 		$this->logging->log( 'Reassign user ID: ' . var_export( $reassign_id, true ), __METHOD__, 'info' );
530 530
 
Please login to merge, or discard this patch.
vendor/composer/autoload_classmap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 // autoload_classmap.php @generated by Composer
4 4
 
5
-$vendorDir = dirname(dirname(__FILE__));
6
-$baseDir = dirname($vendorDir);
5
+$vendorDir = dirname( dirname( __FILE__ ) );
6
+$baseDir = dirname( $vendorDir );
7 7
 
8 8
 return array(
9 9
     'ComposerAutoloaderInitb5638313a52df4893eb45c04efdaa356' => $vendorDir . '/trustedlogin/client/vendor/composer/autoload_real.php',
Please login to merge, or discard this patch.
vendor/composer/autoload_psr4.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@
 block discarded – undo
2 2
 
3 3
 // autoload_psr4.php @generated by Composer
4 4
 
5
-$vendorDir = dirname(dirname(__FILE__));
6
-$baseDir = dirname($vendorDir);
5
+$vendorDir = dirname( dirname( __FILE__ ) );
6
+$baseDir = dirname( $vendorDir );
7 7
 
8 8
 return array(
9
-    'TrustedLogin\\' => array($baseDir . '/src', $vendorDir . '/trustedlogin/client/src'),
10
-    'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
11
-    'Katzgrau\\KLogger\\' => array($vendorDir . '/katzgrau/klogger/src'),
12
-    'KatzGrau\\KLogger\\' => array($baseDir . '/src'),
9
+    'TrustedLogin\\' => array( $baseDir . '/src', $vendorDir . '/trustedlogin/client/src' ),
10
+    'Psr\\Log\\' => array( $vendorDir . '/psr/log/Psr/Log' ),
11
+    'Katzgrau\\KLogger\\' => array( $vendorDir . '/katzgrau/klogger/src' ),
12
+    'KatzGrau\\KLogger\\' => array( $baseDir . '/src' ),
13 13
 );
Please login to merge, or discard this patch.
vendor/composer/autoload_files.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 // autoload_files.php @generated by Composer
4 4
 
5
-$vendorDir = dirname(dirname(__FILE__));
6
-$baseDir = dirname($vendorDir);
5
+$vendorDir = dirname( dirname( __FILE__ ) );
6
+$baseDir = dirname( $vendorDir );
7 7
 
8 8
 return array(
9 9
     '5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
Please login to merge, or discard this patch.
vendor/composer/autoload_static.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,48 +6,48 @@  discard block
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInit984ed95bef2b0e3d4eeb0208a88dc67d
8 8
 {
9
-    public static $files = array (
9
+    public static $files = array(
10 10
         '5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php',
11 11
         '3109cb1a231dcd04bee1f9f620d46975' => __DIR__ . '/..' . '/paragonie/sodium_compat/autoload.php',
12 12
     );
13 13
 
14
-    public static $prefixLengthsPsr4 = array (
14
+    public static $prefixLengthsPsr4 = array(
15 15
         'T' => 
16
-        array (
16
+        array(
17 17
             'TrustedLogin\\' => 13,
18 18
         ),
19 19
         'P' => 
20
-        array (
20
+        array(
21 21
             'Psr\\Log\\' => 8,
22 22
         ),
23 23
         'K' => 
24
-        array (
24
+        array(
25 25
             'Katzgrau\\KLogger\\' => 17,
26 26
             'KatzGrau\\KLogger\\' => 17,
27 27
         ),
28 28
     );
29 29
 
30
-    public static $prefixDirsPsr4 = array (
30
+    public static $prefixDirsPsr4 = array(
31 31
         'TrustedLogin\\' => 
32
-        array (
32
+        array(
33 33
             0 => __DIR__ . '/../..' . '/src',
34 34
             1 => __DIR__ . '/..' . '/trustedlogin/client/src',
35 35
         ),
36 36
         'Psr\\Log\\' => 
37
-        array (
37
+        array(
38 38
             0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
39 39
         ),
40 40
         'Katzgrau\\KLogger\\' => 
41
-        array (
41
+        array(
42 42
             0 => __DIR__ . '/..' . '/katzgrau/klogger/src',
43 43
         ),
44 44
         'KatzGrau\\KLogger\\' => 
45
-        array (
45
+        array(
46 46
             0 => __DIR__ . '/../..' . '/src',
47 47
         ),
48 48
     );
49 49
 
50
-    public static $classMap = array (
50
+    public static $classMap = array(
51 51
         'ComposerAutoloaderInitb5638313a52df4893eb45c04efdaa356' => __DIR__ . '/..' . '/trustedlogin/client/vendor/composer/autoload_real.php',
52 52
         'Composer\\Autoload\\ClassLoader' => __DIR__ . '/..' . '/trustedlogin/client/vendor/composer/ClassLoader.php',
53 53
         'Composer\\Autoload\\ComposerStaticInitb5638313a52df4893eb45c04efdaa356' => __DIR__ . '/..' . '/trustedlogin/client/vendor/composer/autoload_static.php',
@@ -178,13 +178,13 @@  discard block
 block discarded – undo
178 178
         'TypeError' => __DIR__ . '/..' . '/paragonie/random_compat/lib/error_polyfill.php',
179 179
     );
180 180
 
181
-    public static function getInitializer(ClassLoader $loader)
181
+    public static function getInitializer( ClassLoader $loader )
182 182
     {
183
-        return \Closure::bind(function () use ($loader) {
183
+        return \Closure::bind( function() use ( $loader ) {
184 184
             $loader->prefixLengthsPsr4 = ComposerStaticInit984ed95bef2b0e3d4eeb0208a88dc67d::$prefixLengthsPsr4;
185 185
             $loader->prefixDirsPsr4 = ComposerStaticInit984ed95bef2b0e3d4eeb0208a88dc67d::$prefixDirsPsr4;
186 186
             $loader->classMap = ComposerStaticInit984ed95bef2b0e3d4eeb0208a88dc67d::$classMap;
187 187
 
188
-        }, null, ClassLoader::class);
188
+        }, null, ClassLoader::class );
189 189
     }
190 190
 }
Please login to merge, or discard this patch.