Completed
Push — master ( 43d4c6...de6a17 )
by Sam
02:59
created
tabulate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 // Activation hooks. Uninstall is handled by uninstall.php.
43 43
 register_activation_hook( __FILE__, '\\WordPress\\Tabulate\\DB\\ChangeTracker::activate' );
44 44
 register_activation_hook( __FILE__, '\\WordPress\\Tabulate\\DB\\Reports::activate' );
45
-register_activation_hook(__FILE__, function() {
45
+register_activation_hook( __FILE__, function() {
46 46
 	// Clean up out-of-date option.
47 47
 	delete_option( TABULATE_SLUG . '_managed_tables' );
48 48
 });
Please login to merge, or discard this patch.
src/Controllers/TableController.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -47,28 +47,28 @@  discard block
 block discarded – undo
47 47
 	 * @return string
48 48
 	 */
49 49
 	public function index( $args ) {
50
-		$table = $this->get_table( $args['table'] );
50
+		$table = $this->get_table( $args[ 'table' ] );
51 51
 		if ( ! $table instanceof Table ) {
52 52
 			return $table;
53 53
 		}
54 54
 
55 55
 		// Pagination.
56
-		$page_num = (isset( $args['p'] ) && is_numeric( $args['p'] ) ) ? abs( $args['p'] ) : 1;
56
+		$page_num = ( isset( $args[ 'p' ] ) && is_numeric( $args[ 'p' ] ) ) ? abs( $args[ 'p' ] ) : 1;
57 57
 		$table->set_current_page_num( $page_num );
58
-		if ( isset( $args['psize'] ) ) {
59
-			$table->set_records_per_page( $args['psize'] );
58
+		if ( isset( $args[ 'psize' ] ) ) {
59
+			$table->set_records_per_page( $args[ 'psize' ] );
60 60
 		}
61 61
 
62 62
 		// Ordering.
63
-		if ( isset( $args['order_by'] ) ) {
64
-			$table->set_order_by( $args['order_by'] );
63
+		if ( isset( $args[ 'order_by' ] ) ) {
64
+			$table->set_order_by( $args[ 'order_by' ] );
65 65
 		}
66
-		if ( isset( $args['order_dir'] ) ) {
67
-			$table->set_order_dir( $args['order_dir'] );
66
+		if ( isset( $args[ 'order_dir' ] ) ) {
67
+			$table->set_order_dir( $args[ 'order_dir' ] );
68 68
 		}
69 69
 
70 70
 		// Filters.
71
-		$filter_param = (isset( $args['filter'] )) ? $args['filter'] : array();
71
+		$filter_param = ( isset( $args[ 'filter' ] ) ) ? $args[ 'filter' ] : array();
72 72
 		$table->add_filters( $filter_param );
73 73
 
74 74
 		// Give it all to the template.
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		$template->stage = 'choose_file';
121 121
 
122 122
 		// First make sure the user is allowed to import data into this table.
123
-		$table = $this->get_table( $args['table'] );
123
+		$table = $this->get_table( $args[ 'table' ] );
124 124
 		$template->record = $table->get_default_record();
125 125
 		$template->action = 'import';
126 126
 		$template->table = $table;
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
 		require_once ABSPATH . '/wp-admin/includes/file.php';
137 137
 		$template->form_action = $table->get_url( 'import' );
138 138
 		try {
139
-			$hash = isset( $_GET['hash'] ) ? $_GET['hash'] : false;
139
+			$hash = isset( $_GET[ 'hash' ] ) ? $_GET[ 'hash' ] : false;
140 140
 			$uploaded = false;
141
-			if ( isset( $_FILES['file'] ) ) {
141
+			if ( isset( $_FILES[ 'file' ] ) ) {
142 142
 				check_admin_referer( 'import-upload' );
143
-				$uploaded = wp_handle_upload( $_FILES['file'], array(
143
+				$uploaded = wp_handle_upload( $_FILES[ 'file' ], array(
144 144
 					'action' => $template->action,
145 145
 				) );
146 146
 			}
@@ -155,28 +155,28 @@  discard block
 block discarded – undo
155 155
 		 */
156 156
 		if ( $csv_file->loaded() ) {
157 157
 			$template->file = $csv_file;
158
-			$template->stage = $template->stages[1];
158
+			$template->stage = $template->stages[ 1 ];
159 159
 			$template->form_action .= "&hash=" . $csv_file->hash;
160 160
 		}
161 161
 
162 162
 		/*
163 163
 		 * Stage 3 of 4: Previewing.
164 164
 		 */
165
-		if ( $csv_file->loaded() && isset( $_POST['preview'] ) ) {
165
+		if ( $csv_file->loaded() && isset( $_POST[ 'preview' ] ) ) {
166 166
 			check_admin_referer( 'import-preview' );
167
-			$template->stage = $template->stages[2];
168
-			$template->columns = serialize( $_POST['columns'] );
167
+			$template->stage = $template->stages[ 2 ];
168
+			$template->columns = serialize( $_POST[ 'columns' ] );
169 169
 			$errors = array();
170 170
 			// Make sure all required columns are selected.
171 171
 			foreach ( $table->get_columns() as $col ) {
172 172
 				// Handle missing columns separately; other column errors are
173 173
 				// done in the CSV class. Missing columns don't matter if importing
174 174
 				// existing records.
175
-				$is_missing = empty( $_POST['columns'][ $col->get_name() ] );
175
+				$is_missing = empty( $_POST[ 'columns' ][ $col->get_name() ] );
176 176
 				$pk = $table->get_pk_column();
177
-				$pk_present = $pk && isset( $_POST['columns'][ $pk->get_name() ] );
177
+				$pk_present = $pk && isset( $_POST[ 'columns' ][ $pk->get_name() ] );
178 178
 				if ( ! $pk_present && $col->is_required() && $is_missing ) {
179
-					$errors[] = array(
179
+					$errors[ ] = array(
180 180
 						'column_name' => '',
181 181
 						'column_number' => '',
182 182
 						'field_name' => $col->get_name(),
@@ -185,17 +185,17 @@  discard block
 block discarded – undo
185 185
 					);
186 186
 				}
187 187
 			}
188
-			$template->errors = empty( $errors ) ? $csv_file->match_fields( $table, wp_unslash( $_POST['columns'] ) ) : $errors;
188
+			$template->errors = empty( $errors ) ? $csv_file->match_fields( $table, wp_unslash( $_POST[ 'columns' ] ) ) : $errors;
189 189
 		}
190 190
 
191 191
 		/*
192 192
 		 * Stage 4 of 4: Import.
193 193
 		 */
194
-		if ( $csv_file->loaded() && isset( $_POST['import'] ) ) {
194
+		if ( $csv_file->loaded() && isset( $_POST[ 'import' ] ) ) {
195 195
 			check_admin_referer( 'import-finish' );
196
-			$template->stage = $template->stages[3];
196
+			$template->stage = $template->stages[ 3 ];
197 197
 			$this->wpdb->query( 'BEGIN' );
198
-			$result = $csv_file->import_data( $table, unserialize( wp_unslash( $_POST['columns'] ) ) );
198
+			$result = $csv_file->import_data( $table, unserialize( wp_unslash( $_POST[ 'columns' ] ) ) );
199 199
 			$this->wpdb->query( 'COMMIT' );
200 200
 			$template->add_notice( 'updated', 'Import complete; ' . $result . ' rows imported.' );
201 201
 		}
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	public function calendar( $args ) {
213 213
 		// @todo Validate args.
214
-		$year_num = (isset( $args['year'] )) ? $args['year'] : date( 'Y' );
215
-		$month_num = (isset( $args['month'] )) ? $args['month'] : date( 'm' );
214
+		$year_num = ( isset( $args[ 'year' ] ) ) ? $args[ 'year' ] : date( 'Y' );
215
+		$month_num = ( isset( $args[ 'month' ] ) ) ? $args[ 'month' ] : date( 'm' );
216 216
 
217 217
 		$template = new \WordPress\Tabulate\Template( 'calendar.html' );
218
-		$table = $this->get_table( $args['table'] );
218
+		$table = $this->get_table( $args[ 'table' ] );
219 219
 
220 220
 		$template->table = $table;
221 221
 		$template->action = 'calendar';
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 					$records[ $date_val ] = array();
239 239
 				}
240 240
 				// Add this record to the day's list.
241
-				$records[ $date_val ][] = $rec;
241
+				$records[ $date_val ][ ] = $rec;
242 242
 			}
243 243
 		}
244 244
 		// $records is grouped by date, with each item in a single date being
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	public function export( $args ) {
259 259
 		// Get table.
260
-		$table = $this->get_table( $args['table'] );
260
+		$table = $this->get_table( $args[ 'table' ] );
261 261
 
262 262
 		// Filter and export.
263
-		$filter_param = ( isset( $args['filter'] )) ? $args['filter'] : array();
263
+		$filter_param = ( isset( $args[ 'filter' ] ) ) ? $args[ 'filter' ] : array();
264 264
 		$table->add_filters( $filter_param );
265 265
 		$filename = $table->export();
266 266
 
@@ -281,11 +281,11 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	public function notfound( $args ) {
283 283
 		// Get table.
284
-		$table = $this->get_table( $args['table'] );
284
+		$table = $this->get_table( $args[ 'table' ] );
285 285
 
286 286
 		// Get the values from the request, or give up.
287
-		$filter_id = isset( $args['notfound'] ) ? $args['notfound'] : false;
288
-		$values_string = isset( $args['filter'][ $filter_id ]['value'] ) ? $args['filter'][ $filter_id ]['value'] : false;
287
+		$filter_id = isset( $args[ 'notfound' ] ) ? $args[ 'notfound' ] : false;
288
+		$values_string = isset( $args[ 'filter' ][ $filter_id ][ 'value' ] ) ? $args[ 'filter' ][ $filter_id ][ 'value' ] : false;
289 289
 		if ( ! $table instanceof Table || ! $values_string ) {
290 290
 			return;
291 291
 		}
@@ -320,12 +320,12 @@  discard block
 block discarded – undo
320 320
 	 * @return string
321 321
 	 */
322 322
 	public function timeline( $args ) {
323
-		$table = $this->get_table( $args['table'] );
323
+		$table = $this->get_table( $args[ 'table' ] );
324 324
 		$template = new \WordPress\Tabulate\Template( 'timeline.html' );
325 325
 		$template->action = 'timeline';
326 326
 		$template->table = $table;
327
-		$start_date_arg = (isset( $args['start_date'] )) ? $args['start_date'] : date( 'Y-m-d' );
328
-		$end_date_arg = (isset( $args['end_date'] )) ? $args['end_date'] : date( 'Y-m-d' );
327
+		$start_date_arg = ( isset( $args[ 'start_date' ] ) ) ? $args[ 'start_date' ] : date( 'Y-m-d' );
328
+		$end_date_arg = ( isset( $args[ 'end_date' ] ) ) ? $args[ 'end_date' ] : date( 'Y-m-d' );
329 329
 		$start_date = new \DateTime( $start_date_arg );
330 330
 		$end_date = new \DateTime( $end_date_arg );
331 331
 		if ( $start_date->diff( $end_date, true )->d < 7 ) {
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 			if ( ! isset( $data[ $record->get_title() ] ) ) {
342 342
 				$data[ $record->get_title() ] = array();
343 343
 			}
344
-			$data[ $record->get_title() ][] = $record;
344
+			$data[ $record->get_title() ][ ] = $record;
345 345
 		}
346 346
 		$template->data = $data;
347 347
 		return $template->render();
Please login to merge, or discard this patch.
src/Controllers/ShortcodeController.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 			'search' => null,
54 54
 		);
55 55
 		$attrs = shortcode_atts( $defaults, $raw_attrs );
56
-		if ( ! isset( $attrs['table'] ) ) {
56
+		if ( ! isset( $attrs[ 'table' ] ) ) {
57 57
 			$msg = "The 'table' attribute must be set. Attributes found: [";
58 58
 			foreach ( $raw_attrs as $k => $v ) {
59 59
 				$msg .= ' ' . htmlentities2( $k ) . ' = "' . htmlentities2( $v ) . '" ';
@@ -61,19 +61,19 @@  discard block
 block discarded – undo
61 61
 			$msg .= "]";
62 62
 			return $this->error( $msg );
63 63
 		}
64
-		$table = $this->db->get_table( $attrs['table'] );
64
+		$table = $this->db->get_table( $attrs[ 'table' ] );
65 65
 		if ( ! $table ) {
66 66
 			if ( ! is_user_logged_in() ) {
67 67
 				return $this->error( "You are not logged in. " . wp_loginout( get_the_permalink(), false ) );
68 68
 			}
69 69
 			return $this->error();
70 70
 		}
71
-		$format_method = $attrs['format'] . '_format';
71
+		$format_method = $attrs[ 'format' ] . '_format';
72 72
 		if ( is_callable( array( $this, $format_method ) ) ) {
73 73
 			wp_enqueue_script( 'tabulate-scripts' );
74 74
 			return $this->$format_method( $table, $attrs, $_REQUEST );
75 75
 		} else {
76
-			return $this->error( "Format '{$attrs['format']}' not available." );
76
+			return $this->error( "Format '{$attrs[ 'format' ]}' not available." );
77 77
 		}
78 78
 	}
79 79
 
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	protected function record_format( Table $table, $attrs, $query = null ) {
105 105
 		// Check for the ident shortcode parameter...
106
-		if ( isset( $attrs['ident'] ) ) {
107
-			$ident = $attrs['ident'];
106
+		if ( isset( $attrs[ 'ident' ] ) ) {
107
+			$ident = $attrs[ 'ident' ];
108 108
 		}
109 109
 		// ...or the tablename=ident URL parameter.
110 110
 		if ( isset( $query[ $table->get_name() ] ) && is_scalar( $query[ $table->get_name() ] ) ) {
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		$template = new Template( 'record/shortcode.html' );
140 140
 		$template->table = $table;
141 141
 		$template->record = $table->get_default_record();
142
-		$template->return_to = ( isset( $attrs['return_to'] ) ) ? $attrs['return_to'] : get_the_permalink();
142
+		$template->return_to = ( isset( $attrs[ 'return_to' ] ) ) ? $attrs[ 'return_to' ] : get_the_permalink();
143 143
 		return $template->render();
144 144
 	}
145 145
 
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 	protected function list_format( Table $table, $attrs ) {
165 165
 		$titles = array();
166 166
 		foreach ( $table->get_records() as $rec ) {
167
-			$titles[] = $rec->get_title();
167
+			$titles[ ] = $rec->get_title();
168 168
 		}
169
-		$glue = ( ! empty( $attrs['glue'] ) ) ? $attrs['glue'] : ', ';
169
+		$glue = ( ! empty( $attrs[ 'glue' ] ) ) ? $attrs[ 'glue' ] : ', ';
170 170
 		return '<span class="tabulate list-format">' . join( $glue, $titles ) . '</span>';
171 171
 	}
172 172
 
@@ -181,19 +181,19 @@  discard block
 block discarded – undo
181 181
 	protected function table_format( Table $table, $attrs, $query = null ) {
182 182
 		// Filters.
183 183
 		// Apply filters from the URL query parameters.
184
-		if ( isset( $query['table'] ) && $query['table'] === $table->get_name() ) {
185
-			$query_filters = (isset( $query['filter'] )) ? $query['filter'] : array();
184
+		if ( isset( $query[ 'table' ] ) && $query[ 'table' ] === $table->get_name() ) {
185
+			$query_filters = ( isset( $query[ 'filter' ] ) ) ? $query[ 'filter' ] : array();
186 186
 			$table->add_filters( $query_filters );
187 187
 		}
188 188
 
189 189
 		// Pagination.
190 190
 		$page_num = 1;
191
-		if ( isset( $query['tabulate_p'] ) && is_numeric( $query['tabulate_p'] ) ) {
192
-			$page_num = abs( $query['tabulate_p'] );
191
+		if ( isset( $query[ 'tabulate_p' ] ) && is_numeric( $query[ 'tabulate_p' ] ) ) {
192
+			$page_num = abs( $query[ 'tabulate_p' ] );
193 193
 		}
194 194
 		$table->set_current_page_num( $page_num );
195
-		if ( isset( $query['tabulate_psize'] ) ) {
196
-			$table->set_records_per_page( $query['tabulate_psize'] );
195
+		if ( isset( $query[ 'tabulate_psize' ] ) ) {
196
+			$table->set_records_per_page( $query[ 'tabulate_psize' ] );
197 197
 		}
198 198
 
199 199
 		// Construct the HTML.
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 		$template->records = $table->get_records();
204 204
 
205 205
 		// Add the search form if required.
206
-		$template->search = ! empty( $attrs['search'] );
206
+		$template->search = ! empty( $attrs[ 'search' ] );
207 207
 		$template->form_action = get_the_permalink();
208 208
 
209 209
 		// Return completed HTML output.
Please login to merge, or discard this patch.
src/DB/Grants.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			self::ANON_ROLE => 'Anonymous User',
68 68
 		);
69 69
 		foreach ( wp_roles()->roles as $role_name => $role ) {
70
-			$roles[ $role_name ] = $role['name'];
70
+			$roles[ $role_name ] = $role[ 'name' ];
71 71
 		}
72 72
 		return $roles;
73 73
 	}
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
 		$cap = substr( $cap_full_name, strlen( TABULATE_SLUG ) + 1 );
123 123
 
124 124
 		// Set up basic data.
125
-		$table_name = ( $args[2] ) ? $args[2] : false;
125
+		$table_name = ( $args[ 2 ] ) ? $args[ 2 ] : false;
126 126
 		$grants = new self();
127 127
 
128 128
 		// Users with 'promote_users' capability can do everything.
129
-		if ( isset( $all_capabilities['promote_users'] ) ) {
129
+		if ( isset( $all_capabilities[ 'promote_users' ] ) ) {
130 130
 			$all_capabilities[ $cap_full_name ] = true;
131 131
 		}
132 132
 
Please login to merge, or discard this patch.
src/DB/Table.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		}
208 208
 		// Validate the value.
209 209
 		$empty_value_allowed = ( strpos( $operator, 'empty' ) === false && ! empty( $value ) );
210
-		$valid_value = (strpos( $operator, 'empty' ) !== false) || $empty_value_allowed;
210
+		$valid_value = ( strpos( $operator, 'empty' ) !== false ) || $empty_value_allowed;
211 211
 		if ( ! $valid_operator ) {
212 212
 			// translators: Error message shown when a filter is passed an invalid value.
213 213
 			$msg = __( '"%s" is not a valid value.', 'tabulate' );
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		}
216 216
 		// Save the filter for later application (see Table::apply_filters()).
217 217
 		if ( $valid_columm && $valid_operator && $valid_value ) {
218
-			$this->filters[] = array(
218
+			$this->filters[ ] = array(
219 219
 				'column' => $column,
220 220
 				'operator' => $operator,
221 221
 				'value' => $value,
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
 	 */
232 232
 	public function add_filters( $filters ) {
233 233
 		foreach ( $filters as $filter ) {
234
-			$column = (isset( $filter['column'] )) ? $filter['column'] : false;
235
-			$operator = (isset( $filter['operator'] )) ? $filter['operator'] : false;
236
-			$value = (isset( $filter['value'] )) ? $filter['value'] : false;
234
+			$column = ( isset( $filter[ 'column' ] ) ) ? $filter[ 'column' ] : false;
235
+			$operator = ( isset( $filter[ 'operator' ] ) ) ? $filter[ 'operator' ] : false;
236
+			$value = ( isset( $filter[ 'value' ] ) ) ? $filter[ 'value' ] : false;
237 237
 			$this->add_filter( $column, $operator, $value );
238 238
 		}
239 239
 	}
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 			// Add an empty default filter to start with.
251 251
 			$title_col = $this->get_title_column();
252 252
 			$first_filter = ( $title_col ) ? $title_col->get_name() : '';
253
-			$out[] = array(
253
+			$out[ ] = array(
254 254
 				'column' => $first_filter,
255 255
 				'operator' => 'like',
256 256
 				'value' => '',
@@ -286,49 +286,49 @@  discard block
 block discarded – undo
286 286
 		$where_clause = '';
287 287
 		$join_clause = '';
288 288
 		foreach ( $this->filters as $filter_idx => $filter ) {
289
-			$f_column = $filter['column'];
290
-			$param_name = $filter['column'] . $param_num;
289
+			$f_column = $filter[ 'column' ];
290
+			$param_name = $filter[ 'column' ] . $param_num;
291 291
 
292 292
 			// Filters on foreign keys need to work on the FKs title column.
293 293
 			$column = $this->columns[ $f_column ];
294
-			if ( $column->is_foreign_key() && ! $filter['force'] ) {
294
+			if ( $column->is_foreign_key() && ! $filter[ 'force' ] ) {
295 295
 				$join = $this->join_on( $column );
296
-				$f_column = $join['column_alias'];
297
-				$join_clause .= $join['join_clause'];
296
+				$f_column = $join[ 'column_alias' ];
297
+				$join_clause .= $join[ 'join_clause' ];
298 298
 			} else {
299 299
 				// The result of join_on() above is quoted, so this must also be.
300 300
 				$f_column = "`" . $this->get_name() . "`.`$f_column`";
301 301
 			}
302 302
 
303
-			if ( 'like' === $filter['operator'] || 'not like' === $filter['operator'] ) {
303
+			if ( 'like' === $filter[ 'operator' ] || 'not like' === $filter[ 'operator' ] ) {
304 304
 				// LIKE or NOT LIKE.
305
-				$where_clause .= " AND CONVERT($f_column, CHAR) " . strtoupper( $filter['operator'] ) . " %s ";
306
-				$params[ $param_name ] = '%' . trim( $filter['value'] ) . '%';
307
-			} elseif ( '=' === $filter['operator'] || '!=' === $filter['operator'] ) {
305
+				$where_clause .= " AND CONVERT($f_column, CHAR) " . strtoupper( $filter[ 'operator' ] ) . " %s ";
306
+				$params[ $param_name ] = '%' . trim( $filter[ 'value' ] ) . '%';
307
+			} elseif ( '=' === $filter[ 'operator' ] || '!=' === $filter[ 'operator' ] ) {
308 308
 				// Equals or does-not-equal.
309
-				$where_clause .= " AND $f_column " . $filter['operator'] . " %s ";
310
-				$params[ $param_name ] = trim( $filter['value'] );
311
-			} elseif ( 'empty' === $filter['operator'] ) {
309
+				$where_clause .= " AND $f_column " . $filter[ 'operator' ] . " %s ";
310
+				$params[ $param_name ] = trim( $filter[ 'value' ] );
311
+			} elseif ( 'empty' === $filter[ 'operator' ] ) {
312 312
 				// IS EMPTY.
313 313
 				$where_clause .= " AND ($f_column IS NULL OR $f_column = '')";
314
-			} elseif ( 'not empty' === $filter['operator'] ) {
314
+			} elseif ( 'not empty' === $filter[ 'operator' ] ) {
315 315
 				// IS NOT EMPTY.
316 316
 				$where_clause .= " AND ($f_column IS NOT NULL AND $f_column != '')";
317
-			} elseif ( 'in' === $filter['operator'] || 'not in' === $filter['operator'] ) {
317
+			} elseif ( 'in' === $filter[ 'operator' ] || 'not in' === $filter[ 'operator' ] ) {
318 318
 				// IN or NOT IN.
319 319
 				$placeholders = array();
320
-				foreach ( Util::split_newline( $filter['value'] ) as $vid => $val ) {
321
-					$placeholders[] = "%s";
320
+				foreach ( Util::split_newline( $filter[ 'value' ] ) as $vid => $val ) {
321
+					$placeholders[ ] = "%s";
322 322
 					$params[ $param_name . '_' . $vid ] = $val;
323 323
 					// Save the separated filter values for later.
324
-					$this->filters[ $filter_idx ]['values'][] = $val;
324
+					$this->filters[ $filter_idx ][ 'values' ][ ] = $val;
325 325
 				}
326
-				$negate = ( 'not in' === $filter['operator'] ) ? 'NOT' : '';
326
+				$negate = ( 'not in' === $filter[ 'operator' ] ) ? 'NOT' : '';
327 327
 				$where_clause .= " AND ($f_column $negate IN (" . join( ", ", $placeholders ) . "))";
328 328
 			} else {
329 329
 				// Other operators. They're already validated in self::addFilter().
330
-				$where_clause .= " AND ($f_column " . $filter['operator'] . " %s)";
331
-				$params[ $param_name ] = trim( $filter['value'] );
330
+				$where_clause .= " AND ($f_column " . $filter[ 'operator' ] . " %s)";
331
+				$params[ $param_name ] = trim( $filter[ 'value' ] );
332 332
 			} // End if().
333 333
 
334 334
 			$param_num++;
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 			$order_by = $this->get_column( $this->get_order_by() );
445 445
 			if ( $order_by ) {
446 446
 				$order_by_join = $this->join_on( $order_by );
447
-				$sql .= $order_by_join['join_clause'] . ' ORDER BY ' . $order_by_join['column_alias'] . ' ' . $this->get_order_dir();
447
+				$sql .= $order_by_join[ 'join_clause' ] . ' ORDER BY ' . $order_by_join[ 'column_alias' ] . ' ' . $this->get_order_dir();
448 448
 			}
449 449
 		}
450 450
 
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 			$records_per_page = $this->get_records_per_page();
456 456
 			$sql .= ' LIMIT ' . $records_per_page;
457 457
 			if ( $this->page() > 1 ) {
458
-				$sql .= ' OFFSET ' . ($records_per_page * ($this->get_current_page_num() - 1));
458
+				$sql .= ' OFFSET ' . ( $records_per_page * ( $this->get_current_page_num() - 1 ) );
459 459
 			}
460 460
 		}
461 461
 
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 
468 468
 		$records = array();
469 469
 		foreach ( $rows as $row ) {
470
-			$records[] = new Record( $this, $row );
470
+			$records[ ] = new Record( $this, $row );
471 471
 		}
472 472
 
473 473
 		if ( $save_sql ) {
@@ -536,9 +536,9 @@  discard block
 block discarded – undo
536 536
 		$table_name = $this->get_name();
537 537
 		foreach ( $this->get_columns() as $col_name => $col ) {
538 538
 			if ( 'point' === $col->get_type() ) {
539
-				$select[] = "AsText(`$table_name`.`$col_name`) AS `$col_name`";
539
+				$select[ ] = "AsText(`$table_name`.`$col_name`) AS `$col_name`";
540 540
 			} else {
541
-				$select[] = "`$table_name`.`$col_name`";
541
+				$select[ ] = "`$table_name`.`$col_name`";
542 542
 			}
543 543
 		}
544 544
 		return join( ', ', $select );
@@ -705,17 +705,17 @@  discard block
 block discarded – undo
705 705
 		foreach ( $this->columns as $col_name => $col ) {
706 706
 			if ( $col->is_foreign_key() ) {
707 707
 				$col_join = $this->join_on( $col );
708
-				$column_name = $col_join['column_alias'];
709
-				$join_clause .= $col_join['join_clause'];
708
+				$column_name = $col_join[ 'column_alias' ];
709
+				$join_clause .= $col_join[ 'join_clause' ];
710 710
 			} elseif ( 'point' === $col->get_type() ) {
711
-				$columns[] = "IF(`$this->name`.`$col_name` IS NOT NULL, AsText(`$this->name`.`$col_name`), '') AS `$col_name`";
711
+				$columns[ ] = "IF(`$this->name`.`$col_name` IS NOT NULL, AsText(`$this->name`.`$col_name`), '') AS `$col_name`";
712 712
 			} else {
713 713
 				$column_name = "`$this->name`.`$col_name`";
714 714
 			}
715 715
 			if ( 'point' !== $col->get_type() && isset( $column_name ) ) {
716
-				$columns[] = "REPLACE(IFNULL($column_name, ''),CONCAT(CHAR(13),CHAR(10)),CHAR(10))"; // 13 = \r and 10 = \n
716
+				$columns[ ] = "REPLACE(IFNULL($column_name, ''),CONCAT(CHAR(13),CHAR(10)),CHAR(10))"; // 13 = \r and 10 = \n
717 717
 			}
718
-			$column_headers[] = $col->get_title();
718
+			$column_headers[ ] = $col->get_title();
719 719
 		}
720 720
 
721 721
 		// Build basic SELECT statement.
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
 			$sql = $this->get_defining_sql();
858 858
 			$comment_pattern = '/.*\)(?:.*COMMENT[\w=]*\'(.*)\')?/si';
859 859
 			preg_match( $comment_pattern, $sql, $matches );
860
-			$this->comment = ( isset( $matches[1] ) ) ? $matches[1] : '';
860
+			$this->comment = ( isset( $matches[ 1 ] ) ) ? $matches[ 1 ] : '';
861 861
 			$this->comment = str_replace( "''", "'", $this->comment );
862 862
 		}
863 863
 		if ( empty( $this->comment ) && $this->is_view() ) {
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 		$cols = array();
876 876
 		foreach ( $this->get_columns() as $column ) {
877 877
 			if ( $column->is_unique() ) {
878
-				$cols[] = $column;
878
+				$cols[ ] = $column;
879 879
 			}
880 880
 		}
881 881
 		return $cols;
@@ -952,8 +952,8 @@  discard block
 block discarded – undo
952 952
 			$defining_sql = $this->get_defining_sql();
953 953
 			$fk_pattern = '|FOREIGN KEY \(`(.*?)`\) REFERENCES `(.*?)`|';
954 954
 			preg_match_all( $fk_pattern, $defining_sql, $matches );
955
-			if ( isset( $matches[1] ) && count( $matches[1] ) > 0 ) {
956
-				foreach ( array_combine( $matches[1], $matches[2] ) as $col_name => $tab_name ) {
955
+			if ( isset( $matches[ 1 ] ) && count( $matches[ 1 ] ) > 0 ) {
956
+				foreach ( array_combine( $matches[ 1 ], $matches[ 2 ] ) as $col_name => $tab_name ) {
957 957
 					$this->referenced_table_names[ $col_name ] = $tab_name;
958 958
 				}
959 959
 			}
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
 		$json = new Services_JSON();
1058 1058
 		$metadata = array();
1059 1059
 		foreach ( $this->get_columns() as $column ) {
1060
-			$metadata[] = array(
1060
+			$metadata[ ] = array(
1061 1061
 				'name' => $column->get_name(),
1062 1062
 			);
1063 1063
 		}
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 	 */
1126 1126
 	public function save_record( $data, $pk_value = null ) {
1127 1127
 		// Changeset only created here if not already in progress.
1128
-		$changeset_comment = isset( $data['changeset_comment'] ) ? $data['changeset_comment'] : null;
1128
+		$changeset_comment = isset( $data[ 'changeset_comment' ] ) ? $data[ 'changeset_comment' ] : null;
1129 1129
 		$change_tracker = new ChangeTracker( $this->get_database()->get_wpdb(), $changeset_comment );
1130 1130
 
1131 1131
 		$columns = $this->get_columns();
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 
1182 1182
 			} elseif ( $column->is_numeric() ) {
1183 1183
 				// Numeric values.
1184
-				$sql_values[ $field ] = (float) $value;
1184
+				$sql_values[ $field ] = ( float ) $value;
1185 1185
 
1186 1186
 			} else {
1187 1187
 				// Everything else.
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 		// Can probably be removed when https://core.trac.wordpress.org/ticket/15158 is resolved.
1200 1200
 		$set_items = array();
1201 1201
 		foreach ( $sql_values as $field => $escd_datum ) {
1202
-			$set_items[] = "`$field` = $escd_datum";
1202
+			$set_items[ ] = "`$field` = $escd_datum";
1203 1203
 		}
1204 1204
 		$set_clause = 'SET ' . join( ', ', $set_items );
1205 1205
 
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 			$where_clause = $this->database->get_wpdb()->prepare( "WHERE `$pk_name` = %s", $pk_value );
1220 1220
 			$sql = 'UPDATE ' . $this->get_name() . " $set_clause $where_clause";
1221 1221
 			$this->get_database()->query( $sql, null, 'Unable to update a record' );
1222
-			$new_pk_value = (isset( $data[ $pk_name ] ) ) ? $data[ $pk_name ] : $pk_value;
1222
+			$new_pk_value = ( isset( $data[ $pk_name ] ) ) ? $data[ $pk_name ] : $pk_value;
1223 1223
 
1224 1224
 		} else {
1225 1225
 			/*
Please login to merge, or discard this patch.