Completed
Pull Request — master (#1038)
by Zack
16:56
created
includes/extensions/edit-entry/class-edit-entry-render.php 1 patch
Indentation   +259 added lines, -259 removed lines patch added patch discarded remove patch
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
 	public function prevent_maybe_process_form() {
161 161
 
162 162
 		if( ! empty( $_POST ) ) {
163
-	        gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
163
+			gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
164 164
 		}
165 165
 
166 166
 		if( $this->is_edit_entry_submission() ) {
167 167
 			remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
168
-	        remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
168
+			remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
169 169
 		}
170 170
 	}
171 171
 
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 
198 198
 
199 199
 		$entries = $gravityview_view->getEntries();
200
-	    self::$original_entry = $entries[0];
201
-	    $this->entry = $entries[0];
200
+		self::$original_entry = $entries[0];
201
+		$this->entry = $entries[0];
202 202
 
203 203
 		self::$original_form = $gravityview_view->getForm();
204 204
 		$this->form = $gravityview_view->getForm();
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
 
323 323
 			GFFormsModel::save_lead( $form, $this->entry );
324 324
 
325
-	        // Delete the values for hidden inputs
326
-	        $this->unset_hidden_field_values();
325
+			// Delete the values for hidden inputs
326
+			$this->unset_hidden_field_values();
327 327
 			
328 328
 			$this->entry['date_created'] = $date_created;
329 329
 
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 			// Perform actions normally performed after updating a lead
334 334
 			$this->after_update();
335 335
 
336
-	        /**
336
+			/**
337 337
 			 * Must be AFTER after_update()!
338 338
 			 * @see https://github.com/gravityview/GravityView/issues/764
339 339
 			 */
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	 * @return void
364 364
 	 */
365 365
 	private function unset_hidden_field_values() {
366
-	    global $wpdb;
366
+		global $wpdb;
367 367
 
368 368
 		/**
369 369
 		 * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic
@@ -385,27 +385,27 @@  discard block
 block discarded – undo
385 385
 			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
386 386
 		}
387 387
 
388
-	    foreach ( $this->entry as $input_id => $field_value ) {
388
+		foreach ( $this->entry as $input_id => $field_value ) {
389 389
 
390
-		    $field = RGFormsModel::get_field( $this->form, $input_id );
390
+			$field = RGFormsModel::get_field( $this->form, $input_id );
391 391
 
392
-		    // Reset fields that are hidden
393
-		    // Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
394
-		    if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
392
+			// Reset fields that are hidden
393
+			// Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
394
+			if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
395 395
 
396
-		        // List fields are stored as empty arrays when empty
397
-			    $empty_value = $this->is_field_json_encoded( $field ) ? '[]' : '';
396
+				// List fields are stored as empty arrays when empty
397
+				$empty_value = $this->is_field_json_encoded( $field ) ? '[]' : '';
398 398
 
399
-			    $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
399
+				$lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
400 400
 
401
-			    GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
401
+				GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
402 402
 
403
-			    // Prevent the $_POST values of hidden fields from being used as default values when rendering the form
403
+				// Prevent the $_POST values of hidden fields from being used as default values when rendering the form
404 404
 				// after submission
405
-			    $post_input_id = 'input_' . str_replace( '.', '_', $input_id );
406
-			    $_POST[ $post_input_id ] = '';
407
-		    }
408
-	    }
405
+				$post_input_id = 'input_' . str_replace( '.', '_', $input_id );
406
+				$_POST[ $post_input_id ] = '';
407
+			}
408
+		}
409 409
 	}
410 410
 
411 411
 	/**
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 
500 500
 		$form = $this->form;
501 501
 
502
-	    /** @var GF_Field $field */
502
+		/** @var GF_Field $field */
503 503
 		foreach( $form['fields'] as $k => &$field ) {
504 504
 
505 505
 			/**
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 
516 516
 			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
517 517
 				foreach( $field->inputs as $key => $input ) {
518
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
518
+					$field->inputs[ $key ][ 'id' ] = (string)$input['id'];
519 519
 				}
520 520
 			}
521 521
 		}
@@ -536,13 +536,13 @@  discard block
 block discarded – undo
536 536
 			foreach ( $this->fields_with_calculation as $calc_field ) {
537 537
 				$inputs = $calc_field->get_entry_inputs();
538 538
 				if ( is_array( $inputs ) ) {
539
-				    foreach ( $inputs as $input ) {
540
-				        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
541
-				        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
542
-				    }
539
+					foreach ( $inputs as $input ) {
540
+						$input_name = 'input_' . str_replace( '.', '_', $input['id'] );
541
+						$entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
542
+					}
543 543
 				} else {
544
-				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
545
-				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
544
+					$input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
545
+					$entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
546 546
 				}
547 547
 			}
548 548
 
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
591 591
 
592 592
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
593
-	        $ary = stripslashes_deep( $ary );
593
+			$ary = stripslashes_deep( $ary );
594 594
 			$img_url = \GV\Utils::get( $ary, 0 );
595 595
 
596 596
 			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	private function maybe_update_post_fields( $form ) {
664 664
 
665 665
 		if( empty( $this->entry['post_id'] ) ) {
666
-	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
666
+			gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
667 667
 			return;
668 668
 		}
669 669
 
@@ -698,51 +698,51 @@  discard block
 block discarded – undo
698 698
 
699 699
 				switch( $field->type ) {
700 700
 
701
-				    case 'post_title':
702
-				        $post_title = $value;
703
-				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
704
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
705
-				        }
706
-				        $updated_post->post_title = $post_title;
707
-				        $updated_post->post_name  = $post_title;
708
-				        unset( $post_title );
709
-				        break;
710
-
711
-				    case 'post_content':
712
-				        $post_content = $value;
713
-				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
714
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
715
-				        }
716
-				        $updated_post->post_content = $post_content;
717
-				        unset( $post_content );
718
-				        break;
719
-				    case 'post_excerpt':
720
-				        $updated_post->post_excerpt = $value;
721
-				        break;
722
-				    case 'post_tags':
723
-				        wp_set_post_tags( $post_id, $value, false );
724
-				        break;
725
-				    case 'post_category':
726
-				        break;
727
-				    case 'post_custom_field':
701
+					case 'post_title':
702
+						$post_title = $value;
703
+						if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
704
+							$post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
705
+						}
706
+						$updated_post->post_title = $post_title;
707
+						$updated_post->post_name  = $post_title;
708
+						unset( $post_title );
709
+						break;
710
+
711
+					case 'post_content':
712
+						$post_content = $value;
713
+						if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
714
+							$post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
715
+						}
716
+						$updated_post->post_content = $post_content;
717
+						unset( $post_content );
718
+						break;
719
+					case 'post_excerpt':
720
+						$updated_post->post_excerpt = $value;
721
+						break;
722
+					case 'post_tags':
723
+						wp_set_post_tags( $post_id, $value, false );
724
+						break;
725
+					case 'post_category':
726
+						break;
727
+					case 'post_custom_field':
728 728
 						if ( is_array( $value ) && ( floatval( $field_id ) !== floatval( $field->id ) ) ) {
729 729
 							$value = $value[ $field_id ];
730 730
 						}
731 731
 
732
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
733
-				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
734
-				        }
732
+						if( ! empty( $field->customFieldTemplateEnabled ) ) {
733
+							$value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
734
+						}
735 735
 
736
-	                    if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
737
-		                    $value = function_exists('wp_json_encode') ? wp_json_encode( $value ) : json_encode( $value );
738
-	                    }
736
+						if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
737
+							$value = function_exists('wp_json_encode') ? wp_json_encode( $value ) : json_encode( $value );
738
+						}
739 739
 
740
-				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
741
-				        break;
740
+						update_post_meta( $post_id, $field->postCustomFieldName, $value );
741
+						break;
742 742
 
743
-				    case 'post_image':
744
-				        $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
745
-				        break;
743
+					case 'post_image':
744
+						$value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
745
+						break;
746 746
 
747 747
 				}
748 748
 
@@ -787,20 +787,20 @@  discard block
 block discarded – undo
787 787
 	 */
788 788
 	private function is_field_json_encoded( $field ) {
789 789
 
790
-	    $json_encoded = false;
790
+		$json_encoded = false;
791 791
 
792 792
 		$input_type = RGFormsModel::get_input_type( $field );
793 793
 
794
-	    // Only certain custom field types are supported
795
-	    switch( $input_type ) {
796
-		    case 'fileupload':
797
-		    case 'list':
798
-		    case 'multiselect':
799
-			    $json_encoded = true;
800
-			    break;
801
-	    }
794
+		// Only certain custom field types are supported
795
+		switch( $input_type ) {
796
+			case 'fileupload':
797
+			case 'list':
798
+			case 'multiselect':
799
+				$json_encoded = true;
800
+				break;
801
+		}
802 802
 
803
-	    return $json_encoded;
803
+		return $json_encoded;
804 804
 	}
805 805
 
806 806
 	/**
@@ -890,14 +890,14 @@  discard block
 block discarded – undo
890 890
 			?><h2 class="gv-edit-entry-title">
891 891
 				<span><?php
892 892
 
893
-				    /**
894
-				     * @filter `gravityview_edit_entry_title` Modify the edit entry title
895
-				     * @param string $edit_entry_title Modify the "Edit Entry" title
896
-				     * @param GravityView_Edit_Entry_Render $this This object
897
-				     */
898
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
893
+					/**
894
+					 * @filter `gravityview_edit_entry_title` Modify the edit entry title
895
+					 * @param string $edit_entry_title Modify the "Edit Entry" title
896
+					 * @param GravityView_Edit_Entry_Render $this This object
897
+					 */
898
+					$edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
899 899
 
900
-				    echo esc_attr( $edit_entry_title );
900
+					echo esc_attr( $edit_entry_title );
901 901
 			?></span>
902 902
 			</h2>
903 903
 
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 
1007 1007
 		ob_get_clean();
1008 1008
 
1009
-	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1009
+		remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1010 1010
 		remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1011 1011
 		remove_filter( 'gform_disable_view_counter', '__return_true' );
1012 1012
 		remove_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5 );
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
 
1061 1061
 		// for now we don't support Save and Continue feature.
1062 1062
 		if( ! self::$supports_save_and_continue ) {
1063
-	        unset( $form['save'] );
1063
+			unset( $form['save'] );
1064 1064
 		}
1065 1065
 
1066 1066
 		return $form;
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
 			|| ! empty( $field_content )
1136 1136
 			|| in_array( $field->type, array( 'honeypot' ) )
1137 1137
 		) {
1138
-	        return $field_content;
1138
+			return $field_content;
1139 1139
 		}
1140 1140
 
1141 1141
 		// SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -1143,24 +1143,24 @@  discard block
 block discarded – undo
1143 1143
 
1144 1144
 		$field_value = $this->get_field_value( $field );
1145 1145
 
1146
-	    // Prevent any PHP warnings, like undefined index
1147
-	    ob_start();
1146
+		// Prevent any PHP warnings, like undefined index
1147
+		ob_start();
1148 1148
 
1149
-	    $return = null;
1149
+		$return = null;
1150 1150
 
1151 1151
 		/** @var GravityView_Field $gv_field */
1152 1152
 		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1153 1153
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1154 1154
 		} else {
1155
-	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
1156
-	    }
1155
+			$return = $field->get_field_input( $this->form, $field_value, $this->entry );
1156
+		}
1157 1157
 
1158
-	    // If there was output, it's an error
1159
-	    $warnings = ob_get_clean();
1158
+		// If there was output, it's an error
1159
+		$warnings = ob_get_clean();
1160 1160
 
1161
-	    if( !empty( $warnings ) ) {
1162
-		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1163
-	    }
1161
+		if( !empty( $warnings ) ) {
1162
+			gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1163
+		}
1164 1164
 
1165 1165
 		return $return;
1166 1166
 	}
@@ -1195,8 +1195,8 @@  discard block
 block discarded – undo
1195 1195
 				$input_id = strval( $input['id'] );
1196 1196
 				
1197 1197
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1198
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1199
-				    $allow_pre_populated = false;
1198
+					$field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1199
+					$allow_pre_populated = false;
1200 1200
 				}
1201 1201
 
1202 1202
 			}
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
 			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1221 1221
 				$categories = array();
1222 1222
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1223
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1223
+					$categories[] = GFCommon::format_post_category( $cat_string, true );
1224 1224
 				}
1225 1225
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1226 1226
 			}
@@ -1230,25 +1230,25 @@  discard block
 block discarded – undo
1230 1230
 		// if value is empty get the default value if defined
1231 1231
 		$field_value = $field->get_value_default_if_empty( $field_value );
1232 1232
 
1233
-	    /**
1234
-	     * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1235
-	     * @since 1.11
1236
-	     * @since 1.20 Added third param
1237
-	     * @param mixed $field_value field value used to populate the input
1238
-	     * @param object $field Gravity Forms field object ( Class GF_Field )
1239
-	     * @param GravityView_Edit_Entry_Render $this Current object
1240
-	     */
1241
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1242
-
1243
-	    /**
1244
-	     * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1245
-	     * @since 1.17
1246
-	     * @since 1.20 Added third param
1247
-	     * @param mixed $field_value field value used to populate the input
1248
-	     * @param GF_Field $field Gravity Forms field object
1249
-	     * @param GravityView_Edit_Entry_Render $this Current object
1250
-	     */
1251
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1233
+		/**
1234
+		 * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1235
+		 * @since 1.11
1236
+		 * @since 1.20 Added third param
1237
+		 * @param mixed $field_value field value used to populate the input
1238
+		 * @param object $field Gravity Forms field object ( Class GF_Field )
1239
+		 * @param GravityView_Edit_Entry_Render $this Current object
1240
+		 */
1241
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1242
+
1243
+		/**
1244
+		 * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1245
+		 * @since 1.17
1246
+		 * @since 1.20 Added third param
1247
+		 * @param mixed $field_value field value used to populate the input
1248
+		 * @param GF_Field $field Gravity Forms field object
1249
+		 * @param GravityView_Edit_Entry_Render $this Current object
1250
+		 */
1251
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1252 1252
 
1253 1253
 		return $field_value;
1254 1254
 	}
@@ -1275,7 +1275,7 @@  discard block
 block discarded – undo
1275 1275
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1276 1276
 			// expects certain field array items to be set.
1277 1277
 			foreach ( array( 'noDuplicates', 'adminOnly', 'inputType', 'isRequired', 'enablePrice', 'inputs', 'allowedExtensions' ) as $key ) {
1278
-	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1278
+				$field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1279 1279
 			}
1280 1280
 
1281 1281
 			switch( RGFormsModel::get_input_type( $field ) ) {
@@ -1289,61 +1289,61 @@  discard block
 block discarded – undo
1289 1289
 				 */
1290 1290
 				case 'fileupload':
1291 1291
 
1292
-				    // Set the previous value
1293
-				    $entry = $this->get_entry();
1292
+					// Set the previous value
1293
+					$entry = $this->get_entry();
1294 1294
 
1295
-				    $input_name = 'input_'.$field->id;
1296
-				    $form_id = $form['id'];
1295
+					$input_name = 'input_'.$field->id;
1296
+					$form_id = $form['id'];
1297 1297
 
1298
-				    $value = NULL;
1298
+					$value = NULL;
1299 1299
 
1300
-				    // Use the previous entry value as the default.
1301
-				    if( isset( $entry[ $field->id ] ) ) {
1302
-				        $value = $entry[ $field->id ];
1303
-				    }
1300
+					// Use the previous entry value as the default.
1301
+					if( isset( $entry[ $field->id ] ) ) {
1302
+						$value = $entry[ $field->id ];
1303
+					}
1304 1304
 
1305
-				    // If this is a single upload file
1306
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1307
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1308
-				        $value = $file_path['url'];
1305
+					// If this is a single upload file
1306
+					if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1307
+						$file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1308
+						$value = $file_path['url'];
1309 1309
 
1310
-				    } else {
1310
+					} else {
1311 1311
 
1312
-				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1313
-				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1314
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1312
+						// Fix PHP warning on line 1498 of form_display.php for post_image fields
1313
+						// Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1314
+						$_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1315 1315
 
1316
-				    }
1316
+					}
1317 1317
 
1318
-				    if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1318
+					if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1319 1319
 
1320
-				        // If there are fresh uploads, process and merge them.
1321
-				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1322
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1323
-				            $value = empty( $value ) ? '[]' : $value;
1324
-				            $value = stripslashes_deep( $value );
1325
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1326
-				        }
1320
+						// If there are fresh uploads, process and merge them.
1321
+						// Otherwise, use the passed values, which should be json-encoded array of URLs
1322
+						if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1323
+							$value = empty( $value ) ? '[]' : $value;
1324
+							$value = stripslashes_deep( $value );
1325
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1326
+						}
1327 1327
 
1328
-				    } else {
1328
+					} else {
1329 1329
 
1330
-				        // A file already exists when editing an entry
1331
-				        // We set this to solve issue when file upload fields are required.
1332
-				        GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1330
+						// A file already exists when editing an entry
1331
+						// We set this to solve issue when file upload fields are required.
1332
+						GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1333 1333
 
1334
-				    }
1334
+					}
1335 1335
 
1336
-				    $this->entry[ $input_name ] = $value;
1337
-				    $_POST[ $input_name ] = $value;
1336
+					$this->entry[ $input_name ] = $value;
1337
+					$_POST[ $input_name ] = $value;
1338 1338
 
1339
-				    break;
1339
+					break;
1340 1340
 
1341 1341
 				case 'number':
1342
-				    // Fix "undefined index" issue at line 1286 in form_display.php
1343
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1344
-				        $_POST['input_'.$field->id ] = NULL;
1345
-				    }
1346
-				    break;
1342
+					// Fix "undefined index" issue at line 1286 in form_display.php
1343
+					if( !isset( $_POST['input_'.$field->id ] ) ) {
1344
+						$_POST['input_'.$field->id ] = NULL;
1345
+					}
1346
+					break;
1347 1347
 			}
1348 1348
 
1349 1349
 		}
@@ -1428,42 +1428,42 @@  discard block
 block discarded – undo
1428 1428
 				case 'fileupload' :
1429 1429
 				case 'post_image':
1430 1430
 
1431
-				    // in case nothing is uploaded but there are already files saved
1432
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1433
-				        $field->failed_validation = false;
1434
-				        unset( $field->validation_message );
1435
-				    }
1431
+					// in case nothing is uploaded but there are already files saved
1432
+					if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1433
+						$field->failed_validation = false;
1434
+						unset( $field->validation_message );
1435
+					}
1436 1436
 
1437
-				    // validate if multi file upload reached max number of files [maxFiles] => 2
1438
-				    if( rgobj( $field, 'maxFiles') && rgobj( $field, 'multipleFiles') ) {
1437
+					// validate if multi file upload reached max number of files [maxFiles] => 2
1438
+					if( rgobj( $field, 'maxFiles') && rgobj( $field, 'multipleFiles') ) {
1439 1439
 
1440
-				        $input_name = 'input_' . $field->id;
1441
-				        //uploaded
1442
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1440
+						$input_name = 'input_' . $field->id;
1441
+						//uploaded
1442
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1443 1443
 
1444
-				        //existent
1445
-				        $entry = $this->get_entry();
1446
-				        $value = NULL;
1447
-				        if( isset( $entry[ $field->id ] ) ) {
1448
-				            $value = json_decode( $entry[ $field->id ], true );
1449
-				        }
1444
+						//existent
1445
+						$entry = $this->get_entry();
1446
+						$value = NULL;
1447
+						if( isset( $entry[ $field->id ] ) ) {
1448
+							$value = json_decode( $entry[ $field->id ], true );
1449
+						}
1450 1450
 
1451
-				        // count uploaded files and existent entry files
1452
-				        $count_files = count( $file_names ) + count( $value );
1451
+						// count uploaded files and existent entry files
1452
+						$count_files = count( $file_names ) + count( $value );
1453 1453
 
1454
-				        if( $count_files > $field->maxFiles ) {
1455
-				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1456
-				            $field->failed_validation = 1;
1457
-				            $gv_valid = false;
1454
+						if( $count_files > $field->maxFiles ) {
1455
+							$field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1456
+							$field->failed_validation = 1;
1457
+							$gv_valid = false;
1458 1458
 
1459
-				            // in case of error make sure the newest upload files are removed from the upload input
1460
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1461
-				        }
1459
+							// in case of error make sure the newest upload files are removed from the upload input
1460
+							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1461
+						}
1462 1462
 
1463
-				    }
1463
+					}
1464 1464
 
1465 1465
 
1466
-				    break;
1466
+					break;
1467 1467
 
1468 1468
 			}
1469 1469
 
@@ -1474,47 +1474,47 @@  discard block
 block discarded – undo
1474 1474
 
1475 1475
 				switch ( $field_type ) {
1476 1476
 
1477
-				    // Captchas don't need to be re-entered.
1478
-				    case 'captcha':
1477
+					// Captchas don't need to be re-entered.
1478
+					case 'captcha':
1479 1479
 
1480
-				        // Post Image fields aren't editable, so we un-fail them.
1481
-				    case 'post_image':
1482
-				        $field->failed_validation = false;
1483
-				        unset( $field->validation_message );
1484
-				        break;
1480
+						// Post Image fields aren't editable, so we un-fail them.
1481
+					case 'post_image':
1482
+						$field->failed_validation = false;
1483
+						unset( $field->validation_message );
1484
+						break;
1485 1485
 
1486 1486
 				}
1487 1487
 
1488 1488
 				// You can't continue inside a switch, so we do it after.
1489 1489
 				if( empty( $field->failed_validation ) ) {
1490
-				    continue;
1490
+					continue;
1491 1491
 				}
1492 1492
 
1493 1493
 				// checks if the No Duplicates option is not validating entry against itself, since
1494 1494
 				// we're editing a stored entry, it would also assume it's a duplicate.
1495 1495
 				if( !empty( $field->noDuplicates ) ) {
1496 1496
 
1497
-				    $entry = $this->get_entry();
1497
+					$entry = $this->get_entry();
1498 1498
 
1499
-				    // If the value of the entry is the same as the stored value
1500
-				    // Then we can assume it's not a duplicate, it's the same.
1501
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1502
-				        //if value submitted was not changed, then don't validate
1503
-				        $field->failed_validation = false;
1499
+					// If the value of the entry is the same as the stored value
1500
+					// Then we can assume it's not a duplicate, it's the same.
1501
+					if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1502
+						//if value submitted was not changed, then don't validate
1503
+						$field->failed_validation = false;
1504 1504
 
1505
-				        unset( $field->validation_message );
1505
+						unset( $field->validation_message );
1506 1506
 
1507
-				        gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1507
+						gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1508 1508
 
1509
-				        continue;
1510
-				    }
1509
+						continue;
1510
+					}
1511 1511
 				}
1512 1512
 
1513 1513
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1514 1514
 				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1515
-				    unset( $field->validation_message );
1516
-	                $field->validation_message = false;
1517
-				    continue;
1515
+					unset( $field->validation_message );
1516
+					$field->validation_message = false;
1517
+					continue;
1518 1518
 				}
1519 1519
 
1520 1520
 				$gv_valid = false;
@@ -1578,8 +1578,8 @@  discard block
 block discarded – undo
1578 1578
 		// Hide fields depending on admin settings
1579 1579
 		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1580 1580
 
1581
-	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1582
-	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1581
+		// If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1582
+		$fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1583 1583
 
1584 1584
 		/**
1585 1585
 		 * @filter `gravityview/edit_entry/form_fields` Modify the fields displayed in Edit Entry form
@@ -1639,12 +1639,12 @@  discard block
 block discarded – undo
1639 1639
 		// The edit tab has been configured, so we loop through to configured settings
1640 1640
 		foreach ( $configured_fields as $configured_field ) {
1641 1641
 
1642
-	        /** @var GF_Field $field */
1643
-	        foreach ( $fields as $field ) {
1642
+			/** @var GF_Field $field */
1643
+			foreach ( $fields as $field ) {
1644 1644
 
1645 1645
 				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1646
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1647
-				    break;
1646
+					$edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1647
+					break;
1648 1648
 				}
1649 1649
 
1650 1650
 			}
@@ -1700,28 +1700,28 @@  discard block
 block discarded – undo
1700 1700
 	 */
1701 1701
 	private function filter_admin_only_fields( $fields = array(), $edit_fields = null, $form = array(), $view_id = 0 ) {
1702 1702
 
1703
-	    /**
1703
+		/**
1704 1704
 		 * @filter `gravityview/edit_entry/use_gf_admin_only_setting` When Edit tab isn't configured, should the Gravity Forms "Admin Only" field settings be used to control field display to non-admins? Default: true
1705
-	     * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1706
-	     * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1707
-	     * @since 1.9.1
1708
-	     * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions.
1709
-	     * @param array $form GF Form array
1710
-	     * @param int $view_id View ID
1711
-	     */
1712
-	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1713
-
1714
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1705
+		 * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1706
+		 * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1707
+		 * @since 1.9.1
1708
+		 * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions.
1709
+		 * @param array $form GF Form array
1710
+		 * @param int $view_id View ID
1711
+		 */
1712
+		$use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1713
+
1714
+		if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1715 1715
 			foreach( $fields as $k => $field ) {
1716 1716
 				if( $field->adminOnly ) {
1717
-				    unset( $fields[ $k ] );
1717
+					unset( $fields[ $k ] );
1718 1718
 				}
1719 1719
 			}
1720 1720
 			return $fields;
1721 1721
 		}
1722 1722
 
1723
-	    foreach( $fields as &$field ) {
1724
-		    $field->adminOnly = false;
1723
+		foreach( $fields as &$field ) {
1724
+			$field->adminOnly = false;
1725 1725
 		}
1726 1726
 
1727 1727
 		return $fields;
@@ -1754,36 +1754,36 @@  discard block
 block discarded – undo
1754 1754
 
1755 1755
 			if( 'checkbox' === $field->type ) {
1756 1756
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1757
-				    $input_id = $input['id'];
1758
-				    $choice = $field->choices[ $key ];
1759
-				    $value = \GV\Utils::get( $this->entry, $input_id );
1760
-				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1761
-				    if( $match ) {
1762
-				        $field->choices[ $key ]['isSelected'] = true;
1763
-				    }
1757
+					$input_id = $input['id'];
1758
+					$choice = $field->choices[ $key ];
1759
+					$value = \GV\Utils::get( $this->entry, $input_id );
1760
+					$match = RGFormsModel::choice_value_match( $field, $choice, $value );
1761
+					if( $match ) {
1762
+						$field->choices[ $key ]['isSelected'] = true;
1763
+					}
1764 1764
 				}
1765 1765
 			} else {
1766 1766
 
1767 1767
 				// We need to run through each field to set the default values
1768 1768
 				foreach ( $this->entry as $field_id => $field_value ) {
1769 1769
 
1770
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1770
+					if( floatval( $field_id ) === floatval( $field->id ) ) {
1771 1771
 
1772
-				        if( 'list' === $field->type ) {
1773
-				            $list_rows = maybe_unserialize( $field_value );
1772
+						if( 'list' === $field->type ) {
1773
+							$list_rows = maybe_unserialize( $field_value );
1774 1774
 
1775
-				            $list_field_value = array();
1776
-				            foreach ( (array) $list_rows as $row ) {
1777
-				                foreach ( (array) $row as $column ) {
1778
-				                    $list_field_value[] = $column;
1779
-				                }
1780
-				            }
1775
+							$list_field_value = array();
1776
+							foreach ( (array) $list_rows as $row ) {
1777
+								foreach ( (array) $row as $column ) {
1778
+									$list_field_value[] = $column;
1779
+								}
1780
+							}
1781 1781
 
1782
-				            $field->defaultValue = serialize( $list_field_value );
1783
-				        } else {
1784
-				            $field->defaultValue = $field_value;
1785
-				        }
1786
-				    }
1782
+							$field->defaultValue = serialize( $list_field_value );
1783
+						} else {
1784
+							$field->defaultValue = $field_value;
1785
+						}
1786
+					}
1787 1787
 				}
1788 1788
 			}
1789 1789
 		}
@@ -1840,7 +1840,7 @@  discard block
 block discarded – undo
1840 1840
 			return $has_conditional_logic;
1841 1841
 		}
1842 1842
 
1843
-	    /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1843
+		/** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1844 1844
 		return apply_filters( 'gravityview/edit_entry/conditional_logic', $has_conditional_logic, $form );
1845 1845
 	}
1846 1846
 
@@ -1907,14 +1907,14 @@  discard block
 block discarded – undo
1907 1907
 
1908 1908
 		if( $echo && $error !== true ) {
1909 1909
 
1910
-	        $error = esc_html( $error );
1910
+			$error = esc_html( $error );
1911 1911
 
1912
-	        /**
1913
-	         * @since 1.9
1914
-	         */
1915
-	        if ( ! empty( $this->entry ) ) {
1916
-		        $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
1917
-	        }
1912
+			/**
1913
+			 * @since 1.9
1914
+			 */
1915
+			if ( ! empty( $this->entry ) ) {
1916
+				$error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
1917
+			}
1918 1918
 
1919 1919
 			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1920 1920
 		}
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-admin.php 1 patch
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -10,175 +10,175 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 if ( ! defined( 'WPINC' ) ) {
13
-    die;
13
+	die;
14 14
 }
15 15
 
16 16
 
17 17
 class GravityView_Edit_Entry_Admin {
18 18
 
19
-    protected $loader;
19
+	protected $loader;
20 20
 
21
-    function __construct( GravityView_Edit_Entry $loader ) {
22
-        $this->loader = $loader;
23
-    }
21
+	function __construct( GravityView_Edit_Entry $loader ) {
22
+		$this->loader = $loader;
23
+	}
24 24
 
25
-    function load() {
26
-
27
-        if( !is_admin() ) {
28
-            return;
29
-        }
30
-
31
-        // Add Edit Link as a default field, outside those set in the Gravity Form form
32
-        add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
33
-
34
-        // For the Edit Entry Link, you don't want visible to all users.
35
-        add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 );
25
+	function load() {
26
+
27
+		if( !is_admin() ) {
28
+			return;
29
+		}
30
+
31
+		// Add Edit Link as a default field, outside those set in the Gravity Form form
32
+		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
33
+
34
+		// For the Edit Entry Link, you don't want visible to all users.
35
+		add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 );
36 36
 
37
-        // Modify the field options based on the name of the field type
38
-        add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 );
37
+		// Modify the field options based on the name of the field type
38
+		add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 );
39 39
 
40
-        // add tooltips
41
-        add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') );
42
-
43
-        // custom fields' options for zone EDIT
44
-        add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 5 );
45
-    }
46
-
47
-    /**
48
-     * Add Edit Link as a default field, outside those set in the Gravity Form form
49
-     * @param array $entry_default_fields Existing fields
50
-     * @param  string|array $form form_ID or form object
51
-     * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
52
-     */
53
-    function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
54
-
55
-        if( $zone !== 'edit' ) {
56
-
57
-            $entry_default_fields['edit_link'] = array(
58
-                'label' => __('Edit Entry', 'gravityview'),
59
-                'type' => 'edit_link',
60
-                'desc'	=> __('A link to edit the entry. Visible based on View settings.', 'gravityview'),
61
-            );
62
-
63
-        }
64
-
65
-        return $entry_default_fields;
66
-    }
67
-
68
-    /**
69
-     * Change wording for the Edit context to read Entry Creator
70
-     *
71
-     * @param  array 	   $visibility_caps        Array of capabilities to display in field dropdown.
72
-     * @param  string      $field_type  Type of field options to render (`field` or `widget`)
73
-     * @param  string      $template_id Table slug
74
-     * @param  float       $field_id    GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by`
75
-     * @param  string      $context     What context are we in? Example: `single` or `directory`
76
-     * @param  string      $input_type  (textarea, list, select, etc.)
77
-     * @return array                   Array of field options with `label`, `value`, `type`, `default` keys
78
-     */
79
-    function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
80
-
81
-        $caps = $visibility_caps;
82
-
83
-        // If we're configuring fields in the edit context, we want a limited selection
84
-        if( $context === 'edit' ) {
85
-
86
-            // Remove other built-in caps.
87
-            unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] );
88
-
89
-            $caps['read'] = _x('Entry Creator','User capability', 'gravityview');
90
-        }
91
-
92
-        return $caps;
93
-    }
94
-
95
-    /**
96
-     * Add "Edit Link Text" setting to the edit_link field settings
97
-     * @param  [type] $field_options [description]
98
-     * @param  [type] $template_id   [description]
99
-     * @param  [type] $field_id      [description]
100
-     * @param  [type] $context       [description]
101
-     * @param  [type] $input_type    [description]
102
-     * @return [type]                [description]
103
-     */
104
-    function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
105
-
106
-        // Always a link, never a filter
107
-        unset( $field_options['show_as_link'], $field_options['search_filter'] );
108
-
109
-        // Edit Entry link should only appear to visitors capable of editing entries
110
-        unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
111
-
112
-        $add_option['edit_link'] = array(
113
-            'type' => 'text',
114
-            'label' => __( 'Edit Link Text', 'gravityview' ),
115
-            'desc' => NULL,
116
-            'value' => __('Edit Entry', 'gravityview'),
117
-            'merge_tags' => true,
118
-        );
119
-
120
-        return array_merge( $add_option, $field_options );
121
-    }
122
-
123
-    /**
124
-     * Add tooltips
125
-     * @param  array $tooltips Existing tooltips
126
-     * @return array           Modified tooltips
127
-     */
128
-    function tooltips( $tooltips ) {
129
-
130
-        $return = $tooltips;
131
-
132
-        $return['allow_edit_cap'] = array(
133
-            'title' => __('Limiting Edit Access', 'gravityview'),
134
-            'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'),
135
-        );
136
-
137
-        return $return;
138
-    }
139
-
140
-    /**
141
-     * Manipulate the fields' options for the EDIT ENTRY screen
142
-     * @param  [type] $field_options [description]
143
-     * @param  [type] $template_id   [description]
144
-     * @param  [type] $field_id      [description]
145
-     * @param  [type] $context       [description]
146
-     * @param  [type] $input_type    [description]
147
-     * @return [type]                [description]
148
-     */
149
-    function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
150
-
151
-        // We only want to modify the settings for the edit context
152
-        if( 'edit' !== $context ) {
153
-
154
-            /**
155
-             * @since 1.8.4
156
-             */
157
-            $field_options['new_window'] = array(
158
-                'type' => 'checkbox',
159
-                'label' => __( 'Open link in a new tab or window?', 'gravityview' ),
160
-                'value' => false,
161
-            );
162
-
163
-            return $field_options;
164
-        }
165
-
166
-        //  Entry field is only for logged in users
167
-        unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
168
-
169
-        $add_options = array(
170
-            'allow_edit_cap' => array(
171
-                'type' => 'select',
172
-                'label' => __( 'Make field editable to:', 'gravityview' ),
173
-                'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
174
-                'tooltip' => 'allow_edit_cap',
175
-                'class' => 'widefat',
176
-                'value' => 'read', // Default: entry creator
177
-            ),
178
-        );
179
-
180
-        return array_merge( $field_options, $add_options );
181
-    }
40
+		// add tooltips
41
+		add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') );
42
+
43
+		// custom fields' options for zone EDIT
44
+		add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 5 );
45
+	}
46
+
47
+	/**
48
+	 * Add Edit Link as a default field, outside those set in the Gravity Form form
49
+	 * @param array $entry_default_fields Existing fields
50
+	 * @param  string|array $form form_ID or form object
51
+	 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
52
+	 */
53
+	function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
54
+
55
+		if( $zone !== 'edit' ) {
56
+
57
+			$entry_default_fields['edit_link'] = array(
58
+				'label' => __('Edit Entry', 'gravityview'),
59
+				'type' => 'edit_link',
60
+				'desc'	=> __('A link to edit the entry. Visible based on View settings.', 'gravityview'),
61
+			);
62
+
63
+		}
64
+
65
+		return $entry_default_fields;
66
+	}
67
+
68
+	/**
69
+	 * Change wording for the Edit context to read Entry Creator
70
+	 *
71
+	 * @param  array 	   $visibility_caps        Array of capabilities to display in field dropdown.
72
+	 * @param  string      $field_type  Type of field options to render (`field` or `widget`)
73
+	 * @param  string      $template_id Table slug
74
+	 * @param  float       $field_id    GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by`
75
+	 * @param  string      $context     What context are we in? Example: `single` or `directory`
76
+	 * @param  string      $input_type  (textarea, list, select, etc.)
77
+	 * @return array                   Array of field options with `label`, `value`, `type`, `default` keys
78
+	 */
79
+	function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
80
+
81
+		$caps = $visibility_caps;
82
+
83
+		// If we're configuring fields in the edit context, we want a limited selection
84
+		if( $context === 'edit' ) {
85
+
86
+			// Remove other built-in caps.
87
+			unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] );
88
+
89
+			$caps['read'] = _x('Entry Creator','User capability', 'gravityview');
90
+		}
91
+
92
+		return $caps;
93
+	}
94
+
95
+	/**
96
+	 * Add "Edit Link Text" setting to the edit_link field settings
97
+	 * @param  [type] $field_options [description]
98
+	 * @param  [type] $template_id   [description]
99
+	 * @param  [type] $field_id      [description]
100
+	 * @param  [type] $context       [description]
101
+	 * @param  [type] $input_type    [description]
102
+	 * @return [type]                [description]
103
+	 */
104
+	function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
105
+
106
+		// Always a link, never a filter
107
+		unset( $field_options['show_as_link'], $field_options['search_filter'] );
108
+
109
+		// Edit Entry link should only appear to visitors capable of editing entries
110
+		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
111
+
112
+		$add_option['edit_link'] = array(
113
+			'type' => 'text',
114
+			'label' => __( 'Edit Link Text', 'gravityview' ),
115
+			'desc' => NULL,
116
+			'value' => __('Edit Entry', 'gravityview'),
117
+			'merge_tags' => true,
118
+		);
119
+
120
+		return array_merge( $add_option, $field_options );
121
+	}
122
+
123
+	/**
124
+	 * Add tooltips
125
+	 * @param  array $tooltips Existing tooltips
126
+	 * @return array           Modified tooltips
127
+	 */
128
+	function tooltips( $tooltips ) {
129
+
130
+		$return = $tooltips;
131
+
132
+		$return['allow_edit_cap'] = array(
133
+			'title' => __('Limiting Edit Access', 'gravityview'),
134
+			'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'),
135
+		);
136
+
137
+		return $return;
138
+	}
139
+
140
+	/**
141
+	 * Manipulate the fields' options for the EDIT ENTRY screen
142
+	 * @param  [type] $field_options [description]
143
+	 * @param  [type] $template_id   [description]
144
+	 * @param  [type] $field_id      [description]
145
+	 * @param  [type] $context       [description]
146
+	 * @param  [type] $input_type    [description]
147
+	 * @return [type]                [description]
148
+	 */
149
+	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
150
+
151
+		// We only want to modify the settings for the edit context
152
+		if( 'edit' !== $context ) {
153
+
154
+			/**
155
+			 * @since 1.8.4
156
+			 */
157
+			$field_options['new_window'] = array(
158
+				'type' => 'checkbox',
159
+				'label' => __( 'Open link in a new tab or window?', 'gravityview' ),
160
+				'value' => false,
161
+			);
162
+
163
+			return $field_options;
164
+		}
165
+
166
+		//  Entry field is only for logged in users
167
+		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
168
+
169
+		$add_options = array(
170
+			'allow_edit_cap' => array(
171
+				'type' => 'select',
172
+				'label' => __( 'Make field editable to:', 'gravityview' ),
173
+				'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
174
+				'tooltip' => 'allow_edit_cap',
175
+				'class' => 'widefat',
176
+				'value' => 'read', // Default: entry creator
177
+			),
178
+		);
179
+
180
+		return array_merge( $field_options, $add_options );
181
+	}
182 182
 
183 183
 
184 184
 } // end class
185 185
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-ajax.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
 		// template areas
140 140
 		$template_areas_directory = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'directory' );
141
-        $template_areas_single = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'single' );
141
+		$template_areas_single = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'single' );
142 142
 
143 143
 		// widget areas
144 144
 		$default_widget_areas = GravityView_Widget::get_default_widget_areas();
@@ -331,40 +331,40 @@  discard block
 block discarded – undo
331 331
 		// load file
332 332
 		$xmlstr = file_get_contents( $form_file );
333 333
 
334
-        $options = array(
335
-            "page" => array("unserialize_as_array" => true),
336
-            "form"=> array("unserialize_as_array" => true),
337
-            "field"=> array("unserialize_as_array" => true),
338
-            "rule"=> array("unserialize_as_array" => true),
339
-            "choice"=> array("unserialize_as_array" => true),
340
-            "input"=> array("unserialize_as_array" => true),
341
-            "routing_item"=> array("unserialize_as_array" => true),
342
-            "creditCard"=> array("unserialize_as_array" => true),
343
-            "routin"=> array("unserialize_as_array" => true),
344
-            "confirmation" => array("unserialize_as_array" => true),
345
-            "notification" => array("unserialize_as_array" => true)
346
-        );
334
+		$options = array(
335
+			"page" => array("unserialize_as_array" => true),
336
+			"form"=> array("unserialize_as_array" => true),
337
+			"field"=> array("unserialize_as_array" => true),
338
+			"rule"=> array("unserialize_as_array" => true),
339
+			"choice"=> array("unserialize_as_array" => true),
340
+			"input"=> array("unserialize_as_array" => true),
341
+			"routing_item"=> array("unserialize_as_array" => true),
342
+			"creditCard"=> array("unserialize_as_array" => true),
343
+			"routin"=> array("unserialize_as_array" => true),
344
+			"confirmation" => array("unserialize_as_array" => true),
345
+			"notification" => array("unserialize_as_array" => true)
346
+		);
347 347
 
348 348
 		$xml = new RGXML($options);
349
-        $forms = $xml->unserialize($xmlstr);
349
+		$forms = $xml->unserialize($xmlstr);
350 350
 
351
-        if( !$forms ) {
352
-        	gravityview()->log->error( 'Importing Form Fields for preset [{template_id}]. Error importing file. (File) {path}', array( 'template_id' => $template_id, 'path' => $form_file ) );
353
-        	return false;
354
-        }
351
+		if( !$forms ) {
352
+			gravityview()->log->error( 'Importing Form Fields for preset [{template_id}]. Error importing file. (File) {path}', array( 'template_id' => $template_id, 'path' => $form_file ) );
353
+			return false;
354
+		}
355 355
 
356
-        if( !empty( $forms[0] ) && is_array( $forms[0] ) ) {
357
-        	$form = $forms[0];
358
-        }
356
+		if( !empty( $forms[0] ) && is_array( $forms[0] ) ) {
357
+			$form = $forms[0];
358
+		}
359 359
 
360
-        if( empty( $form ) ) {
361
-        	gravityview()->log->error( '$form not set.', array( 'data' => $forms ) );
362
-        	return false;
363
-        }
360
+		if( empty( $form ) ) {
361
+			gravityview()->log->error( '$form not set.', array( 'data' => $forms ) );
362
+			return false;
363
+		}
364 364
 
365
-        gravityview()->log->debug( '[pre_get_available_fields] Importing Form Fields for preset [{template_id}]. (Form)', array( 'template_id' => $template_id, 'data' => $form ) );
365
+		gravityview()->log->debug( '[pre_get_available_fields] Importing Form Fields for preset [{template_id}]. (Form)', array( 'template_id' => $template_id, 'data' => $form ) );
366 366
 
367
-        return $form;
367
+		return $form;
368 368
 
369 369
 	}
370 370
 
Please login to merge, or discard this patch.
includes/class-admin-views.php 1 patch
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -62,28 +62,28 @@  discard block
 block discarded – undo
62 62
 	}
63 63
 
64 64
 	/**
65
-     * When on the Add/Edit View screen, suggest most popular articles related to that
66
-     *
65
+	 * When on the Add/Edit View screen, suggest most popular articles related to that
66
+	 *
67 67
 	 * @param array $localization_data Data to be passed to the Support Port JS
68 68
 	 *
69 69
 	 * @return array
70 70
 	 */
71 71
 	function suggest_support_articles( $localization_data = array() ) {
72 72
 
73
-	    if( ! gravityview()->request->is_view() ) {
74
-	        return $localization_data;
75
-        }
73
+		if( ! gravityview()->request->is_view() ) {
74
+			return $localization_data;
75
+		}
76 76
 
77 77
 		$localization_data['suggest'] = array(
78
-            '57ef23539033602e61d4a560',
79
-            '54c67bb9e4b0512429885513',
80
-            '54c67bb9e4b0512429885512',
81
-            '54c67bbbe4b07997ea3f3f6b',
82
-            '54d1a33ae4b086c0c0964ce9',
83
-            '57ef253c9033602e61d4a563',
84
-            '552355bfe4b0221aadf2572b',
85
-            '54c67bcde4b051242988553e',
86
-        );
78
+			'57ef23539033602e61d4a560',
79
+			'54c67bb9e4b0512429885513',
80
+			'54c67bb9e4b0512429885512',
81
+			'54c67bbbe4b07997ea3f3f6b',
82
+			'54d1a33ae4b086c0c0964ce9',
83
+			'57ef253c9033602e61d4a563',
84
+			'552355bfe4b0221aadf2572b',
85
+			'54c67bcde4b051242988553e',
86
+		);
87 87
 
88 88
 		return $localization_data;
89 89
 	}
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 
168 168
 		if( empty( $connected_views ) ) {
169 169
 
170
-		    $menu_items['gravityview'] = array(
170
+			$menu_items['gravityview'] = array(
171 171
 				'label'          => esc_attr__( 'Create a View', 'gravityview' ),
172 172
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
173 173
 				'title'          => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
 		// If there were no items added, then let's create the parent menu
199 199
 		if( $sub_menu_items ) {
200 200
 
201
-		    $sub_menu_items[] = array(
202
-			    'label' => esc_attr__( 'Create a View', 'gravityview' ),
203
-                'link_class' => 'gv-create-view',
204
-			    'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
205
-			    'url'   => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ),
206
-			    'capabilities'   => array( 'edit_gravityviews' ),
207
-            );
201
+			$sub_menu_items[] = array(
202
+				'label' => esc_attr__( 'Create a View', 'gravityview' ),
203
+				'link_class' => 'gv-create-view',
204
+				'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
205
+				'url'   => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ),
206
+				'capabilities'   => array( 'edit_gravityviews' ),
207
+			);
208 208
 
209 209
 			// Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown
210 210
 			$sub_menu_items[] = array(
@@ -587,12 +587,12 @@  discard block
 block discarded – undo
587 587
 	 * Render html for displaying available fields based on a Form ID
588 588
 	 * $blacklist_field_types - contains the field types which are not proper to be shown in a directory.
589 589
 	 *
590
-     * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action
590
+	 * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action
591 591
 	 * @access public
592
-     *
592
+	 *
593 593
 	 * @param int $form Gravity Forms Form ID (default: '')
594 594
 	 * @param string $context (default: 'single')
595
-     *
595
+	 *
596 596
 	 * @return void
597 597
 	 */
598 598
 	function render_available_fields( $form = 0, $context = 'single' ) {
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 
607 607
 		if ( ! is_array( $blacklist_field_types ) ) {
608 608
 
609
-		    gravityview()->log->error( '$blacklist_field_types is not an array', array( 'data' => print_r( $blacklist_field_types, true ) ) );
609
+			gravityview()->log->error( '$blacklist_field_types is not an array', array( 'data' => print_r( $blacklist_field_types, true ) ) );
610 610
 
611 611
 			$blacklist_field_types = array();
612 612
 		}
@@ -738,12 +738,12 @@  discard block
 block discarded – undo
738 738
 				/**
739 739
 				 * @since 1.7.2
740 740
 				 */
741
-			    'other_entries' => array(
742
-				    'label'	=> __('Other Entries', 'gravityview'),
743
-				    'type'	=> 'other_entries',
744
-				    'desc'	=> __('Display other entries created by the entry creator.', 'gravityview'),
745
-			    ),
746
-	        );
741
+				'other_entries' => array(
742
+					'label'	=> __('Other Entries', 'gravityview'),
743
+					'type'	=> 'other_entries',
744
+					'desc'	=> __('Display other entries created by the entry creator.', 'gravityview'),
745
+				),
746
+			);
747 747
 
748 748
 			if( 'single' !== $zone) {
749 749
 
@@ -1084,59 +1084,59 @@  discard block
 block discarded – undo
1084 1084
 
1085 1085
 		// Don't process any scripts below here if it's not a GravityView page.
1086 1086
 		if( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) {
1087
-		    return;
1087
+			return;
1088 1088
 		}
1089 1089
 
1090
-        wp_enqueue_script( 'jquery-ui-datepicker' );
1091
-        wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version );
1092
-
1093
-        $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
1094
-
1095
-        //enqueue scripts
1096
-        wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version );
1097
-
1098
-        wp_localize_script('gravityview_views_scripts', 'gvGlobals', array(
1099
-            'cookiepath' => COOKIEPATH,
1100
-            'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ),
1101
-            'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ),
1102
-            'label_viewname' => __( 'Enter View name here', 'gravityview' ),
1103
-            'label_close' => __( 'Close', 'gravityview' ),
1104
-            'label_cancel' => __( 'Cancel', 'gravityview' ),
1105
-            'label_continue' => __( 'Continue', 'gravityview' ),
1106
-            'label_ok' => __( 'Ok', 'gravityview' ),
1107
-            'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ),
1108
-            'loading_text' => esc_html__( 'Loading&hellip;', 'gravityview' ),
1109
-            'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ),
1110
-            'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ),
1111
-            'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ),
1112
-        ));
1113
-
1114
-        wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version );
1115
-
1116
-        // Enqueue scripts needed for merge tags
1117
-        self::enqueue_gravity_forms_scripts();
1090
+		wp_enqueue_script( 'jquery-ui-datepicker' );
1091
+		wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version );
1092
+
1093
+		$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
1094
+
1095
+		//enqueue scripts
1096
+		wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version );
1097
+
1098
+		wp_localize_script('gravityview_views_scripts', 'gvGlobals', array(
1099
+			'cookiepath' => COOKIEPATH,
1100
+			'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ),
1101
+			'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ),
1102
+			'label_viewname' => __( 'Enter View name here', 'gravityview' ),
1103
+			'label_close' => __( 'Close', 'gravityview' ),
1104
+			'label_cancel' => __( 'Cancel', 'gravityview' ),
1105
+			'label_continue' => __( 'Continue', 'gravityview' ),
1106
+			'label_ok' => __( 'Ok', 'gravityview' ),
1107
+			'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ),
1108
+			'loading_text' => esc_html__( 'Loading&hellip;', 'gravityview' ),
1109
+			'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ),
1110
+			'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ),
1111
+			'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ),
1112
+		));
1113
+
1114
+		wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version );
1115
+
1116
+		// Enqueue scripts needed for merge tags
1117
+		self::enqueue_gravity_forms_scripts();
1118 1118
 	}
1119 1119
 
1120 1120
 	/**
1121 1121
 	 * Enqueue Gravity Forms scripts, needed for Merge Tags
1122
-     *
1123
-     * @since 1.0.5-beta
1124
-     *
1125
-     * @return void
1122
+	 *
1123
+	 * @since 1.0.5-beta
1124
+	 *
1125
+	 * @return void
1126 1126
 	 */
1127 1127
 	static function enqueue_gravity_forms_scripts() {
1128 1128
 		GFForms::register_scripts();
1129 1129
 
1130 1130
 		$scripts = array(
1131
-		    'sack',
1132
-		    'gform_gravityforms',
1133
-		    'gform_forms',
1134
-		    'gform_form_admin',
1135
-		    'jquery-ui-autocomplete'
1131
+			'sack',
1132
+			'gform_gravityforms',
1133
+			'gform_forms',
1134
+			'gform_form_admin',
1135
+			'jquery-ui-autocomplete'
1136 1136
 		);
1137 1137
 
1138 1138
 		if ( wp_is_mobile() ) {
1139
-		    $scripts[] = 'jquery-touch-punch';
1139
+			$scripts[] = 'jquery-touch-punch';
1140 1140
 		}
1141 1141
 
1142 1142
 		wp_enqueue_script( $scripts );
Please login to merge, or discard this patch.
includes/class-gravityview-merge-tags.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,14 +52,14 @@  discard block
 block discarded – undo
52 52
 		// matching regex => the value is the method to call to replace the value.
53 53
 		$gv_modifiers = array(
54 54
 			'maxwords:(\d+)' => 'modifier_maxwords', /** @see modifier_maxwords */
55
-		    'timestamp' => 'modifier_timestamp', /** @see modifier_timestamp */
55
+			'timestamp' => 'modifier_timestamp', /** @see modifier_timestamp */
56 56
 			'explode' => 'modifier_explode', /** @see modifier_explode */
57 57
 
58 58
 			/** @see modifier_strings */
59 59
 			'urlencode' => 'modifier_strings',
60 60
 			'wpautop' => 'modifier_strings',
61
-		    'esc_html' => 'modifier_strings',
62
-		    'sanitize_html_class' => 'modifier_strings',
61
+			'esc_html' => 'modifier_strings',
62
+			'sanitize_html_class' => 'modifier_strings',
63 63
 			'sanitize_title' => 'modifier_strings',
64 64
 			'strtolower' => 'modifier_strings',
65 65
 			'strtoupper' => 'modifier_strings',
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 
458 458
 		$atts = array(
459 459
 			'format' => self::get_format_from_modifiers( $exploded, false ),
460
-		    'human' => in_array( 'human', $exploded ), // {date_created:human}
460
+			'human' => in_array( 'human', $exploded ), // {date_created:human}
461 461
 			'diff' => in_array( 'diff', $exploded ), // {date_created:diff}
462 462
 			'raw' => in_array( 'raw', $exploded ), // {date_created:raw}
463 463
 			'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-custom.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
 				$field_data = array(
110 110
 					'label' => \GV\Utils::get( $edit_field, 'custom_label' ),
111 111
 					'customLabel' => \GV\Utils::get( $edit_field, 'custom_label' ),
112
-				    'content' => \GV\Utils::get( $edit_field, 'content' ),
112
+					'content' => \GV\Utils::get( $edit_field, 'content' ),
113 113
 				);
114 114
 
115 115
 				// Replace merge tags in the content
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-is-starred.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	}
36 36
 
37 37
 	private function add_hooks() {
38
-	    /** @see \GV\Field::get_value_filters */
38
+		/** @see \GV\Field::get_value_filters */
39 39
 		add_filter( "gravityview/field/{$this->name}/output", array( $this, 'get_content' ), 4, 2 );
40 40
 		add_action( 'gravityview/template/after', array( $this, 'print_script'), 10, 1 );
41 41
 		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	public function get_content( $output, $template ) {
77 77
 		$entry = $template->entry;
78 78
 
79
-	    $star_url = GFCommon::get_base_url() .'/images/star' . intval( $entry['is_starred'] ) .'.png';
79
+		$star_url = GFCommon::get_base_url() .'/images/star' . intval( $entry['is_starred'] ) .'.png';
80 80
 
81 81
 		$entry_id = '';
82 82
 
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
 
95 95
 	/**
96 96
 	 * Add JS to the bottom of the View if there is a star field and user has `gravityview_edit_entries` cap
97
-     *
97
+	 *
98 98
 	 * @param \GV\Template_Context $context The template context
99
-     * @since 2.0
100
-     *
101
-     * @return void
99
+	 * @since 2.0
100
+	 *
101
+	 * @return void
102 102
 	 */
103 103
 	public function print_script( $context ) {
104 104
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		}
108 108
 
109 109
 		if ( ! GravityView_Roles_Capabilities::has_cap( 'gravityview_edit_entries' ) ) {
110
-            return;
110
+			return;
111 111
 		}
112 112
 
113 113
 		?>
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-fileupload.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -341,7 +341,7 @@
 block discarded – undo
341 341
 				 */
342 342
 				$content = apply_filters( 'gravityview/fields/fileupload/link_content', $content, $field_compat, $context );
343 343
 
344
-                $content = gravityview_get_link( $link, $content, $link_atts );
344
+				$content = gravityview_get_link( $link, $content, $link_atts );
345 345
 			}
346 346
 
347 347
 			$output_arr[] = array(
Please login to merge, or discard this patch.
includes/class-gravityview-change-entry-creator.php 1 patch
Indentation   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -5,251 +5,251 @@
 block discarded – undo
5 5
  */
6 6
 class GravityView_Change_Entry_Creator {
7 7
 
8
-    function __construct() {
9
-
10
-    	/**
11
-    	 * @since  1.5.1
12
-    	 */
13
-    	add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 );
14
-
15
-    	// ONLY ADMIN FROM HERE ON.
16
-    	if( !is_admin() ) { return; }
17
-
18
-	    /**
19
-         * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality
20
-	     * @since 1.7.4
21
-	     * @param boolean $disable Disable the Change Entry Creator functionality. Default: false.
22
-	     */
23
-	    if( apply_filters('gravityview_disable_change_entry_creator', false ) ) {
24
-		    return;
25
-	    }
26
-
27
-        /**
28
-         * Use `init` to fix bbPress warning
29
-         * @see https://bbpress.trac.wordpress.org/ticket/2309
30
-         */
31
-    	add_action('init', array( $this, 'load'), 100 );
32
-
33
-    	add_action('plugins_loaded', array( $this, 'prevent_conflicts') );
34
-
35
-    }
36
-
37
-    /**
38
-     * When an user is created using the User Registration add-on, assign the entry to them
39
-     *
40
-     * @since  1.5.1
41
-     * @uses RGFormsModel::update_lead_property() Modify the entry `created_by` field
42
-     * @param  int $user_id  WordPress User ID
43
-     * @param  array $config   User registration feed configuration
44
-     * @param  array  $entry     GF Entry array
45
-     * @param  string $password User password
46
-     * @return void
47
-     */
48
-    function assign_new_user_to_lead( $user_id, $config, $entry = array(), $password = '' ) {
49
-
50
-    	/**
51
-    	 * Disable assigning the new user to the entry by returning false.
52
-    	 * @param  int $user_id  WordPress User ID
53
-	     * @param  array $config   User registration feed configuration
54
-	     * @param  array  $entry     GF Entry array
55
-    	 */
56
-    	$assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry );
57
-
58
-    	// If filter returns false, do not process
59
-    	if( empty( $assign_to_lead ) ) {
60
-    		return;
61
-    	}
62
-
63
-    	// Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing
64
-    	$result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true );
65
-
66
-    	if( empty( $result ) ) {
67
-    		$status = __('Error', 'gravityview');
68
-    	} else {
69
-    		$status = __('Success', 'gravityview');
70
-    	}
71
-
72
-    	$note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id );
73
-
74
-    	gravityview()->log->debug( 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - {note}', array( 'note', $note ) );
75
-
76
-	    /**
77
-	     * @filter `gravityview_disable_change_entry_creator_note` Disable adding a note when changing the entry creator
78
-	     * @since 1.21.5
79
-	     * @param boolean $disable Disable the Change Entry Creator note. Default: false.
80
-	     */
81
-	    if( apply_filters('gravityview_disable_change_entry_creator_note', false ) ) {
82
-		    return;
83
-	    }
84
-
85
-        GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' );
8
+	function __construct() {
9
+
10
+		/**
11
+		 * @since  1.5.1
12
+		 */
13
+		add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 );
14
+
15
+		// ONLY ADMIN FROM HERE ON.
16
+		if( !is_admin() ) { return; }
17
+
18
+		/**
19
+		 * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality
20
+		 * @since 1.7.4
21
+		 * @param boolean $disable Disable the Change Entry Creator functionality. Default: false.
22
+		 */
23
+		if( apply_filters('gravityview_disable_change_entry_creator', false ) ) {
24
+			return;
25
+		}
26
+
27
+		/**
28
+		 * Use `init` to fix bbPress warning
29
+		 * @see https://bbpress.trac.wordpress.org/ticket/2309
30
+		 */
31
+		add_action('init', array( $this, 'load'), 100 );
32
+
33
+		add_action('plugins_loaded', array( $this, 'prevent_conflicts') );
34
+
35
+	}
36
+
37
+	/**
38
+	 * When an user is created using the User Registration add-on, assign the entry to them
39
+	 *
40
+	 * @since  1.5.1
41
+	 * @uses RGFormsModel::update_lead_property() Modify the entry `created_by` field
42
+	 * @param  int $user_id  WordPress User ID
43
+	 * @param  array $config   User registration feed configuration
44
+	 * @param  array  $entry     GF Entry array
45
+	 * @param  string $password User password
46
+	 * @return void
47
+	 */
48
+	function assign_new_user_to_lead( $user_id, $config, $entry = array(), $password = '' ) {
49
+
50
+		/**
51
+		 * Disable assigning the new user to the entry by returning false.
52
+		 * @param  int $user_id  WordPress User ID
53
+		 * @param  array $config   User registration feed configuration
54
+		 * @param  array  $entry     GF Entry array
55
+		 */
56
+		$assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry );
57
+
58
+		// If filter returns false, do not process
59
+		if( empty( $assign_to_lead ) ) {
60
+			return;
61
+		}
62
+
63
+		// Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing
64
+		$result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true );
65
+
66
+		if( empty( $result ) ) {
67
+			$status = __('Error', 'gravityview');
68
+		} else {
69
+			$status = __('Success', 'gravityview');
70
+		}
71
+
72
+		$note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id );
73
+
74
+		gravityview()->log->debug( 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - {note}', array( 'note', $note ) );
75
+
76
+		/**
77
+		 * @filter `gravityview_disable_change_entry_creator_note` Disable adding a note when changing the entry creator
78
+		 * @since 1.21.5
79
+		 * @param boolean $disable Disable the Change Entry Creator note. Default: false.
80
+		 */
81
+		if( apply_filters('gravityview_disable_change_entry_creator_note', false ) ) {
82
+			return;
83
+		}
84
+
85
+		GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' );
86 86
 
87
-    }
87
+	}
88 88
 
89
-    /**
90
-     * Disable previous functionality; use this one as the canonical.
91
-     * @return void
92
-     */
93
-    function prevent_conflicts() {
89
+	/**
90
+	 * Disable previous functionality; use this one as the canonical.
91
+	 * @return void
92
+	 */
93
+	function prevent_conflicts() {
94 94
 
95
-    	// Plugin that was provided here:
96
-    	// @link https://gravityview.co/support/documentation/201991205/
97
-    	remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10 );
98
-    	remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10 );
99
-
100
-    	// Disable for Gravity Forms Add-ons 3.6.2 and lower
101
-    	if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) {
95
+		// Plugin that was provided here:
96
+		// @link https://gravityview.co/support/documentation/201991205/
97
+		remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10 );
98
+		remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10 );
99
+
100
+		// Disable for Gravity Forms Add-ons 3.6.2 and lower
101
+		if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) {
102 102
 
103
-    		$Old_Lead_Creator = new KWS_GF_Change_Lead_Creator;
103
+			$Old_Lead_Creator = new KWS_GF_Change_Lead_Creator;
104 104
 
105
-    		// Now, no validation is required in the methods; let's hook in.
106
-    		remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) );
107
-
108
-    		remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10 );
109
-
110
-    		remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10 );
111
-    	}
112
-
113
-    }
114
-
115
-    /**
116
-     * @since  3.6.3
117
-     * @return void
118
-     */
119
-    function load() {
105
+			// Now, no validation is required in the methods; let's hook in.
106
+			remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) );
107
+
108
+			remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10 );
109
+
110
+			remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10 );
111
+		}
112
+
113
+	}
114
+
115
+	/**
116
+	 * @since  3.6.3
117
+	 * @return void
118
+	 */
119
+	function load() {
120 120
 
121
-    	// Does GF exist?
122
-        if( !class_exists('GFCommon') ) {
123
-            return;
124
-        }
121
+		// Does GF exist?
122
+		if( !class_exists('GFCommon') ) {
123
+			return;
124
+		}
125 125
 
126
-        // Can the user edit entries?
127
-        if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) {
128
-            return;
129
-        }
126
+		// Can the user edit entries?
127
+		if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) {
128
+			return;
129
+		}
130 130
 
131
-        // If screen mode isn't set, then we're in the wrong place.
132
-        if( empty( $_REQUEST['screen_mode'] ) ) {
133
-            return;
134
-        }
131
+		// If screen mode isn't set, then we're in the wrong place.
132
+		if( empty( $_REQUEST['screen_mode'] ) ) {
133
+			return;
134
+		}
135 135
 
136
-        // Now, no validation is required in the methods; let's hook in.
137
-        add_action('admin_init', array( &$this, 'set_screen_mode' ) );
136
+		// Now, no validation is required in the methods; let's hook in.
137
+		add_action('admin_init', array( &$this, 'set_screen_mode' ) );
138 138
 
139
-        add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2);
139
+		add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2);
140 140
 
141
-        add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2);
141
+		add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2);
142 142
 
143
-    }
143
+	}
144 144
 
145
-    /**
146
-     * Allows for edit links to work with a link instead of a form (GET instead of POST)
147
-     * @return void
148
-     */
149
-    function set_screen_mode() {
145
+	/**
146
+	 * Allows for edit links to work with a link instead of a form (GET instead of POST)
147
+	 * @return void
148
+	 */
149
+	function set_screen_mode() {
150 150
 
151
-    	// If $_GET['screen_mode'] is set to edit, set $_POST value
152
-        if( \GV\Utils::_GET( 'screen_mode' ) === 'edit' ) {
153
-            $_POST["screen_mode"] = 'edit';
154
-        }
151
+		// If $_GET['screen_mode'] is set to edit, set $_POST value
152
+		if( \GV\Utils::_GET( 'screen_mode' ) === 'edit' ) {
153
+			$_POST["screen_mode"] = 'edit';
154
+		}
155 155
 
156
-    }
156
+	}
157 157
 
158
-    /**
159
-     * When the entry creator is changed, add a note to the entry
160
-     * @param  array $form   GF entry array
161
-     * @param  int $entry_id Entry ID
162
-     * @return void
163
-     */
164
-    function update_entry_creator($form, $entry_id) {
165
-            global $current_user;
158
+	/**
159
+	 * When the entry creator is changed, add a note to the entry
160
+	 * @param  array $form   GF entry array
161
+	 * @param  int $entry_id Entry ID
162
+	 * @return void
163
+	 */
164
+	function update_entry_creator($form, $entry_id) {
165
+			global $current_user;
166 166
 
167
-        // Update the entry
168
-        $created_by = absint( \GV\Utils::_POST( 'created_by') );
167
+		// Update the entry
168
+		$created_by = absint( \GV\Utils::_POST( 'created_by') );
169 169
 
170
-        RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by );
170
+		RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by );
171 171
 
172
-        // If the creator has changed, let's add a note about who it used to be.
173
-        $originally_created_by = \GV\Utils::_POST( 'originally_created_by' );
172
+		// If the creator has changed, let's add a note about who it used to be.
173
+		$originally_created_by = \GV\Utils::_POST( 'originally_created_by' );
174 174
 
175
-        // If there's no owner and there didn't used to be, keep going
176
-        if( empty( $originally_created_by ) && empty( $created_by ) ) {
177
-            return;
178
-        }
175
+		// If there's no owner and there didn't used to be, keep going
176
+		if( empty( $originally_created_by ) && empty( $created_by ) ) {
177
+			return;
178
+		}
179 179
 
180
-        // If the values have changed
181
-        if( absint( $originally_created_by ) !== absint( $created_by ) ) {
180
+		// If the values have changed
181
+		if( absint( $originally_created_by ) !== absint( $created_by ) ) {
182 182
 
183
-            $user_data = get_userdata($current_user->ID);
183
+			$user_data = get_userdata($current_user->ID);
184 184
 
185
-            $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview');
185
+			$user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview');
186 186
 
187
-            $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview');
187
+			$original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview');
188 188
 
189
-            if( !empty( $originally_created_by ) ) {
190
-                $originally_created_by_user_data = get_userdata($originally_created_by);
191
-                $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID );
192
-            }
189
+			if( !empty( $originally_created_by ) ) {
190
+				$originally_created_by_user_data = get_userdata($originally_created_by);
191
+				$original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID );
192
+			}
193 193
 
194
-            if( !empty( $created_by ) ) {
195
-                $created_by_user_data =  get_userdata($created_by);
196
-                $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID );
197
-            }
194
+			if( !empty( $created_by ) ) {
195
+				$created_by_user_data =  get_userdata($created_by);
196
+				$created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID );
197
+			}
198 198
 
199
-            GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' );
200
-        }
199
+			GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' );
200
+		}
201 201
 
202
-    }
202
+	}
203 203
 
204
-    /**
205
-     * Output the select to change the entry creator
206
-     * @param int $form_id GF Form ID
207
-     * @param array $entry    GF entry array
208
-     * @return void
209
-     */
210
-    function add_select($form_id, $entry ) {
204
+	/**
205
+	 * Output the select to change the entry creator
206
+	 * @param int $form_id GF Form ID
207
+	 * @param array $entry    GF entry array
208
+	 * @return void
209
+	 */
210
+	function add_select($form_id, $entry ) {
211 211
 
212
-        if( \GV\Utils::_POST( 'screen_mode' ) !== 'edit' ) {
213
-            return;
214
-        }
212
+		if( \GV\Utils::_POST( 'screen_mode' ) !== 'edit' ) {
213
+			return;
214
+		}
215 215
 
216
-        $created_by_id = \GV\Utils::get( $entry, 'created_by' );
216
+		$created_by_id = \GV\Utils::get( $entry, 'created_by' );
217 217
 
218
-        $users = GVCommon::get_users( 'change_entry_creator' );
218
+		$users = GVCommon::get_users( 'change_entry_creator' );
219 219
 
220
-        $is_created_by_in_users = wp_list_filter( $users, array( 'ID' => $created_by_id ) );
220
+		$is_created_by_in_users = wp_list_filter( $users, array( 'ID' => $created_by_id ) );
221 221
 
222
-        // Make sure that the entry creator is included in the users list. If not, add them.
223
-        if ( ! empty( $created_by_id ) && empty( $is_created_by_in_users ) ) {
222
+		// Make sure that the entry creator is included in the users list. If not, add them.
223
+		if ( ! empty( $created_by_id ) && empty( $is_created_by_in_users ) ) {
224 224
 
225
-	        if ( $created_by_user = GVCommon::get_users( 'change_entry_creator', array( 'include' => $created_by_id ) ) ) {
226
-	            $users = array_merge( $users, $created_by_user );
227
-	        }
228
-	    }
225
+			if ( $created_by_user = GVCommon::get_users( 'change_entry_creator', array( 'include' => $created_by_id ) ) ) {
226
+				$users = array_merge( $users, $created_by_user );
227
+			}
228
+		}
229 229
 
230
-        $output = '<label for="change_created_by">';
231
-        $output .= esc_html__('Change Entry Creator:', 'gravityview');
232
-        $output .= '</label>';
230
+		$output = '<label for="change_created_by">';
231
+		$output .= esc_html__('Change Entry Creator:', 'gravityview');
232
+		$output .= '</label>';
233 233
 
234
-	    // If there are users who are not being shown, show a warning.
235
-	    // TODO: Use AJAX instead of <select>
236
-	    $count_users = count_users();
237
-	    if( sizeof( $users ) < $count_users['total_users'] ) {
238
-		    $output .= '<p><i class="dashicons dashicons-warning"></i> ' . sprintf( esc_html__( 'The displayed list of users has been trimmed due to the large number of users. %sLearn how to remove this limit%s.', 'gravityview' ), '<a href="https://docs.gravityview.co/article/251-i-only-see-some-users-in-the-change-entry-creator-dropdown" rel="external">', '</a>' ) . '</p>';
239
-	    }
234
+		// If there are users who are not being shown, show a warning.
235
+		// TODO: Use AJAX instead of <select>
236
+		$count_users = count_users();
237
+		if( sizeof( $users ) < $count_users['total_users'] ) {
238
+			$output .= '<p><i class="dashicons dashicons-warning"></i> ' . sprintf( esc_html__( 'The displayed list of users has been trimmed due to the large number of users. %sLearn how to remove this limit%s.', 'gravityview' ), '<a href="https://docs.gravityview.co/article/251-i-only-see-some-users-in-the-change-entry-creator-dropdown" rel="external">', '</a>' ) . '</p>';
239
+		}
240 240
 
241
-	    $output .= '<select name="created_by" id="change_created_by" class="widefat">';
242
-        $output .= '<option value="' . selected( $entry['created_by'], '0', false ) . '"> &mdash; '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' &mdash; </option>';
243
-        foreach($users as $user) {
244
-            $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>';
245
-        }
246
-        $output .= '</select>';
247
-        $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />';
241
+		$output .= '<select name="created_by" id="change_created_by" class="widefat">';
242
+		$output .= '<option value="' . selected( $entry['created_by'], '0', false ) . '"> &mdash; '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' &mdash; </option>';
243
+		foreach($users as $user) {
244
+			$output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>';
245
+		}
246
+		$output .= '</select>';
247
+		$output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />';
248 248
 
249
-	    unset( $is_created_by_in_users, $created_by_user, $users, $created_by_id, $count_users );
249
+		unset( $is_created_by_in_users, $created_by_user, $users, $created_by_id, $count_users );
250 250
 
251
-        echo $output;
252
-    }
251
+		echo $output;
252
+	}
253 253
 
254 254
 }
255 255
 
Please login to merge, or discard this patch.