Completed
Pull Request — master (#677)
by Zack
06:49 queued 02:49
created
includes/widgets/search-widget/templates/search-field-checkbox.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,22 +10,22 @@
 block discarded – undo
10 10
 $search_field = $gravityview_view->search_field;
11 11
 
12 12
 // Make sure that there are choices to display
13
-if( empty( $search_field['choices'] ) ) {
14
-	do_action('gravityview_log_debug', 'search-field-checkbox.php - No choices for field' );
13
+if ( empty( $search_field[ 'choices' ] ) ) {
14
+	do_action( 'gravityview_log_debug', 'search-field-checkbox.php - No choices for field' );
15 15
 	return;
16 16
 }
17 17
 
18 18
 ?>
19 19
 <div class="gv-search-box">
20
-	<?php if( ! gv_empty( $search_field['label'], false ) ) { ?>
21
-	<label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label>
20
+	<?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?>
21
+	<label for=search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>><?php echo esc_html( $search_field[ 'label' ] ); ?></label>
22 22
 	<?php } ?>
23 23
 	<p>
24
-	<?php foreach( $search_field['choices'] as $choice ) { ?>
24
+	<?php foreach ( $search_field[ 'choices' ] as $choice ) { ?>
25 25
 
26
-		<label for="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" class="gv-check-radio">
27
-			<input type="checkbox" name="<?php echo esc_attr( $search_field['name'] ); ?>[]" value="<?php echo esc_attr( $choice['value'] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" <?php gv_selected( $choice['value'], $search_field['value'], true, 'checked' ); ?>>
28
-			<?php echo esc_html( $choice['text'] ); ?>
26
+		<label for="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" class="gv-check-radio">
27
+			<input type="checkbox" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>[]" value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" <?php gv_selected( $choice[ 'value' ], $search_field[ 'value' ], true, 'checked' ); ?>>
28
+			<?php echo esc_html( $choice[ 'text' ] ); ?>
29 29
 		</label>
30 30
 
31 31
 	<?php } ?>
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-input_text.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@
 block discarded – undo
11 11
 ?>
12 12
 
13 13
 <div class="gv-search-box">
14
-	<?php if( ! gv_empty( $search_field['label'], false ) ) { ?>
15
-	<label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label>
14
+	<?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?>
15
+	<label for=search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>><?php echo esc_html( $search_field[ 'label' ] ); ?></label>
16 16
 	<?php } ?>
17 17
 	<p>
18
-		<input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>">
18
+		<input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>">
19 19
 	</p>
20 20
 </div>
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-single_checkbox.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
12 12
 ?>
13 13
 
14 14
 <div class="gv-search-box">
15
-	<label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" class="gv-check-radio">
16
-		<input type="checkbox" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" <?php checked( '1', $search_field['value'], true ); ?>>
17
-			<?php if( ! gv_empty( $search_field['label'], false ) ) { echo esc_html(  $search_field['label'] ); } ?>
15
+	<label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" class="gv-check-radio">
16
+		<input type="checkbox" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" <?php checked( '1', $search_field[ 'value' ], true ); ?>>
17
+			<?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { echo esc_html( $search_field[ 'label' ] ); } ?>
18 18
 	</label>
19 19
 </div>
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/widget-search.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	do_action( 'gravityview_search_widget_fields_before', $this );
25 25
 
26
-	foreach( $this->search_fields as $search_field ) {
26
+	foreach ( $this->search_fields as $search_field ) {
27 27
 		$gravityview_view->search_field = $search_field;
28
-		$this->render( 'search-field', $search_field['input'], false );
28
+		$this->render( 'search-field', $search_field[ 'input' ], false );
29 29
 
30 30
 		// show/hide the search button if there are input type fields
31
-		if( !$has_inputs &&  $search_field['input'] != 'link' ) {
31
+		if ( ! $has_inputs && $search_field[ 'input' ] != 'link' ) {
32 32
 			$has_inputs = true;
33 33
 		}
34 34
 	}
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	do_action( 'gravityview_search_widget_fields_after', $this );
41 41
 
42
-	if( $has_inputs ) { ?>
42
+	if ( $has_inputs ) { ?>
43 43
 		<div class="gv-search-box gv-search-box-submit">
44 44
 			<?php
45 45
 
Please login to merge, or discard this patch.
includes/widgets/search-widget/class-search-widget.php 4 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -622,7 +622,7 @@
 block discarded – undo
622 622
 			'ymd_dot' => 'Y.m.d',
623 623
 		);
624 624
 
625
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
625
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
626 626
 			$format = $datepicker[ $field->dateFormat ];
627 627
 		}
628 628
 
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * The GravityView New Search widget
4
- *
5
- * @package   GravityView-DataTables-Ext
6
- * @license   GPL2+
7
- * @author    Katz Web Services, Inc.
8
- * @link      http://gravityview.co
9
- * @copyright Copyright 2014, Katz Web Services, Inc.
10
- */
3
+			 * The GravityView New Search widget
4
+			 *
5
+			 * @package   GravityView-DataTables-Ext
6
+			 * @license   GPL2+
7
+			 * @author    Katz Web Services, Inc.
8
+			 * @link      http://gravityview.co
9
+			 * @copyright Copyright 2014, Katz Web Services, Inc.
10
+			 */
11 11
 
12 12
 if ( ! defined( 'WPINC' ) ) {
13 13
 	die;
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
 		$curr_start = esc_attr( rgget( 'gv_start' ) );
386 386
 		$curr_end = esc_attr( rgget( 'gv_end' ) );
387 387
 
388
-        /**
389
-         * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n
390
-         * date_created is stored in UTC format. Convert search date into UTC (also used on templates/fields/date_created.php)
391
-         * @since 1.12
392
-         * @param[out,in] boolean $adjust_tz  Use timezone-adjusted datetime? If true, adjusts date based on blog's timezone setting. If false, uses UTC setting. Default: true
393
-         * @param[in] string $context Where the filter is being called from. `search` in this case.
394
-         */
395
-        $adjust_tz = apply_filters( 'gravityview_date_created_adjust_timezone', true, 'search' );
388
+		/**
389
+		 * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n
390
+		 * date_created is stored in UTC format. Convert search date into UTC (also used on templates/fields/date_created.php)
391
+		 * @since 1.12
392
+		 * @param[out,in] boolean $adjust_tz  Use timezone-adjusted datetime? If true, adjusts date based on blog's timezone setting. If false, uses UTC setting. Default: true
393
+		 * @param[in] string $context Where the filter is being called from. `search` in this case.
394
+		 */
395
+		$adjust_tz = apply_filters( 'gravityview_date_created_adjust_timezone', true, 'search' );
396 396
 
397 397
 
398 398
 		/**
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 				'type' => 'radio',
64 64
 				'full_width' => true,
65 65
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
66
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
66
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
67 67
 				'value' => 'any',
68 68
 				'class' => 'hide-if-js',
69 69
 				'options' => array(
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
149 149
 		$script_source = empty( $script_min ) ? '/source' : '';
150 150
 
151
-		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version );
151
+		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version );
152 152
 
153 153
 
154 154
 		/**
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * Add admin script to the whitelist
201 201
 	 */
202 202
 	public function register_no_conflict( $required ) {
203
-		$required[] = 'gravityview_searchwidget_admin';
203
+		$required[ ] = 'gravityview_searchwidget_admin';
204 204
 		return $required;
205 205
 	}
206 206
 
@@ -213,24 +213,24 @@  discard block
 block discarded – undo
213 213
 	 */
214 214
 	public static function get_searchable_fields() {
215 215
 
216
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
216
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
217 217
 			exit( '0' );
218 218
 		}
219 219
 
220 220
 		$form = '';
221 221
 
222 222
 		// Fetch the form for the current View
223
-		if ( ! empty( $_POST['view_id'] ) ) {
223
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
224 224
 
225
-			$form = gravityview_get_form_id( $_POST['view_id'] );
225
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
226 226
 
227
-		} elseif ( ! empty( $_POST['formid'] ) ) {
227
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
228 228
 
229
-			$form = (int) $_POST['formid'];
229
+			$form = (int)$_POST[ 'formid' ];
230 230
 
231
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
231
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
232 232
 
233
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
233
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
234 234
 
235 235
 		}
236 236
 
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 			)
279 279
 		);
280 280
 
281
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
282
-			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] );
281
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
282
+			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] );
283 283
 		}
284 284
 
285 285
 		if ( ! empty( $fields ) ) {
@@ -288,13 +288,13 @@  discard block
 block discarded – undo
288 288
 
289 289
 			foreach ( $fields as $id => $field ) {
290 290
 
291
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
291
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
292 292
 					continue;
293 293
 				}
294 294
 
295
-				$types = self::get_search_input_types( $id, $field['type'] );
295
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
296 296
 
297
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
297
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
298 298
 			}
299 299
 		}
300 300
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	public static function get_search_input_types( $id = '', $field_type = null ) {
317 317
 
318 318
 		// @todo - This needs to be improved - many fields have . including products and addresses
319
-		if ( false !== strpos( (string) $id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) {
319
+		if ( false !== strpos( (string)$id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) {
320 320
 			$input_type = 'boolean'; // on/off checkbox
321 321
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
322 322
 			$input_type = 'multi'; //multiselect
@@ -358,19 +358,19 @@  discard block
 block discarded – undo
358 358
 			$post_id = 0;
359 359
 
360 360
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
361
-			if ( ! empty( $widget_args['post_id'] ) ) {
362
-				$post_id = absint( $widget_args['post_id'] );
361
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
362
+				$post_id = absint( $widget_args[ 'post_id' ] );
363 363
 			}
364 364
 			// We're in the WordPress Widget context, and the base View ID should be used
365
-			else if ( ! empty( $widget_args['view_id'] ) ) {
366
-				$post_id = absint( $widget_args['view_id'] );
365
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
366
+				$post_id = absint( $widget_args[ 'view_id' ] );
367 367
 			}
368 368
 
369 369
 			$args = gravityview_get_permalink_query_args( $post_id );
370 370
 
371 371
 			// Add hidden fields to the search form
372 372
 			foreach ( $args as $key => $value ) {
373
-				$search_fields[] = array(
373
+				$search_fields[ ] = array(
374 374
 					'name'  => $key,
375 375
 					'input' => 'hidden',
376 376
 					'value' => $value,
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	 */
392 392
 	public function filter_entries( $search_criteria ) {
393 393
 
394
-		if( 'post' === $this->search_method ) {
394
+		if ( 'post' === $this->search_method ) {
395 395
 			$get = $_POST;
396 396
 		} else {
397 397
 			$get = $_GET;
@@ -408,15 +408,15 @@  discard block
 block discarded – undo
408 408
 		$get = gv_map_deep( $get, 'urldecode' );
409 409
 
410 410
 		// add free search
411
-		if ( ! empty( $get['gv_search'] ) ) {
411
+		if ( ! empty( $get[ 'gv_search' ] ) ) {
412 412
 
413 413
 			// Search for a piece
414
-			$words = explode( ' ', $get['gv_search'] );
414
+			$words = explode( ' ', $get[ 'gv_search' ] );
415 415
 
416 416
 			$words = array_filter( $words );
417 417
 
418 418
 			foreach ( $words as $word ) {
419
-				$search_criteria['field_filters'][] = array(
419
+				$search_criteria[ 'field_filters' ][ ] = array(
420 420
 					'key' => null, // The field ID to search
421 421
 					'value' => $word, // The value to search
422 422
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
 		}
426 426
 
427 427
 		//start date & end date
428
-		$curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : '';
429
-		$curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : '';
428
+		$curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '';
429
+		$curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : '';
430 430
 
431 431
         /**
432 432
          * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n
@@ -441,16 +441,16 @@  discard block
 block discarded – undo
441 441
 		/**
442 442
 		 * Don't set $search_criteria['start_date'] if start_date is empty as it may lead to bad query results (GFAPI::get_entries)
443 443
 		 */
444
-		if( !empty( $curr_start ) ) {
445
-			$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
444
+		if ( ! empty( $curr_start ) ) {
445
+			$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
446 446
 		}
447
-		if( !empty( $curr_end ) ) {
448
-			$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
447
+		if ( ! empty( $curr_end ) ) {
448
+			$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
449 449
 		}
450 450
 
451 451
 		// search for a specific entry ID
452 452
 		if ( ! empty( $get[ 'gv_id' ] ) ) {
453
-			$search_criteria['field_filters'][] = array(
453
+			$search_criteria[ 'field_filters' ][ ] = array(
454 454
 				'key' => 'id',
455 455
 				'value' => absint( $get[ 'gv_id' ] ),
456 456
 				'operator' => '=',
@@ -459,36 +459,36 @@  discard block
 block discarded – undo
459 459
 
460 460
 		// search for a specific Created_by ID
461 461
 		if ( ! empty( $get[ 'gv_by' ] ) ) {
462
-			$search_criteria['field_filters'][] = array(
462
+			$search_criteria[ 'field_filters' ][ ] = array(
463 463
 				'key' => 'created_by',
464
-				'value' => absint( $get['gv_by'] ),
464
+				'value' => absint( $get[ 'gv_by' ] ),
465 465
 				'operator' => '=',
466 466
 			);
467 467
 		}
468 468
 
469 469
 
470 470
 		// Get search mode passed in URL
471
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
471
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
472 472
 
473 473
 		// get the other search filters
474 474
 		foreach ( $get as $key => $value ) {
475 475
 
476
-			if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[0] ) ) ) {
476
+			if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[ 0 ] ) ) ) {
477 477
 				continue;
478 478
 			}
479 479
 
480 480
 			// could return simple filter or multiple filters
481 481
 			$filter = $this->prepare_field_filter( $key, $value );
482 482
 
483
-			if ( isset( $filter[0]['value'] ) ) {
484
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
483
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
484
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
485 485
 
486 486
 				// if date range type, set search mode to ALL
487
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
487
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
488 488
 					$mode = 'all';
489 489
 				}
490
-			} elseif( !empty( $filter ) ) {
491
-				$search_criteria['field_filters'][] = $filter;
490
+			} elseif ( ! empty( $filter ) ) {
491
+				$search_criteria[ 'field_filters' ][ ] = $filter;
492 492
 			}
493 493
 		}
494 494
 
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 		 * @since 1.5.1
498 498
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
499 499
 		 */
500
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
500
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
501 501
 
502 502
 		do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria );
503 503
 
@@ -535,11 +535,11 @@  discard block
 block discarded – undo
535 535
 			'value' => $value,
536 536
 		);
537 537
 
538
-		switch ( $form_field['type'] ) {
538
+		switch ( $form_field[ 'type' ] ) {
539 539
 
540 540
 			case 'select':
541 541
 			case 'radio':
542
-				$filter['operator'] = 'is';
542
+				$filter[ 'operator' ] = 'is';
543 543
 				break;
544 544
 
545 545
 			case 'post_category':
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 
554 554
 				foreach ( $value as $val ) {
555 555
 					$cat = get_term( $val, 'category' );
556
-					$filter[] = array(
556
+					$filter[ ] = array(
557 557
 						'key' => $field_id,
558 558
 						'value' => esc_attr( $cat->name ) . ':' . $val,
559 559
 						'operator' => 'is',
@@ -572,18 +572,18 @@  discard block
 block discarded – undo
572 572
 				$filter = array();
573 573
 
574 574
 				foreach ( $value as $val ) {
575
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
575
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
576 576
 				}
577 577
 
578 578
 				break;
579 579
 
580 580
 			case 'checkbox':
581 581
 				// convert checkbox on/off into the correct search filter
582
-				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) {
583
-					foreach ( $form_field['inputs'] as $k => $input ) {
584
-						if ( $input['id'] == $field_id ) {
585
-							$filter['value'] = $form_field['choices'][ $k ]['value'];
586
-							$filter['operator'] = 'is';
582
+				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) {
583
+					foreach ( $form_field[ 'inputs' ] as $k => $input ) {
584
+						if ( $input[ 'id' ] == $field_id ) {
585
+							$filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ];
586
+							$filter[ 'operator' ] = 'is';
587 587
 							break;
588 588
 						}
589 589
 					}
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 					$filter = array();
594 594
 
595 595
 					foreach ( $value as $val ) {
596
-						$filter[] = array(
596
+						$filter[ ] = array(
597 597
 								'key'   => $field_id,
598 598
 								'value' => $val,
599 599
 								'operator' => 'is',
@@ -614,9 +614,9 @@  discard block
 block discarded – undo
614 614
 					foreach ( $words as $word ) {
615 615
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
616 616
 							// Keep the same key for each filter
617
-							$filter['value'] = $word;
617
+							$filter[ 'value' ] = $word;
618 618
 							// Add a search for the value
619
-							$filters[] = $filter;
619
+							$filters[ ] = $filter;
620 620
 						}
621 621
 					}
622 622
 
@@ -643,19 +643,19 @@  discard block
 block discarded – undo
643 643
 						 * @since 1.16.3
644 644
 						 * Safeguard until GF implements '<=' operator
645 645
 						 */
646
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
646
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
647 647
 							$operator = '<';
648 648
 							$date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) );
649 649
 						}
650 650
 
651
-						$filter[] = array(
651
+						$filter[ ] = array(
652 652
 							'key' => $field_id,
653 653
 							'value' => self::get_formatted_date( $date, 'Y-m-d' ),
654 654
 							'operator' => $operator,
655 655
 						);
656 656
 					}
657 657
 				} else {
658
-					$filter['value'] = self::get_formatted_date( $value, 'Y-m-d' );
658
+					$filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' );
659 659
 				}
660 660
 
661 661
 				break;
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 			'ymd_dot' => 'Y.m.d',
687 687
 		);
688 688
 
689
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
689
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
690 690
 			$format = $datepicker[ $field->dateFormat ];
691 691
 		}
692 692
 
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 	public function add_template_path( $file_paths ) {
718 718
 
719 719
 		// Index 100 is the default GravityView template path.
720
-		$file_paths[102] = self::$file . 'templates/';
720
+		$file_paths[ 102 ] = self::$file . 'templates/';
721 721
 
722 722
 		return $file_paths;
723 723
 	}
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 		}
740 740
 
741 741
 		// get configured search fields
742
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
742
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
743 743
 
744 744
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
745 745
 			do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args );
@@ -753,24 +753,24 @@  discard block
 block discarded – undo
753 753
 
754 754
 			$updated_field = $field;
755 755
 
756
-			if ( in_array( $field['input'], array( 'date', 'date_range' ) ) ) {
756
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range' ) ) ) {
757 757
 				$has_date = true;
758 758
 			}
759 759
 
760 760
 			$updated_field = $this->get_search_filter_details( $updated_field );
761 761
 
762
-			switch ( $field['field'] ) {
762
+			switch ( $field[ 'field' ] ) {
763 763
 
764 764
 				case 'search_all':
765
-					$updated_field['key'] = 'search_all';
766
-					$updated_field['input'] = 'search_all';
767
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
765
+					$updated_field[ 'key' ] = 'search_all';
766
+					$updated_field[ 'input' ] = 'search_all';
767
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
768 768
 					break;
769 769
 
770 770
 				case 'entry_date':
771
-					$updated_field['key'] = 'entry_date';
772
-					$updated_field['input'] = 'entry_date';
773
-					$updated_field['value'] = array(
771
+					$updated_field[ 'key' ] = 'entry_date';
772
+					$updated_field[ 'input' ] = 'entry_date';
773
+					$updated_field[ 'value' ] = array(
774 774
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
775 775
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
776 776
 					);
@@ -778,16 +778,16 @@  discard block
 block discarded – undo
778 778
 					break;
779 779
 
780 780
 				case 'entry_id':
781
-					$updated_field['key'] = 'entry_id';
782
-					$updated_field['input'] = 'entry_id';
783
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
781
+					$updated_field[ 'key' ] = 'entry_id';
782
+					$updated_field[ 'input' ] = 'entry_id';
783
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
784 784
 					break;
785 785
 
786 786
 				case 'created_by':
787
-					$updated_field['key'] = 'created_by';
788
-					$updated_field['name'] = 'gv_by';
789
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
790
-					$updated_field['choices'] = self::get_created_by_choices();
787
+					$updated_field[ 'key' ] = 'created_by';
788
+					$updated_field[ 'name' ] = 'gv_by';
789
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
790
+					$updated_field[ 'choices' ] = self::get_created_by_choices();
791 791
 					break;
792 792
 			}
793 793
 
@@ -805,16 +805,16 @@  discard block
 block discarded – undo
805 805
 		 */
806 806
 		$gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args );
807 807
 
808
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
808
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
809 809
 
810 810
 		/** @since 1.14 */
811
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
811
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
812 812
 
813
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
813
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
814 814
 
815 815
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
816 816
 
817
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
817
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
818 818
 
819 819
 		if ( $has_date ) {
820 820
 			// enqueue datepicker stuff only if needed!
@@ -834,10 +834,10 @@  discard block
 block discarded – undo
834 834
 	public static function get_search_class( $custom_class = '' ) {
835 835
 		$gravityview_view = GravityView_View::getInstance();
836 836
 
837
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
837
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
838 838
 
839
-		if ( ! empty( $custom_class )  ) {
840
-			$search_class .= ' '.$custom_class;
839
+		if ( ! empty( $custom_class ) ) {
840
+			$search_class .= ' ' . $custom_class;
841 841
 		}
842 842
 
843 843
 		/**
@@ -880,11 +880,11 @@  discard block
 block discarded – undo
880 880
 
881 881
 		$label = rgget( 'label', $field );
882 882
 
883
-		if( '' === $label ) {
883
+		if ( '' === $label ) {
884 884
 
885
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
885
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
886 886
 
887
-			switch( $field['field'] ) {
887
+			switch ( $field[ 'field' ] ) {
888 888
 				case 'search_all':
889 889
 					$label = __( 'Search Entries:', 'gravityview' );
890 890
 					break;
@@ -902,10 +902,10 @@  discard block
 block discarded – undo
902 902
 					break;
903 903
 				default:
904 904
 					// If this is a field input, not a field
905
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
905
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
906 906
 
907 907
 						// Get the label for the field in question, which returns an array
908
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
908
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
909 909
 
910 910
 						// Get the item with the `label` key
911 911
 						$values = wp_list_pluck( $items, 'label' );
@@ -942,32 +942,32 @@  discard block
 block discarded – undo
942 942
 		$form = $gravityview_view->getForm();
943 943
 
944 944
 		// for advanced field ids (eg, first name / last name )
945
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
945
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
946 946
 
947 947
 		// get searched value from $_GET/$_POST (string or array)
948 948
 		$value = $this->rgget_or_rgpost( $name );
949 949
 
950 950
 		// get form field details
951
-		$form_field = gravityview_get_field( $form, $field['field'] );
951
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
952 952
 
953 953
 		$filter = array(
954
-			'key' => $field['field'],
954
+			'key' => $field[ 'field' ],
955 955
 			'name' => $name,
956 956
 			'label' => self::get_field_label( $field, $form_field ),
957
-			'input' => $field['input'],
957
+			'input' => $field[ 'input' ],
958 958
 			'value' => $value,
959
-			'type' => $form_field['type'],
959
+			'type' => $form_field[ 'type' ],
960 960
 		);
961 961
 
962 962
 		// collect choices
963
-		if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
964
-			$filter['choices'] = gravityview_get_terms_choices();
965
-		} elseif ( ! empty( $form_field['choices'] ) ) {
966
-			$filter['choices'] = $form_field['choices'];
963
+		if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
964
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
965
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
966
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
967 967
 		}
968 968
 
969
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
970
-			$filter['value'] = array( 'start' => '', 'end' => '' );
969
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
970
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
971 971
 		}
972 972
 
973 973
 		return $filter;
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 
992 992
 		$choices = array();
993 993
 		foreach ( $users as $user ) {
994
-			$choices[] = array(
994
+			$choices[ ] = array(
995 995
 				'value' => $user->ID,
996 996
 				'text' => $user->display_name,
997 997
 			);
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
 	 */
1046 1046
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1047 1047
 
1048
-		$js_dependencies[] = 'jquery-ui-datepicker';
1048
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1049 1049
 
1050 1050
 		return $js_dependencies;
1051 1051
 	}
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
 			'isRTL'             => is_rtl(),
1090 1090
 		), $view_data );
1091 1091
 
1092
-		$localizations['datepicker'] = $datepicker_settings;
1092
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1093 1093
 
1094 1094
 		return $localizations;
1095 1095
 
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1113 1113
 
1114 1114
 		$scheme = is_ssl() ? 'https://' : 'http://';
1115
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1115
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1116 1116
 
1117 1117
 		/**
1118 1118
 		 * @filter `gravityview_search_datepicker_class`
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
 	/**
874 874
 	 * Get the label for a search form field
875 875
 	 * @param  array $field      Field setting as sent by the GV configuration - has `field`, `input` (input type), and `label` keys
876
-	 * @param  array $form_field Form field data, as fetched by `gravityview_get_field()`
876
+	 * @param  GF_Field|null $form_field Form field data, as fetched by `gravityview_get_field()`
877 877
 	 * @return string             Label for the search form
878 878
 	 */
879 879
 	private static function get_field_label( $field, $form_field = array() ) {
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
 	/**
1054 1054
 	 * Modify the array passed to wp_localize_script()
1055 1055
 	 *
1056
-	 * @param array $js_localization The data padded to the Javascript file
1056
+	 * @param array $localizations The data padded to the Javascript file
1057 1057
 	 * @param array $view_data View data array with View settings
1058 1058
 	 *
1059 1059
 	 * @return array
Please login to merge, or discard this patch.
includes/widgets/class-gravityview-widget-custom-content.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 	function __construct() {
19 19
 
20
-		$this->widget_description = __('Insert custom text or HTML as a widget', 'gravityview' );
20
+		$this->widget_description = __( 'Insert custom text or HTML as a widget', 'gravityview' );
21 21
 
22 22
 		$default_values = array(
23 23
 			'header' => 1,
@@ -42,39 +42,39 @@  discard block
 block discarded – undo
42 42
 			),
43 43
 		);
44 44
 
45
-		parent::__construct( __( 'Custom Content', 'gravityview' ) , 'custom_content', $default_values, $settings );
45
+		parent::__construct( __( 'Custom Content', 'gravityview' ), 'custom_content', $default_values, $settings );
46 46
 	}
47 47
 
48
-	public function render_frontend( $widget_args, $content = '', $context = '') {
48
+	public function render_frontend( $widget_args, $content = '', $context = '' ) {
49 49
 
50
-		if( !$this->pre_render_frontend() ) {
50
+		if ( ! $this->pre_render_frontend() ) {
51 51
 			return;
52 52
 		}
53 53
 
54
-		if( !empty( $widget_args['title'] ) ) {
55
-			echo $widget_args['title'];
54
+		if ( ! empty( $widget_args[ 'title' ] ) ) {
55
+			echo $widget_args[ 'title' ];
56 56
 		}
57 57
 
58 58
 
59 59
 		// Make sure the class is loaded in DataTables
60
-		if( !class_exists( 'GFFormDisplay' ) ) {
60
+		if ( ! class_exists( 'GFFormDisplay' ) ) {
61 61
 			include_once( GFCommon::get_base_path() . '/form_display.php' );
62 62
 		}
63 63
 
64
-		$widget_args['content'] = trim( rtrim( $widget_args['content'] ) );
64
+		$widget_args[ 'content' ] = trim( rtrim( $widget_args[ 'content' ] ) );
65 65
 
66 66
 		// No custom content
67
-		if( empty( $widget_args['content'] ) ) {
68
-			do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: No content.', get_class($this)) );
67
+		if ( empty( $widget_args[ 'content' ] ) ) {
68
+			do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend]: No content.', get_class( $this ) ) );
69 69
 			return;
70 70
 		}
71 71
 
72 72
 		// Add paragraphs?
73
-		if( !empty( $widget_args['wpautop'] ) ) {
74
-			$widget_args['content'] = wpautop( $widget_args['content'] );
73
+		if ( ! empty( $widget_args[ 'wpautop' ] ) ) {
74
+			$widget_args[ 'content' ] = wpautop( $widget_args[ 'content' ] );
75 75
 		}
76 76
 
77
-		$content = $widget_args['content'];
77
+		$content = $widget_args[ 'content' ];
78 78
 
79 79
 		$content = GravityView_Merge_Tags::replace_variables( $content );
80 80
 
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
 
85 85
 
86 86
 		// Add custom class
87
-		$class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
87
+		$class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
88 88
 		$class = gravityview_sanitize_html_class( $class );
89 89
 
90
-		echo '<div class="gv-widget-custom-content '.$class.'">'. $content .'</div>';
90
+		echo '<div class="gv-widget-custom-content ' . $class . '">' . $content . '</div>';
91 91
 
92 92
 	}
93 93
 
Please login to merge, or discard this patch.
includes/widgets/class-gravityview-widget-pagination-info.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 	function __construct() {
18 18
 
19
-		$this->widget_description = __('Summary of the number of visible entries out of the total results.', 'gravityview' );
19
+		$this->widget_description = __( 'Summary of the number of visible entries out of the total results.', 'gravityview' );
20 20
 
21 21
 		$default_values = array(
22 22
 			'header' => 1,
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
 
26 26
 		$settings = array();
27 27
 
28
-		parent::__construct( __( 'Show Pagination Info', 'gravityview' ) , 'page_info', $default_values, $settings );
28
+		parent::__construct( __( 'Show Pagination Info', 'gravityview' ), 'page_info', $default_values, $settings );
29 29
 	}
30 30
 
31
-	public function render_frontend( $widget_args, $content = '', $context = '') {
31
+	public function render_frontend( $widget_args, $content = '', $context = '' ) {
32 32
 		$gravityview_view = GravityView_View::getInstance();
33 33
 
34
-		if( !$this->pre_render_frontend() ) {
34
+		if ( ! $this->pre_render_frontend() ) {
35 35
 			return;
36 36
 		}
37 37
 
38
-		if( !empty( $widget_args['title'] ) ) {
39
-			echo $widget_args['title'];
38
+		if ( ! empty( $widget_args[ 'title' ] ) ) {
39
+			echo $widget_args[ 'title' ];
40 40
 		}
41 41
 
42 42
 		$pagination_counts = $gravityview_view->getPaginationCounts();
@@ -45,16 +45,16 @@  discard block
 block discarded – undo
45 45
 
46 46
 		$output = '';
47 47
 
48
-		if( ! empty( $pagination_counts ) ) {
48
+		if ( ! empty( $pagination_counts ) ) {
49 49
 
50
-			$first = $pagination_counts['first'];
51
-			$last = $pagination_counts['last'];
52
-			$total = $pagination_counts['total'];
50
+			$first = $pagination_counts[ 'first' ];
51
+			$last = $pagination_counts[ 'last' ];
52
+			$total = $pagination_counts[ 'total' ];
53 53
 
54
-			$class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
54
+			$class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
55 55
 			$class = gravityview_sanitize_html_class( $class );
56 56
 
57
-			$output = '<div class="gv-widget-pagination '.$class.'"><p>'. sprintf(__( 'Displaying %1$s - %2$s of %3$s', 'gravityview' ), number_format_i18n( $first ), number_format_i18n( $last ), number_format_i18n( $total ) ) . '</p></div>';
57
+			$output = '<div class="gv-widget-pagination ' . $class . '"><p>' . sprintf( __( 'Displaying %1$s - %2$s of %3$s', 'gravityview' ), number_format_i18n( $first ), number_format_i18n( $last ), number_format_i18n( $total ) ) . '</p></div>';
58 58
 		}
59 59
 
60 60
 		/**
Please login to merge, or discard this patch.
includes/widgets/class-gravityview-widget-page-links.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -11,38 +11,38 @@  discard block
 block discarded – undo
11 11
 
12 12
 	function __construct() {
13 13
 
14
-		$this->widget_description = __('Links to multiple pages of results.', 'gravityview' );
14
+		$this->widget_description = __( 'Links to multiple pages of results.', 'gravityview' );
15 15
 
16 16
 		$default_values = array( 'header' => 1, 'footer' => 1 );
17 17
 		$settings = array( 'show_all' => array(
18 18
 			'type' => 'checkbox',
19 19
 			'label' => __( 'Show each page number', 'gravityview' ),
20
-			'desc' => __('Show every page number instead of summary (eg: 1 2 3 ... 8 »)', 'gravityview'),
20
+			'desc' => __( 'Show every page number instead of summary (eg: 1 2 3 ... 8 »)', 'gravityview' ),
21 21
 			'value' => false
22
-		));
23
-		parent::__construct( __( 'Page Links', 'gravityview' ) , 'page_links', $default_values, $settings );
22
+		) );
23
+		parent::__construct( __( 'Page Links', 'gravityview' ), 'page_links', $default_values, $settings );
24 24
 
25 25
 	}
26 26
 
27
-	public function render_frontend( $widget_args, $content = '', $context = '') {
27
+	public function render_frontend( $widget_args, $content = '', $context = '' ) {
28 28
 		$gravityview_view = GravityView_View::getInstance();
29 29
 
30
-		if( !$this->pre_render_frontend() ) {
30
+		if ( ! $this->pre_render_frontend() ) {
31 31
 			return;
32 32
 		}
33 33
 
34
-		$page_size = $gravityview_view->paging['page_size'];
34
+		$page_size = $gravityview_view->paging[ 'page_size' ];
35 35
 		$total = $gravityview_view->total_entries;
36 36
 
37 37
 		$atts = shortcode_atts( array(
38
-			'show_all' => !empty( $this->settings['show_all']['default'] ),
38
+			'show_all' => ! empty( $this->settings[ 'show_all' ][ 'default' ] ),
39 39
 		), $widget_args, 'gravityview_widget_page_links' );
40 40
 
41 41
 		// displaying info
42
-		$curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] );
42
+		$curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] );
43 43
 
44 44
 		$page_link_args = array(
45
-			'base' => add_query_arg('pagenum','%#%', gv_directory_link() ),
45
+			'base' => add_query_arg( 'pagenum', '%#%', gv_directory_link() ),
46 46
 			'format' => '&pagenum=%#%',
47 47
 			'add_args' => array(), //
48 48
 			'prev_text' => '&laquo;',
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			'mid_size' => 2,
53 53
 			'total' => empty( $page_size ) ? 0 : ceil( $total / $page_size ),
54 54
 			'current' => $curr_page,
55
-			'show_all' => !empty( $atts['show_all'] ), // to be available at backoffice
55
+			'show_all' => ! empty( $atts[ 'show_all' ] ), // to be available at backoffice
56 56
 		);
57 57
 
58 58
 		/**
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 		 * @since 1.1.4
61 61
 		 * @param array  $page_link_args Array of arguments for the `paginate_links()` function. [Read more about `paginate_links()`](http://developer.wordpress.org/reference/functions/paginate_links/)
62 62
 		 */
63
-		$page_link_args = apply_filters('gravityview_page_links_args', $page_link_args );
63
+		$page_link_args = apply_filters( 'gravityview_page_links_args', $page_link_args );
64 64
 
65 65
 		$page_links = paginate_links( $page_link_args );
66 66
 
67
-		if( !empty( $page_links )) {
68
-			$class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
67
+		if ( ! empty( $page_links ) ) {
68
+			$class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
69 69
 			$class = gravityview_sanitize_html_class( $class );
70
-			echo '<div class="gv-widget-page-links '.$class.'">'. $page_links .'</div>';
70
+			echo '<div class="gv-widget-page-links ' . $class . '">' . $page_links . '</div>';
71 71
 		} else {
72 72
 			do_action( 'gravityview_log_debug', 'GravityView_Widget_Page_Links[render_frontend] No page links; paginate_links() returned empty response.' );
73 73
 		}
Please login to merge, or discard this patch.
includes/class-gravityview-entry-list.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -170,25 +170,25 @@  discard block
 block discarded – undo
170 170
 	public function get_output() {
171 171
 
172 172
 		// No Entries
173
-		if( empty( $this->entries ) ) {
174
-			return '<div class="gv-no-results">'.$this->empty_message.'</div>';
173
+		if ( empty( $this->entries ) ) {
174
+			return '<div class="gv-no-results">' . $this->empty_message . '</div>';
175 175
 		}
176 176
 
177 177
 		$output = '';
178 178
 		$current_entry = GravityView_View::getInstance()->getCurrentEntry();
179 179
 
180
-		$output .= '<'. $this->wrapper_tag .'>';
180
+		$output .= '<' . $this->wrapper_tag . '>';
181 181
 
182
-		foreach( $this->entries as $entry ) {
182
+		foreach ( $this->entries as $entry ) {
183 183
 
184
-			if( $this->skip_entry( $entry, $current_entry ) ) {
184
+			if ( $this->skip_entry( $entry, $current_entry ) ) {
185 185
 				continue;
186 186
 			}
187 187
 
188 188
 			$output .= $this->get_item_output( $entry );
189 189
 		}
190 190
 
191
-		$output .= '</'. $this->wrapper_tag .'>';
191
+		$output .= '</' . $this->wrapper_tag . '>';
192 192
 
193 193
 		/**
194 194
 		 * @filter `gravityview/widget/recent-entries/output` Modify the HTML of the Recent Entries widget output
@@ -211,15 +211,15 @@  discard block
 block discarded – undo
211 211
 	private function skip_entry( $entry, $current_entry ) {
212 212
 
213 213
 		// If skip entry is off, or there's no current entry, return false
214
-		if( empty( $this->skip_current_entry ) || empty( $current_entry ) ) {
214
+		if ( empty( $this->skip_current_entry ) || empty( $current_entry ) ) {
215 215
 			return false;
216 216
 		}
217 217
 
218 218
 		// If in Single or Edit mode, $current_entry will be an array.
219
-		$current_entry_id = is_array( $current_entry ) ? $current_entry['id'] : $current_entry;
219
+		$current_entry_id = is_array( $current_entry ) ? $current_entry[ 'id' ] : $current_entry;
220 220
 
221 221
 		// If the entry ID matches the current entry, yes: skip
222
-		if( $entry['id'] === $current_entry_id ) {
222
+		if ( $entry[ 'id' ] === $current_entry_id ) {
223 223
 			return true;
224 224
 		}
225 225
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 
247 247
 		$item_output = gravityview_get_link( $link, $this->link_format );
248 248
 
249
-		if( !empty( $this->after_link ) ) {
249
+		if ( ! empty( $this->after_link ) ) {
250 250
 
251 251
 			/**
252 252
 			 * @filter `gravityview/entry-list/after-link` Modify the content displayed after the entry link in an entry list
@@ -255,14 +255,14 @@  discard block
 block discarded – undo
255 255
 			 * @param array $entry Gravity Forms entry array
256 256
 			 * @param GravityView_Entry_List $this The current class instance
257 257
 			 */
258
-			$after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>'.$this->after_link.'</div>', $entry, $this );
258
+			$after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>' . $this->after_link . '</div>', $entry, $this );
259 259
 
260 260
 			$item_output .= $after_link;
261 261
 		}
262 262
 
263 263
 		$item_output = GravityView_API::replace_variables( $item_output, $this->form, $entry );
264 264
 
265
-		$item_output = '<'. $this->item_tag .'>'. $item_output .'</'. $this->item_tag .'>';
265
+		$item_output = '<' . $this->item_tag . '>' . $item_output . '</' . $this->item_tag . '>';
266 266
 
267 267
 		/**
268 268
 		 * @filter `gravityview/entry-list/item` Modify each item's output in an entry list
Please login to merge, or discard this patch.