Completed
Pull Request — develop (#1050)
by Zack
29:15 queued 08:33
created
future/includes/class-gv-entry.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 			/** Must be an embed of some sort. */
122 122
 			if ( is_object( $post ) && is_numeric( $post->ID ) ) {
123 123
 				$permalink = get_permalink( $post->ID );
124
-				$args['gvid'] = $view->ID;
124
+				$args[ 'gvid' ] = $view->ID;
125 125
 			}
126 126
 		}
127 127
 		
@@ -149,21 +149,21 @@  discard block
 block discarded – undo
149 149
 			 */
150 150
 			$link_parts = explode( '?', $permalink );
151 151
 
152
-			$query = ! empty( $link_parts[1] ) ? '?' . $link_parts[1] : '';
152
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
153 153
 
154
-			$permalink = trailingslashit( $link_parts[0] ) . $entry_endpoint_name . '/'. $entry_slug .'/' . $query;
154
+			$permalink = trailingslashit( $link_parts[ 0 ] ) . $entry_endpoint_name . '/' . $entry_slug . '/' . $query;
155 155
 		} else {
156 156
 			$args[ $entry_endpoint_name ] = $entry_slug;
157 157
 		}
158 158
 
159 159
 		if ( $track_directory ) {
160
-			if ( ! empty( $_GET['pagenum'] ) ) {
161
-				$args['pagenum'] = intval( $_GET['pagenum'] );
160
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
161
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
162 162
 			}
163 163
 
164 164
 			if ( $sort = Utils::_GET( 'sort' ) ) {
165
-				$args['sort'] = $sort;
166
-				$args['dir'] = Utils::_GET( 'dir' );
165
+				$args[ 'sort' ] = $sort;
166
+				$args[ 'dir' ] = Utils::_GET( 'dir' );
167 167
 			}
168 168
 		}
169 169
 
Please login to merge, or discard this patch.
includes/class-template.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -328,34 +328,34 @@  discard block
 block discarded – undo
328 328
 	}
329 329
 
330 330
 	/**
331
-     * Get the fields for a specific context
332
-     *
333
-     * @since 1.19.2
334
-     *
331
+	 * Get the fields for a specific context
332
+	 *
333
+	 * @since 1.19.2
334
+	 *
335 335
 	 * @param string $context [Optional] "directory", "single", or "edit"
336 336
 	 *
337 337
 	 * @return array Array of GravityView field layout configurations
338 338
 	 */
339 339
 	public function getContextFields( $context = '' ) {
340 340
 
341
-	    if( '' === $context ) {
342
-	        $context = $this->getContext();
343
-        }
341
+		if( '' === $context ) {
342
+			$context = $this->getContext();
343
+		}
344 344
 
345 345
 		$fields = $this->getFields();
346 346
 
347
-        foreach ( (array) $fields as $key => $context_fields ) {
347
+		foreach ( (array) $fields as $key => $context_fields ) {
348 348
 
349
-            // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against
350
-            $matches = explode( '_', $key );
349
+			// Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against
350
+			$matches = explode( '_', $key );
351 351
 
352
-            if( isset( $matches[0] ) && $matches[0] === $context ) {
353
-                return $context_fields;
354
-            }
355
-        }
352
+			if( isset( $matches[0] ) && $matches[0] === $context ) {
353
+				return $context_fields;
354
+			}
355
+		}
356 356
 
357 357
 		return array();
358
-    }
358
+	}
359 359
 
360 360
 	/**
361 361
 	 * @param array $fields
@@ -448,10 +448,10 @@  discard block
 block discarded – undo
448 448
 	 */
449 449
 	public function getPaging() {
450 450
 
451
-	    $default_params = array(
452
-            'offset' => 0,
453
-            'page_size' => 20,
454
-        );
451
+		$default_params = array(
452
+			'offset' => 0,
453
+			'page_size' => 20,
454
+		);
455 455
 
456 456
 		return wp_parse_args( $this->paging, $default_params );
457 457
 	}
@@ -508,10 +508,10 @@  discard block
 block discarded – undo
508 508
 	public function getSorting() {
509 509
 
510 510
 		$defaults_params = array(
511
-            'sort_field' => 'date_created',
512
-            'sort_direction' => 'ASC',
513
-            'is_numeric' => false,
514
-        );
511
+			'sort_field' => 'date_created',
512
+			'sort_direction' => 'ASC',
513
+			'is_numeric' => false,
514
+		);
515 515
 
516 516
 		return wp_parse_args( $this->sorting, $defaults_params );
517 517
 	}
@@ -684,13 +684,13 @@  discard block
 block discarded – undo
684 684
 
685 685
 		$field_output = '';
686 686
 
687
-        $view = \GV\View::by_id( $this->view_id );
687
+		$view = \GV\View::by_id( $this->view_id );
688 688
 
689 689
 		\GV\Mocks\Legacy_Context::push( array_merge( array(
690 690
 			'view' => $view,
691 691
 			'fields' => \GV\Field_Collection::from_configuration( $fields ),
692 692
 			'in_the_loop' => true,
693
-            'entry' => \GV\GF_Entry::from_entry( $final_atts['entry'] ),
693
+			'entry' => \GV\GF_Entry::from_entry( $final_atts['entry'] ),
694 694
 		) ) );
695 695
 
696 696
 		foreach ( $fields as $field ) {
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 	 */
849 849
 	public function render_widget_hooks( $view_id_or_context ) {
850 850
 
851
-	    /**
851
+		/**
852 852
 		 * @deprecated Numeric argument is deprecated. Pass a \GV\Template_Context instead.
853 853
 		 */
854 854
 		if ( is_numeric( $view_id_or_context ) ) {
Please login to merge, or discard this patch.
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	die;
17 17
 }
18 18
 
19
-if( ! class_exists( 'Gamajo_Template_Loader' ) ) {
19
+if ( ! class_exists( 'Gamajo_Template_Loader' ) ) {
20 20
 	require( GRAVITYVIEW_DIR . 'includes/lib/class-gamajo-template-loader.php' );
21 21
 }
22 22
 
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 			'atts'	  => NULL,
158 158
 		) );
159 159
 
160
-		foreach ($atts as $key => $value) {
161
-			if( is_null( $value ) ) {
160
+		foreach ( $atts as $key => $value ) {
161
+			if ( is_null( $value ) ) {
162 162
 				continue;
163 163
 			}
164 164
 			$this->{$key} = $value;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 */
189 189
 	static function getInstance( $passed_post = NULL ) {
190 190
 
191
-		if( empty( self::$instance ) ) {
191
+		if ( empty( self::$instance ) ) {
192 192
 			self::$instance = new self( $passed_post );
193 193
 		}
194 194
 
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
 	 */
202 202
 	public function getCurrentField( $key = NULL ) {
203 203
 
204
-		if( !empty( $key ) ) {
205
-			if( isset( $this->_current_field[ $key ] ) ) {
204
+		if ( ! empty( $key ) ) {
205
+			if ( isset( $this->_current_field[ $key ] ) ) {
206 206
 				return $this->_current_field[ $key ];
207 207
 			}
208 208
 			return NULL;
@@ -213,16 +213,16 @@  discard block
 block discarded – undo
213 213
 
214 214
 	public function setCurrentFieldSetting( $key, $value ) {
215 215
 
216
-		if( !empty( $this->_current_field ) ) {
217
-			$this->_current_field['field_settings'][ $key ] = $value;
216
+		if ( ! empty( $this->_current_field ) ) {
217
+			$this->_current_field[ 'field_settings' ][ $key ] = $value;
218 218
 		}
219 219
 
220 220
 	}
221 221
 
222 222
 	public function getCurrentFieldSetting( $key ) {
223
-		$settings = $this->getCurrentField('field_settings');
223
+		$settings = $this->getCurrentField( 'field_settings' );
224 224
 
225
-		if( $settings && !empty( $settings[ $key ] ) ) {
225
+		if ( $settings && ! empty( $settings[ $key ] ) ) {
226 226
 			return $settings[ $key ];
227 227
 		}
228 228
 
@@ -253,8 +253,8 @@  discard block
 block discarded – undo
253 253
 	 */
254 254
 	public function getAtts( $key = NULL ) {
255 255
 
256
-		if( !empty( $key ) ) {
257
-			if( isset( $this->atts[ $key ] ) ) {
256
+		if ( ! empty( $key ) ) {
257
+			if ( isset( $this->atts[ $key ] ) ) {
258 258
 				return $this->atts[ $key ];
259 259
 			}
260 260
 			return NULL;
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 
321 321
 		$fields = empty( $this->fields ) ? NULL : $this->fields;
322 322
 
323
-		if( $fields && !empty( $key ) ) {
323
+		if ( $fields && ! empty( $key ) ) {
324 324
 			$fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL;
325 325
 		}
326 326
 
@@ -338,18 +338,18 @@  discard block
 block discarded – undo
338 338
 	 */
339 339
 	public function getContextFields( $context = '' ) {
340 340
 
341
-	    if( '' === $context ) {
341
+	    if ( '' === $context ) {
342 342
 	        $context = $this->getContext();
343 343
         }
344 344
 
345 345
 		$fields = $this->getFields();
346 346
 
347
-        foreach ( (array) $fields as $key => $context_fields ) {
347
+        foreach ( (array)$fields as $key => $context_fields ) {
348 348
 
349 349
             // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against
350 350
             $matches = explode( '_', $key );
351 351
 
352
-            if( isset( $matches[0] ) && $matches[0] === $context ) {
352
+            if ( isset( $matches[ 0 ] ) && $matches[ 0 ] === $context ) {
353 353
                 return $context_fields;
354 354
             }
355 355
         }
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
 	 */
371 371
 	public function getField( $key ) {
372 372
 
373
-		if( !empty( $key ) ) {
374
-			if( isset( $this->fields[ $key ] ) ) {
373
+		if ( ! empty( $key ) ) {
374
+			if ( isset( $this->fields[ $key ] ) ) {
375 375
 				return $this->fields[ $key ];
376 376
 			}
377 377
 		}
@@ -477,8 +477,8 @@  discard block
 block discarded – undo
477 477
 	public function getPaginationCounts() {
478 478
 
479 479
 		$paging = $this->getPaging();
480
-		$offset = $paging['offset'];
481
-		$page_size = $paging['page_size'];
480
+		$offset = $paging[ 'offset' ];
481
+		$page_size = $paging[ 'page_size' ];
482 482
 		$total = $this->getTotalEntries();
483 483
 
484 484
 		if ( empty( $total ) ) {
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 		 */
500 500
 		list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) );
501 501
 
502
-		return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total );
502
+		return array( 'first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total );
503 503
 	}
504 504
 
505 505
 	/**
@@ -595,16 +595,16 @@  discard block
 block discarded – undo
595 595
 	 */
596 596
 	public function getCurrentEntry() {
597 597
 
598
-		if( in_array( $this->getContext(), array( 'edit', 'single') ) ) {
598
+		if ( in_array( $this->getContext(), array( 'edit', 'single' ) ) ) {
599 599
 			$entries = $this->getEntries();
600
-			$entry = $entries[0];
600
+			$entry = $entries[ 0 ];
601 601
 		} else {
602 602
 			$entry = $this->_current_entry;
603 603
 		}
604 604
 
605 605
 		/** @since 1.16 Fixes DataTables empty entry issue */
606
-		if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) {
607
-			$entry = $this->_current_field['entry'];
606
+		if ( empty( $entry ) && ! empty( $this->_current_field[ 'entry' ] ) ) {
607
+			$entry = $this->_current_field[ 'entry' ];
608 608
 		}
609 609
 
610 610
 		return $entry;
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 	public function renderZone( $zone = '', $atts = array(), $echo = true ) {
645 645
 
646 646
 		if ( empty( $zone ) ) {
647
-			gravityview()->log->error( 'No zone defined.');
647
+			gravityview()->log->error( 'No zone defined.' );
648 648
 			return NULL;
649 649
 		}
650 650
 
@@ -653,16 +653,16 @@  discard block
 block discarded – undo
653 653
 			'context' => $this->getContext(),
654 654
 			'entry' => $this->getCurrentEntry(),
655 655
 			'form' => $this->getForm(),
656
-			'hide_empty' => $this->getAtts('hide_empty'),
656
+			'hide_empty' => $this->getAtts( 'hide_empty' ),
657 657
 		);
658 658
 
659 659
 		$final_atts = wp_parse_args( $atts, $defaults );
660 660
 
661 661
 		$output = '';
662 662
 
663
-		$final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}";
663
+		$final_atts[ 'zone_id' ] = "{$final_atts[ 'context' ]}_{$final_atts[ 'slug' ]}-{$zone}";
664 664
 
665
-		$fields = $this->getField( $final_atts['zone_id'] );
665
+		$fields = $this->getField( $final_atts[ 'zone_id' ] );
666 666
 
667 667
 		// Backward compatibility
668 668
 		if ( 'table' === $this->getTemplatePartSlug() ) {
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 			 * @param \GravityView_View $this
673 673
 			 * @deprecated Use `gravityview/template/table/fields`
674 674
 			 */
675
-			$fields = apply_filters("gravityview_table_cells", $fields, $this );
675
+			$fields = apply_filters( "gravityview_table_cells", $fields, $this );
676 676
 		}
677 677
 
678 678
 		if ( empty( $fields ) ) {
@@ -690,11 +690,11 @@  discard block
 block discarded – undo
690 690
 			'view' => $view,
691 691
 			'fields' => \GV\Field_Collection::from_configuration( $fields ),
692 692
 			'in_the_loop' => true,
693
-            'entry' => \GV\GF_Entry::from_entry( $final_atts['entry'] ),
693
+            'entry' => \GV\GF_Entry::from_entry( $final_atts[ 'entry' ] ),
694 694
 		) ) );
695 695
 
696 696
 		foreach ( $fields as $field ) {
697
-			$final_atts['field'] = $field;
697
+			$final_atts[ 'field' ] = $field;
698 698
 			$field_output .= gravityview_field_output( $final_atts );
699 699
 		}
700 700
 
@@ -712,17 +712,17 @@  discard block
 block discarded – undo
712 712
 			return NULL;
713 713
 		}
714 714
 
715
-		if( !empty( $final_atts['wrapper_class'] ) ) {
716
-			$output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">';
715
+		if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) {
716
+			$output .= '<div class="' . gravityview_sanitize_html_class( $final_atts[ 'wrapper_class' ] ) . '">';
717 717
 		}
718 718
 
719 719
 		$output .= $field_output;
720 720
 
721
-		if( !empty( $final_atts['wrapper_class'] ) ) {
721
+		if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) {
722 722
 			$output .= '</div>';
723 723
 		}
724 724
 
725
-		if( $echo ) {
725
+		if ( $echo ) {
726 726
 			echo $output;
727 727
 		}
728 728
 
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 	 */
741 741
 	function locate_template( $template_names, $load = false, $require_once = true ) {
742 742
 
743
-		if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) {
743
+		if ( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) {
744 744
 
745 745
 			$located = $this->located_templates[ $template_names ];
746 746
 
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 			// Set $load to always false so we handle it here.
750 750
 			$located = parent::locate_template( $template_names, false, $require_once );
751 751
 
752
-			if( is_string( $template_names ) ) {
752
+			if ( is_string( $template_names ) ) {
753 753
 				$this->located_templates[ $template_names ] = $located;
754 754
 			}
755 755
 		}
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 	 * @return mixed|null    The stored data.
768 768
 	 */
769 769
 	public function __get( $name ) {
770
-		if( isset( $this->{$name} ) ) {
770
+		if ( isset( $this->{$name} ) ) {
771 771
 			return $this->{$name};
772 772
 		} else {
773 773
 			return NULL;
@@ -796,17 +796,17 @@  discard block
 block discarded – undo
796 796
 		$additional = array();
797 797
 
798 798
 		// form-19-table-body.php
799
-		$additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name );
799
+		$additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name );
800 800
 
801
-		if( $view_id = $this->getViewId() ) {
801
+		if ( $view_id = $this->getViewId() ) {
802 802
 			// view-3-table-body.php
803
-			$additional[] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name );
803
+			$additional[ ] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name );
804 804
 		}
805 805
 
806
-		if( $this->getPostId() ) {
806
+		if ( $this->getPostId() ) {
807 807
 
808 808
 			// page-19-table-body.php
809
-			$additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name );
809
+			$additional[ ] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name );
810 810
 		}
811 811
 
812 812
 		// Combine with existing table-body.php and table.php
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 
829 829
 		gravityview()->log->debug( 'Rendering Template File: {path}', array( 'path' => $template_file ) );
830 830
 
831
-		if( !empty( $template_file) ) {
831
+		if ( ! empty( $template_file ) ) {
832 832
 
833 833
 			if ( $require_once ) {
834 834
 				require_once( $template_file );
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 
897 897
 		// Prevent being called twice
898 898
 		if ( did_action( "gravityview/widgets/$zone/{$view->ID}/rendered" ) ) {
899
-			gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone.'_'.$view->ID.'_widgets' ) );
899
+			gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone . '_' . $view->ID . '_widgets' ) );
900 900
 			return;
901 901
 		}
902 902
 
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
 		 * @param string $zone Current widget zone, either `header` or `footer`
919 919
 		 * @param array $widgets Array of widget configurations for the current zone, as set by `gravityview_get_current_view_data()['widgets']`
920 920
 		 */
921
-		$css_class = apply_filters('gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() );
921
+		$css_class = apply_filters( 'gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() );
922 922
 
923 923
 		$css_class = gravityview_sanitize_html_class( $css_class );
924 924
 
@@ -926,15 +926,15 @@  discard block
 block discarded – undo
926 926
 		?>
927 927
 		<div class="<?php echo $css_class; ?>">
928 928
 			<?php
929
-			foreach( $rows as $row ) {
930
-				foreach( $row as $col => $areas ) {
929
+			foreach ( $rows as $row ) {
930
+				foreach ( $row as $col => $areas ) {
931 931
 					$column = ( $col == '2-2' ) ? '1-2 gv-right' : "$col gv-left";
932 932
 				?>
933 933
 					<div class="gv-grid-col-<?php echo esc_attr( $column ); ?>">
934 934
 						<?php
935 935
 						if ( ! empty( $areas ) ) {
936 936
 							foreach ( $areas as $area ) {
937
-								foreach ( $widgets->by_position( $zone . '_' . $area['areaid'] )->all() as $widget ) {
937
+								foreach ( $widgets->by_position( $zone . '_' . $area[ 'areaid' ] )->all() as $widget ) {
938 938
 									do_action( sprintf( 'gravityview/widgets/%s/render', $widget->get_widget_id() ), $widget->configuration->all(), null, $view_id_or_context );
939 939
 								}
940 940
 							}
Please login to merge, or discard this patch.