@@ -102,8 +102,7 @@ discard block  | 
                                                    ||
| 102 | 102 | $entries = $view->get_entries( gravityview()->request );  | 
                                                        
| 103 | 103 | }  | 
                                                        
| 104 | 104 | |
| 105 | - $page = \GV\Utils::get( $parameters['paging'], 'current_page' ) ?  | 
                                                        |
| 106 | - : ( ( ( $parameters['paging']['offset'] - $view->settings->get( 'offset' ) ) / $parameters['paging']['page_size'] ) + 1 );  | 
                                                        |
| 105 | + $page = \GV\Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $view->settings->get( 'offset' ) ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 );  | 
                                                        |
| 107 | 106 | |
| 108 | 107 | /** Set paging, count and unwrap the entries. */  | 
                                                        
| 109 | 108 | $paging = array(  | 
                                                        
@@ -142,17 +141,17 @@ discard block  | 
                                                    ||
| 142 | 141 | * @return null|string The value of a field in an entry.  | 
                                                        
| 143 | 142 | */  | 
                                                        
| 144 | 143 |  function GravityView_API_field_value( $entry, $field_settings, $format ) { | 
                                                        
| 145 | -	if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) { | 
                                                        |
| 144 | +	if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) { | 
                                                        |
| 146 | 145 | gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) );  | 
                                                        
| 147 | 146 | return null;  | 
                                                        
| 148 | 147 | }  | 
                                                        
| 149 | 148 | |
| 150 | -	if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) { | 
                                                        |
| 151 | - $multientry = \GV\Multi_Entry::from_entries( array_map( '\GV\GF_Entry::from_entry', $entry['_multi'] ) );  | 
                                                        |
| 152 | - $entry = $entry['_multi'][ $field_settings['form_id'] ];  | 
                                                        |
| 149 | +	if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) { | 
                                                        |
| 150 | + $multientry = \GV\Multi_Entry::from_entries( array_map( '\GV\GF_Entry::from_entry', $entry[ '_multi' ] ) );  | 
                                                        |
| 151 | + $entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ];  | 
                                                        |
| 153 | 152 | }  | 
                                                        
| 154 | 153 | |
| 155 | -	if ( empty( $entry['id'] ) || ! $entry = \GV\GF_Entry::by_id( $entry['id'] ) ) { | 
                                                        |
| 154 | +	if ( empty( $entry[ 'id' ] ) || ! $entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) { | 
                                                        |
| 156 | 155 | gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) );  | 
                                                        
| 157 | 156 | return null;  | 
                                                        
| 158 | 157 | }  | 
                                                        
@@ -162,18 +161,18 @@ discard block  | 
                                                    ||
| 162 | 161 | *  | 
                                                        
| 163 | 162 | * Fields with a numeric ID are Gravity Forms ones.  | 
                                                        
| 164 | 163 | */  | 
                                                        
| 165 | - $source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;;  | 
                                                        |
| 164 | + $source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL; ;  | 
                                                        |
| 166 | 165 | |
| 167 | 166 | /** Initialize the future field. */  | 
                                                        
| 168 | 167 | switch ( $source ):  | 
                                                        
| 169 | 168 | /** The Gravity Forms backend. */  | 
                                                        
| 170 | 169 | case \GV\Source::BACKEND_GRAVITYFORMS:  | 
                                                        
| 171 | -			if ( ! $form = \GV\GF_Form::by_id( $entry['form_id'] ) ) { | 
                                                        |
| 170 | +			if ( ! $form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) { | 
                                                        |
| 172 | 171 | gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) );  | 
                                                        
| 173 | 172 | return null;  | 
                                                        
| 174 | 173 | }  | 
                                                        
| 175 | 174 | |
| 176 | -			if ( ! $field = $form::get_field( $form, $field_settings['id'] ) ) { | 
                                                        |
| 175 | +			if ( ! $field = $form::get_field( $form, $field_settings[ 'id' ] ) ) { | 
                                                        |
| 177 | 176 | return null;  | 
                                                        
| 178 | 177 | }  | 
                                                        
| 179 | 178 | |
@@ -181,7 +180,7 @@ discard block  | 
                                                    ||
| 181 | 180 | |
| 182 | 181 | /** Our internal backend. */  | 
                                                        
| 183 | 182 | case \GV\Source::BACKEND_INTERNAL:  | 
                                                        
| 184 | -			if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) { | 
                                                        |
| 183 | +			if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) { | 
                                                        |
| 185 | 184 | return null;  | 
                                                        
| 186 | 185 | }  | 
                                                        
| 187 | 186 | |
@@ -215,13 +214,13 @@ discard block  | 
                                                    ||
| 215 | 214 | |
| 216 | 215 | /** A bail condition. */  | 
                                                        
| 217 | 216 |  	$bail = function( $label, $field_settings, $entry, $force_show_label, $form ) { | 
                                                        
| 218 | -		if ( ! empty( $field_settings['show_label'] ) || $force_show_label ) { | 
                                                        |
| 217 | +		if ( ! empty( $field_settings[ 'show_label' ] ) || $force_show_label ) { | 
                                                        |
| 219 | 218 | |
| 220 | - $label = isset( $field_settings['label'] ) ? $field_settings['label'] : '';  | 
                                                        |
| 219 | + $label = isset( $field_settings[ 'label' ] ) ? $field_settings[ 'label' ] : '';  | 
                                                        |
| 221 | 220 | |
| 222 | 221 | // Use Gravity Forms label by default, but if a custom label is defined in GV, use it.  | 
                                                        
| 223 | -			if ( ! empty( $field_settings['custom_label'] ) ) { | 
                                                        |
| 224 | - $label = \GravityView_API::replace_variables( $field_settings['custom_label'], $form, $entry );  | 
                                                        |
| 222 | +			if ( ! empty( $field_settings[ 'custom_label' ] ) ) { | 
                                                        |
| 223 | + $label = \GravityView_API::replace_variables( $field_settings[ 'custom_label' ], $form, $entry );  | 
                                                        |
| 225 | 224 | }  | 
                                                        
| 226 | 225 | |
| 227 | 226 | /**  | 
                                                        
@@ -247,19 +246,19 @@ discard block  | 
                                                    ||
| 247 | 246 | |
| 248 | 247 | $label = '';  | 
                                                        
| 249 | 248 | |
| 250 | -	if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) { | 
                                                        |
| 251 | - $entry = $entry['_multi'][ $field_settings['form_id'] ];  | 
                                                        |
| 252 | -		if ( $_form = \GV\GF_Form::by_id( $field_settings['form_id'] ) ) { | 
                                                        |
| 249 | +	if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) { | 
                                                        |
| 250 | + $entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ];  | 
                                                        |
| 251 | +		if ( $_form = \GV\GF_Form::by_id( $field_settings[ 'form_id' ] ) ) { | 
                                                        |
| 253 | 252 | $form = $_form->form;  | 
                                                        
| 254 | 253 | }  | 
                                                        
| 255 | 254 | }  | 
                                                        
| 256 | 255 | |
| 257 | -	if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) { | 
                                                        |
| 256 | +	if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) { | 
                                                        |
| 258 | 257 | gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) );  | 
                                                        
| 259 | 258 | return $bail( $label, $field_settings, $entry, $force_show_label, $form );  | 
                                                        
| 260 | 259 | }  | 
                                                        
| 261 | 260 | |
| 262 | -	if ( empty( $entry['id'] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry['id'] ) ) { | 
                                                        |
| 261 | +	if ( empty( $entry[ 'id' ] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) { | 
                                                        |
| 263 | 262 | gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) );  | 
                                                        
| 264 | 263 | return $bail( $label, $field_settings, $entry, $force_show_label, $form );  | 
                                                        
| 265 | 264 | }  | 
                                                        
@@ -271,31 +270,31 @@ discard block  | 
                                                    ||
| 271 | 270 | *  | 
                                                        
| 272 | 271 | * Fields with a numeric ID are Gravity Forms ones.  | 
                                                        
| 273 | 272 | */  | 
                                                        
| 274 | - $source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;  | 
                                                        |
| 273 | + $source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;  | 
                                                        |
| 275 | 274 | |
| 276 | 275 | /** Initialize the future field. */  | 
                                                        
| 277 | 276 | switch ( $source ):  | 
                                                        
| 278 | 277 | /** The Gravity Forms backend. */  | 
                                                        
| 279 | 278 | case \GV\Source::BACKEND_GRAVITYFORMS:  | 
                                                        
| 280 | -			if ( ! $gf_form = \GV\GF_Form::by_id( $entry['form_id'] ) ) { | 
                                                        |
| 279 | +			if ( ! $gf_form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) { | 
                                                        |
| 281 | 280 | gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) );  | 
                                                        
| 282 | 281 | return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form );  | 
                                                        
| 283 | 282 | }  | 
                                                        
| 284 | 283 | |
| 285 | -			if ( ! $field = $gf_form::get_field( $gf_form, $field_settings['id'] ) ) { | 
                                                        |
| 286 | -				gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings['id'], 'data' => $form ) ); | 
                                                        |
| 284 | +			if ( ! $field = $gf_form::get_field( $gf_form, $field_settings[ 'id' ] ) ) { | 
                                                        |
| 285 | +				gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings[ 'id' ], 'data' => $form ) ); | 
                                                        |
| 287 | 286 | return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $gf_form->form );  | 
                                                        
| 288 | 287 | }  | 
                                                        
| 289 | -			if ( empty( $field_settings['show_label'] ) ) { | 
                                                        |
| 288 | +			if ( empty( $field_settings[ 'show_label' ] ) ) { | 
                                                        |
| 290 | 289 | /** The label never wins... */  | 
                                                        
| 291 | - $field_settings['label'] = '';  | 
                                                        |
| 290 | + $field_settings[ 'label' ] = '';  | 
                                                        |
| 292 | 291 | }  | 
                                                        
| 293 | 292 | |
| 294 | 293 | break;  | 
                                                        
| 295 | 294 | |
| 296 | 295 | /** Our internal backend. */  | 
                                                        
| 297 | 296 | case \GV\Source::BACKEND_INTERNAL:  | 
                                                        
| 298 | -			if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) { | 
                                                        |
| 297 | +			if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) { | 
                                                        |
| 299 | 298 | return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form );  | 
                                                        
| 300 | 299 | }  | 
                                                        
| 301 | 300 | break;  | 
                                                        
@@ -307,8 +306,8 @@ discard block  | 
                                                    ||
| 307 | 306 | break;  | 
                                                        
| 308 | 307 | endswitch;  | 
                                                        
| 309 | 308 | |
| 310 | -	if( $force_show_label ) { | 
                                                        |
| 311 | - $field_settings['show_label'] = '1';  | 
                                                        |
| 309 | +	if ( $force_show_label ) { | 
                                                        |
| 310 | + $field_settings[ 'show_label' ] = '1';  | 
                                                        |
| 312 | 311 | }  | 
                                                        
| 313 | 312 | |
| 314 | 313 | /** Add the field settings. */  | 
                                                        
@@ -443,7 +442,7 @@ discard block  | 
                                                    ||
| 443 | 442 | '\GravityView_frontend::entry' => \GravityView_frontend::getInstance()->getEntry(),  | 
                                                        
| 444 | 443 | '\GravityView_View::_current_entry' => \GravityView_View::getInstance()->getCurrentEntry(),  | 
                                                        
| 445 | 444 | '\GravityView_View::fields' => \GravityView_View::getInstance()->getFields(),  | 
                                                        
| 446 | - 'wp_actions[loop_start]' => empty( $wp_actions['loop_start'] ) ? 0 : $wp_actions['loop_start'],  | 
                                                        |
| 445 | + 'wp_actions[loop_start]' => empty( $wp_actions[ 'loop_start' ] ) ? 0 : $wp_actions[ 'loop_start' ],  | 
                                                        |
| 447 | 446 | 'wp_query::in_the_loop' => $wp_query->in_the_loop,  | 
                                                        
| 448 | 447 | );  | 
                                                        
| 449 | 448 | }  | 
                                                        
@@ -531,7 +530,7 @@ discard block  | 
                                                    ||
| 531 | 530 | break;  | 
                                                        
| 532 | 531 | case 'wp_actions[loop_start]':  | 
                                                        
| 533 | 532 | global $wp_actions;  | 
                                                        
| 534 | - $wp_actions['loop_start'] = $value;  | 
                                                        |
| 533 | + $wp_actions[ 'loop_start' ] = $value;  | 
                                                        |
| 535 | 534 | break;  | 
                                                        
| 536 | 535 | case 'wp_query::in_the_loop':  | 
                                                        
| 537 | 536 | global $wp_query;  | 
                                                        
@@ -627,9 +626,7 @@ discard block  | 
                                                    ||
| 627 | 626 | case 'request':  | 
                                                        
| 628 | 627 | self::thaw( array(  | 
                                                        
| 629 | 628 | '\GravityView_View::context' => (  | 
                                                        
| 630 | - $value->is_entry() ? 'single' :  | 
                                                        |
| 631 | - ( $value->is_edit_entry() ? 'edit' :  | 
                                                        |
| 632 | - ( $value->is_view() ? 'directory': null )  | 
                                                        |
| 629 | + $value->is_entry() ? 'single' : ( $value->is_edit_entry() ? 'edit' : ( $value->is_view() ? 'directory' : null )  | 
                                                        |
| 633 | 630 | )  | 
                                                        
| 634 | 631 | ),  | 
                                                        
| 635 | 632 | '\GravityView_frontend::is_search' => $value->is_search(),  | 
                                                        
@@ -683,14 +680,14 @@ discard block  | 
                                                    ||
| 683 | 680 | global $wp_query, $wp_actions;  | 
                                                        
| 684 | 681 | |
| 685 | 682 | $wp_query->in_the_loop = false;  | 
                                                        
| 686 | - $wp_actions['loop_start'] = 0;  | 
                                                        |
| 683 | + $wp_actions[ 'loop_start' ] = 0;  | 
                                                        |
| 687 | 684 | }  | 
                                                        
| 688 | 685 | }  | 
                                                        
| 689 | 686 | |
| 690 | 687 | |
| 691 | 688 | /** Add some global fix for field capability discrepancies. */  | 
                                                        
| 692 | 689 |  add_filter( 'gravityview/configuration/fields', function( $fields ) { | 
                                                        
| 693 | -	if ( empty( $fields  ) ) { | 
                                                        |
| 690 | +	if ( empty( $fields ) ) { | 
                                                        |
| 694 | 691 | return $fields;  | 
                                                        
| 695 | 692 | }  | 
                                                        
| 696 | 693 | |
@@ -717,11 +714,11 @@ discard block  | 
                                                    ||
| 717 | 714 | }  | 
                                                        
| 718 | 715 | |
| 719 | 716 |  		foreach ( $_fields as $uid => &$_field ) { | 
                                                        
| 720 | -			if ( ! isset( $_field['only_loggedin'] ) ) { | 
                                                        |
| 717 | +			if ( ! isset( $_field[ 'only_loggedin' ] ) ) { | 
                                                        |
| 721 | 718 | continue;  | 
                                                        
| 722 | 719 | }  | 
                                                        
| 723 | 720 | /** If we do not require login, we don't require a cap. */  | 
                                                        
| 724 | - $_field['only_loggedin'] != '1' && ( $_field['only_loggedin_cap'] = '' );  | 
                                                        |
| 721 | + $_field[ 'only_loggedin' ] != '1' && ( $_field[ 'only_loggedin_cap' ] = '' );  | 
                                                        |
| 725 | 722 | }  | 
                                                        
| 726 | 723 | }  | 
                                                        
| 727 | 724 | return $fields;  | 
                                                        
@@ -752,8 +749,8 @@ discard block  | 
                                                    ||
| 752 | 749 | }  | 
                                                        
| 753 | 750 | |
| 754 | 751 |  		foreach ( $_fields as $uid => &$_field ) { | 
                                                        
| 755 | -			if ( ! empty( $_field['id'] ) && is_numeric( $_field['id'] ) && empty( $_field['form_id'] ) ) { | 
                                                        |
| 756 | - $_field['form_id'] = $view->form->ID;  | 
                                                        |
| 752 | +			if ( ! empty( $_field[ 'id' ] ) && is_numeric( $_field[ 'id' ] ) && empty( $_field[ 'form_id' ] ) ) { | 
                                                        |
| 753 | + $_field[ 'form_id' ] = $view->form->ID;  | 
                                                        |
| 757 | 754 | }  | 
                                                        
| 758 | 755 | }  | 
                                                        
| 759 | 756 | }  | 
                                                        
@@ -767,25 +764,25 @@ discard block  | 
                                                    ||
| 767 | 764 |  	if ( class_exists( '\GravityView_frontend' ) ) { | 
                                                        
| 768 | 765 | global $wp_filter;  | 
                                                        
| 769 | 766 | |
| 770 | -		if ( empty( $wp_filter['gravityview_after'] ) ) { | 
                                                        |
| 767 | +		if ( empty( $wp_filter[ 'gravityview_after' ] ) ) { | 
                                                        |
| 771 | 768 | return;  | 
                                                        
| 772 | 769 | }  | 
                                                        
| 773 | 770 | |
| 774 | 771 | /** WordPress 4.6 and lower compatibility, when WP_Hook classes were still absent. */  | 
                                                        
| 775 | -		if ( is_array( $wp_filter['gravityview_after'] ) ) { | 
                                                        |
| 776 | -			if ( ! empty( $wp_filter['gravityview_after'][10] ) ) { | 
                                                        |
| 777 | -				foreach ( $wp_filter['gravityview_after'][10] as $function_key => $callback ) { | 
                                                        |
| 772 | +		if ( is_array( $wp_filter[ 'gravityview_after' ] ) ) { | 
                                                        |
| 773 | +			if ( ! empty( $wp_filter[ 'gravityview_after' ][ 10 ] ) ) { | 
                                                        |
| 774 | +				foreach ( $wp_filter[ 'gravityview_after' ][ 10 ] as $function_key => $callback ) { | 
                                                        |
| 778 | 775 |  					if ( strpos( $function_key, 'context_not_configured_warning' ) ) { | 
                                                        
| 779 | - unset( $wp_filter['gravityview_after'][10][ $function_key ] );  | 
                                                        |
| 776 | + unset( $wp_filter[ 'gravityview_after' ][ 10 ][ $function_key ] );  | 
                                                        |
| 780 | 777 | }  | 
                                                        
| 781 | 778 | }  | 
                                                        
| 782 | 779 | }  | 
                                                        
| 783 | 780 | return;  | 
                                                        
| 784 | 781 | }  | 
                                                        
| 785 | 782 | |
| 786 | -		foreach ( $wp_filter['gravityview_after']->callbacks[10] as $function_key => $callback ) { | 
                                                        |
| 783 | +		foreach ( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ] as $function_key => $callback ) { | 
                                                        |
| 787 | 784 |  			if ( strpos( $function_key, 'context_not_configured_warning' ) ) { | 
                                                        
| 788 | - unset( $wp_filter['gravityview_after']->callbacks[10][ $function_key ] );  | 
                                                        |
| 785 | + unset( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ][ $function_key ] );  | 
                                                        |
| 789 | 786 | }  | 
                                                        
| 790 | 787 | }  | 
                                                        
| 791 | 788 | }  |