Completed
Pull Request — master (#1171)
by Zack
95:41 queued 34:43
created
includes/extensions/edit-entry/class-edit-entry-user-registration.php 1 patch
Indentation   +259 added lines, -259 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 if ( ! defined( 'WPINC' ) ) {
14
-    die;
14
+	die;
15 15
 }
16 16
 
17 17
 /**
@@ -22,104 +22,104 @@  discard block
 block discarded – undo
22 22
 	/**
23 23
 	 * @var GravityView_Edit_Entry
24 24
 	 */
25
-    protected $loader;
25
+	protected $loader;
26 26
 
27
-    /**
28
-     * @var WP_User|null Temporary storage used by restore_user_details()
29
-     */
30
-    private $_user_before_update = null;
27
+	/**
28
+	 * @var WP_User|null Temporary storage used by restore_user_details()
29
+	 */
30
+	private $_user_before_update = null;
31 31
 
32
-    function __construct( GravityView_Edit_Entry $loader ) {
33
-        $this->loader = $loader;
34
-    }
32
+	function __construct( GravityView_Edit_Entry $loader ) {
33
+		$this->loader = $loader;
34
+	}
35 35
 
36 36
 	/**
37 37
 	 * @since 1.11
38 38
 	 */
39 39
 	public function load() {
40 40
 		add_action( 'wp', array( $this, 'add_hooks' ), 10 );
41
-    }
41
+	}
42 42
 
43 43
 	/**
44 44
 	 * Add hooks to trigger updating the user
45 45
 	 *
46 46
 	 * @since 1.18
47 47
 	 */
48
-    public function add_hooks() {
49
-
50
-	    /**
51
-	     * @filter `gravityview/edit_entry/user_registration/trigger_update` Choose whether to update user information via User Registration add-on when an entry is updated?
52
-	     * @since 1.11
53
-	     * @param boolean $boolean Whether to trigger update on user registration (default: true)
54
-	     */
55
-	    if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) {
56
-
57
-	    	add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 );
58
-
59
-		    // last resort in case the current user display name don't match any of the defaults
60
-		    add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 );
61
-	    }
62
-    }
63
-
64
-    /**
65
-     * Update the WordPress user profile based on the GF User Registration create feed
66
-     *
67
-     * @since 1.11
68
-     *
69
-     * @param array $form Gravity Forms form array
70
-     * @param string $entry_id Gravity Forms entry ID
71
-     * @return void
72
-     */
73
-    public function update_user( $form = array(), $entry_id = 0 ) {
74
-
75
-        if( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) {
76
-	        gravityview()->log->error( 'GFAPI or User Registration class not found; not updating the user' );
77
-	        return;
78
-        } elseif( empty( $entry_id ) ) {
79
-        	gravityview()->log->error( 'Entry ID is empty [{entry_id}]; not updating the user', array( 'entry_id' => $entry_id ) );
80
-	        return;
81
-        }
82
-
83
-        /** @var GF_User_Registration $gf_user_registration */
84
-        $gf_user_registration = GF_User_Registration::get_instance();
85
-
86
-        $entry = GFAPI::get_entry( $entry_id );
87
-
88
-	    /**
89
-	     * @filter `gravityview/edit_entry/user_registration/entry` Modify entry details before updating the user via User Registration add-on
90
-	     * @since 1.11
91
-	     * @param array $entry Gravity Forms entry
92
-	     * @param array $form Gravity Forms form
93
-	     */
94
-        $entry = apply_filters( 'gravityview/edit_entry/user_registration/entry', $entry, $form );
95
-
96
-	    $config = $this->get_feed_configuration( $entry, $form );
97
-
98
-        // Make sure the feed is active
99
-	    if ( ! \GV\Utils::get( $config, 'is_active', false ) ) {
48
+	public function add_hooks() {
49
+
50
+		/**
51
+		 * @filter `gravityview/edit_entry/user_registration/trigger_update` Choose whether to update user information via User Registration add-on when an entry is updated?
52
+		 * @since 1.11
53
+		 * @param boolean $boolean Whether to trigger update on user registration (default: true)
54
+		 */
55
+		if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) {
56
+
57
+			add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 );
58
+
59
+			// last resort in case the current user display name don't match any of the defaults
60
+			add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 );
61
+		}
62
+	}
63
+
64
+	/**
65
+	 * Update the WordPress user profile based on the GF User Registration create feed
66
+	 *
67
+	 * @since 1.11
68
+	 *
69
+	 * @param array $form Gravity Forms form array
70
+	 * @param string $entry_id Gravity Forms entry ID
71
+	 * @return void
72
+	 */
73
+	public function update_user( $form = array(), $entry_id = 0 ) {
74
+
75
+		if( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) {
76
+			gravityview()->log->error( 'GFAPI or User Registration class not found; not updating the user' );
100 77
 			return;
101
-	    }
78
+		} elseif( empty( $entry_id ) ) {
79
+			gravityview()->log->error( 'Entry ID is empty [{entry_id}]; not updating the user', array( 'entry_id' => $entry_id ) );
80
+			return;
81
+		}
82
+
83
+		/** @var GF_User_Registration $gf_user_registration */
84
+		$gf_user_registration = GF_User_Registration::get_instance();
85
+
86
+		$entry = GFAPI::get_entry( $entry_id );
102 87
 
103
-	    // If an Update feed, make sure the conditions are met.
104
-	    if ( \GV\Utils::get( $config, 'meta/feedType' ) === 'update' ) {
105
-	    	if( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) {
106
-			    return;
107
-		    }
108
-	    }
88
+		/**
89
+		 * @filter `gravityview/edit_entry/user_registration/entry` Modify entry details before updating the user via User Registration add-on
90
+		 * @since 1.11
91
+		 * @param array $entry Gravity Forms entry
92
+		 * @param array $form Gravity Forms form
93
+		 */
94
+		$entry = apply_filters( 'gravityview/edit_entry/user_registration/entry', $entry, $form );
95
+
96
+		$config = $this->get_feed_configuration( $entry, $form );
97
+
98
+		// Make sure the feed is active
99
+		if ( ! \GV\Utils::get( $config, 'is_active', false ) ) {
100
+			return;
101
+		}
109 102
 
110
-        // The priority is set to 3 so that default priority (10) will still override it
111
-        add_filter( 'send_password_change_email', '__return_false', 3 );
112
-        add_filter( 'send_email_change_email', '__return_false', 3 );
103
+		// If an Update feed, make sure the conditions are met.
104
+		if ( \GV\Utils::get( $config, 'meta/feedType' ) === 'update' ) {
105
+			if( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) {
106
+				return;
107
+			}
108
+		}
113 109
 
114
-        // Trigger the User Registration update user method
115
-        $gf_user_registration->update_user( $entry, $form, $config );
110
+		// The priority is set to 3 so that default priority (10) will still override it
111
+		add_filter( 'send_password_change_email', '__return_false', 3 );
112
+		add_filter( 'send_email_change_email', '__return_false', 3 );
116 113
 
117
-        remove_filter( 'send_password_change_email', '__return_false', 3 );
118
-        remove_filter( 'send_email_change_email', '__return_false', 3 );
114
+		// Trigger the User Registration update user method
115
+		$gf_user_registration->update_user( $entry, $form, $config );
119 116
 
120
-        // Prevent double-triggering by removing the hook
121
-	    remove_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10 );
122
-    }
117
+		remove_filter( 'send_password_change_email', '__return_false', 3 );
118
+		remove_filter( 'send_email_change_email', '__return_false', 3 );
119
+
120
+		// Prevent double-triggering by removing the hook
121
+		remove_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10 );
122
+	}
123 123
 
124 124
 	/**
125 125
 	 * Get the User Registration feed configuration for the entry & form
@@ -134,185 +134,185 @@  discard block
 block discarded – undo
134 134
 	 *
135 135
 	 * @return array
136 136
 	 */
137
-    public function get_feed_configuration( $entry, $form ) {
138
-
139
-	    /** @var GF_User_Registration $gf_user_registration */
140
-	    $gf_user_registration = GF_User_Registration::get_instance();
141
-
142
-	    $config = $gf_user_registration->get_single_submission_feed( $entry, $form );
143
-
144
-	    /**
145
-	     * @filter `gravityview/edit_entry/user_registration/preserve_role` Keep the current user role or override with the role defined in the Create feed
146
-	     * @since 1.15
147
-	     * @param[in,out] boolean $preserve_role Preserve current user role Default: true
148
-	     * @param[in] array $config Gravity Forms User Registration feed configuration for the form
149
-	     * @param[in] array $form Gravity Forms form array
150
-	     * @param[in] array $entry Gravity Forms entry being edited
151
-	     */
152
-	    $preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry );
153
-
154
-	    if( $preserve_role ) {
155
-		    $config['meta']['role'] = 'gfur_preserve_role';
156
-	    }
157
-
158
-	    $displayname = $this->match_current_display_name( $entry['created_by'] );
159
-
160
-	    /**
161
-	     * Make sure the current display name is not changed with the update user method.
162
-	     * @since 1.15
163
-	     */
164
-	    $config['meta']['displayname'] = $displayname ? $displayname : $config['meta']['displayname'];
165
-
166
-	    /**
167
-	     * @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration
168
-	     * @since 1.14
169
-	     * @param[in,out] array $config Gravity Forms User Registration feed configuration for the form
170
-	     * @param[in] array $form Gravity Forms form array
171
-	     * @param[in] array $entry Gravity Forms entry being edited
172
-	     */
173
-	    $config = apply_filters( 'gravityview/edit_entry/user_registration/config', $config, $form, $entry );
174
-
175
-	    return $config;
176
-    }
177
-
178
-    /**
179
-     * Calculate the user display name format
180
-     *
181
-     * @since 1.15
182
-     * @since 1.20 Returns false if user not found at $user_id
183
-     *
184
-     * @param int $user_id WP User ID
185
-     * @return false|string Display name format as used inside Gravity Forms User Registration. Returns false if user not found.
186
-     */
187
-    public function match_current_display_name( $user_id ) {
188
-
189
-        $user = get_userdata( $user_id );
190
-
191
-        if( ! $user ) {
192
-        	return false;
193
-        }
194
-
195
-        $names = $this->generate_display_names( $user );
196
-
197
-        $format = array_search( $user->display_name, $names, true );
198
-
199
-        /**
200
-         * In case we can't find the current display name format, trigger last resort method at the 'gform_user_updated' hook
201
-         * @see restore_display_name
202
-         */
203
-        if( false === $format ) {
204
-            $this->_user_before_update = $user;
205
-        }
206
-
207
-        return $format;
208
-    }
209
-
210
-    /**
211
-     * Generate an array of all the user display names possibilities
212
-     *
213
-     * @since 1.15
214
-     *
215
-     * @param object $profileuser WP_User object
216
-     * @return array List all the possible display names for a certain User object
217
-     */
218
-    public function generate_display_names( $profileuser ) {
219
-
220
-        $public_display = array();
221
-        $public_display['nickname']  = $profileuser->nickname;
222
-        $public_display['username']  = $profileuser->user_login;
223
-
224
-        if ( !empty($profileuser->first_name) ) {
225
-	        $public_display['firstname'] = $profileuser->first_name;
226
-        }
227
-
228
-        if ( !empty($profileuser->last_name) ) {
229
-	        $public_display['lastname'] = $profileuser->last_name;
230
-        }
231
-
232
-        if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
233
-            $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
234
-            $public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
235
-        }
236
-
237
-        $public_display = array_map( 'trim', $public_display );
238
-        $public_display = array_unique( $public_display );
239
-
240
-        return $public_display;
241
-    }
242
-
243
-
244
-    /**
245
-     * Restore the Display Name and roles of a user after being updated by Gravity Forms User Registration Addon
246
-     *
247
-     * @see GFUser::update_user()
248
-     * @param int $user_id WP User ID that was updated by Gravity Forms User Registration Addon
249
-     * @param array $config Gravity Forms User Registration Addon form feed configuration
250
-     * @param array $entry The Gravity Forms entry that was just updated
251
-     * @param string $password User password
252
-     * @return int|false|WP_Error|null True: User updated; False: $user_id not a valid User ID; WP_Error: User update error; Null: Method didn't process
253
-     */
254
-    public function restore_display_name( $user_id = 0, $config = array(), $entry = array(), $password = '' ) {
255
-
256
-        /**
257
-         * @filter `gravityview/edit_entry/restore_display_name` Whether display names should be restored to before updating an entry.
258
-         * Otherwise, display names will be reset to the format specified in Gravity Forms User Registration "Update" feed
259
-         * @since 1.14.4
260
-         * @param boolean $restore_display_name Restore Display Name? Default: true
261
-         */
262
-        $restore_display_name = apply_filters( 'gravityview/edit_entry/restore_display_name', true );
263
-
264
-        $is_update_feed = ( $config && \GV\Utils::get( $config, 'meta/feed_type' ) === 'update' );
265
-
266
-        /**
267
-         * Don't restore display name:
268
-         *   - either disabled,
269
-         *   - or it is an Update feed (we only care about Create feed)
270
-         *   - or we don't need as we found the correct format before updating user.
271
-         * @since 1.14.4
272
-         */
273
-        if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) {
274
-            return null;
275
-        }
276
-
277
-        $user_after_update = get_userdata( $user_id );
278
-
279
-        // User not found
280
-	    if ( ! $user_after_update ) {
281
-	    	gravityview()->log->error( 'User not found at $user_id #{user_id}', array( 'user_id' => $user_id ) );
282
-		    return false;
283
-	    }
284
-
285
-        $restored_user = $user_after_update;
286
-
287
-	    // Restore previous display_name
288
-        $restored_user->display_name = $this->_user_before_update->display_name;
289
-
290
-	    // Don't have WP update the password.
291
-	    unset( $restored_user->data->user_pass, $restored_user->user_pass );
292
-
293
-        /**
294
-         * Modify the user data after updated by Gravity Forms User Registration but before restored by GravityView
295
-         * @since 1.14
296
-         * @param WP_User $restored_user The user with restored details about to be updated by wp_update_user()
297
-         * @param WP_User $user_before_update The user before being updated by Gravity Forms User Registration
298
-         * @param WP_User $user_after_update The user after being updated by Gravity Forms User Registration
299
-         * @param array   $entry The Gravity Forms entry that was just updated
300
-         */
301
-        $restored_user = apply_filters( 'gravityview/edit_entry/user_registration/restored_user', $restored_user, $this->_user_before_update, $user_after_update, $entry );
302
-
303
-        $updated = wp_update_user( $restored_user );
304
-
305
-        if( is_wp_error( $updated ) ) {
306
-            gravityview()->log->error( 'There was an error updating user #{user_id} details', array( 'user_id' => $user_id, 'data' => $updated ) );
307
-        } else {
308
-            gravityview()->log->debug( 'User #{user_id} details restored', array( 'user_id' => $user_id ) );
309
-        }
310
-
311
-        $this->_user_before_update = null;
312
-
313
-        unset( $restored_user, $user_after_update );
314
-
315
-        return $updated;
316
-    }
137
+	public function get_feed_configuration( $entry, $form ) {
138
+
139
+		/** @var GF_User_Registration $gf_user_registration */
140
+		$gf_user_registration = GF_User_Registration::get_instance();
141
+
142
+		$config = $gf_user_registration->get_single_submission_feed( $entry, $form );
143
+
144
+		/**
145
+		 * @filter `gravityview/edit_entry/user_registration/preserve_role` Keep the current user role or override with the role defined in the Create feed
146
+		 * @since 1.15
147
+		 * @param[in,out] boolean $preserve_role Preserve current user role Default: true
148
+		 * @param[in] array $config Gravity Forms User Registration feed configuration for the form
149
+		 * @param[in] array $form Gravity Forms form array
150
+		 * @param[in] array $entry Gravity Forms entry being edited
151
+		 */
152
+		$preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry );
153
+
154
+		if( $preserve_role ) {
155
+			$config['meta']['role'] = 'gfur_preserve_role';
156
+		}
157
+
158
+		$displayname = $this->match_current_display_name( $entry['created_by'] );
159
+
160
+		/**
161
+		 * Make sure the current display name is not changed with the update user method.
162
+		 * @since 1.15
163
+		 */
164
+		$config['meta']['displayname'] = $displayname ? $displayname : $config['meta']['displayname'];
165
+
166
+		/**
167
+		 * @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration
168
+		 * @since 1.14
169
+		 * @param[in,out] array $config Gravity Forms User Registration feed configuration for the form
170
+		 * @param[in] array $form Gravity Forms form array
171
+		 * @param[in] array $entry Gravity Forms entry being edited
172
+		 */
173
+		$config = apply_filters( 'gravityview/edit_entry/user_registration/config', $config, $form, $entry );
174
+
175
+		return $config;
176
+	}
177
+
178
+	/**
179
+	 * Calculate the user display name format
180
+	 *
181
+	 * @since 1.15
182
+	 * @since 1.20 Returns false if user not found at $user_id
183
+	 *
184
+	 * @param int $user_id WP User ID
185
+	 * @return false|string Display name format as used inside Gravity Forms User Registration. Returns false if user not found.
186
+	 */
187
+	public function match_current_display_name( $user_id ) {
188
+
189
+		$user = get_userdata( $user_id );
190
+
191
+		if( ! $user ) {
192
+			return false;
193
+		}
194
+
195
+		$names = $this->generate_display_names( $user );
196
+
197
+		$format = array_search( $user->display_name, $names, true );
198
+
199
+		/**
200
+		 * In case we can't find the current display name format, trigger last resort method at the 'gform_user_updated' hook
201
+		 * @see restore_display_name
202
+		 */
203
+		if( false === $format ) {
204
+			$this->_user_before_update = $user;
205
+		}
206
+
207
+		return $format;
208
+	}
209
+
210
+	/**
211
+	 * Generate an array of all the user display names possibilities
212
+	 *
213
+	 * @since 1.15
214
+	 *
215
+	 * @param object $profileuser WP_User object
216
+	 * @return array List all the possible display names for a certain User object
217
+	 */
218
+	public function generate_display_names( $profileuser ) {
219
+
220
+		$public_display = array();
221
+		$public_display['nickname']  = $profileuser->nickname;
222
+		$public_display['username']  = $profileuser->user_login;
223
+
224
+		if ( !empty($profileuser->first_name) ) {
225
+			$public_display['firstname'] = $profileuser->first_name;
226
+		}
227
+
228
+		if ( !empty($profileuser->last_name) ) {
229
+			$public_display['lastname'] = $profileuser->last_name;
230
+		}
231
+
232
+		if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
233
+			$public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
234
+			$public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
235
+		}
236
+
237
+		$public_display = array_map( 'trim', $public_display );
238
+		$public_display = array_unique( $public_display );
239
+
240
+		return $public_display;
241
+	}
242
+
243
+
244
+	/**
245
+	 * Restore the Display Name and roles of a user after being updated by Gravity Forms User Registration Addon
246
+	 *
247
+	 * @see GFUser::update_user()
248
+	 * @param int $user_id WP User ID that was updated by Gravity Forms User Registration Addon
249
+	 * @param array $config Gravity Forms User Registration Addon form feed configuration
250
+	 * @param array $entry The Gravity Forms entry that was just updated
251
+	 * @param string $password User password
252
+	 * @return int|false|WP_Error|null True: User updated; False: $user_id not a valid User ID; WP_Error: User update error; Null: Method didn't process
253
+	 */
254
+	public function restore_display_name( $user_id = 0, $config = array(), $entry = array(), $password = '' ) {
255
+
256
+		/**
257
+		 * @filter `gravityview/edit_entry/restore_display_name` Whether display names should be restored to before updating an entry.
258
+		 * Otherwise, display names will be reset to the format specified in Gravity Forms User Registration "Update" feed
259
+		 * @since 1.14.4
260
+		 * @param boolean $restore_display_name Restore Display Name? Default: true
261
+		 */
262
+		$restore_display_name = apply_filters( 'gravityview/edit_entry/restore_display_name', true );
263
+
264
+		$is_update_feed = ( $config && \GV\Utils::get( $config, 'meta/feed_type' ) === 'update' );
265
+
266
+		/**
267
+		 * Don't restore display name:
268
+		 *   - either disabled,
269
+		 *   - or it is an Update feed (we only care about Create feed)
270
+		 *   - or we don't need as we found the correct format before updating user.
271
+		 * @since 1.14.4
272
+		 */
273
+		if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) {
274
+			return null;
275
+		}
276
+
277
+		$user_after_update = get_userdata( $user_id );
278
+
279
+		// User not found
280
+		if ( ! $user_after_update ) {
281
+			gravityview()->log->error( 'User not found at $user_id #{user_id}', array( 'user_id' => $user_id ) );
282
+			return false;
283
+		}
284
+
285
+		$restored_user = $user_after_update;
286
+
287
+		// Restore previous display_name
288
+		$restored_user->display_name = $this->_user_before_update->display_name;
289
+
290
+		// Don't have WP update the password.
291
+		unset( $restored_user->data->user_pass, $restored_user->user_pass );
292
+
293
+		/**
294
+		 * Modify the user data after updated by Gravity Forms User Registration but before restored by GravityView
295
+		 * @since 1.14
296
+		 * @param WP_User $restored_user The user with restored details about to be updated by wp_update_user()
297
+		 * @param WP_User $user_before_update The user before being updated by Gravity Forms User Registration
298
+		 * @param WP_User $user_after_update The user after being updated by Gravity Forms User Registration
299
+		 * @param array   $entry The Gravity Forms entry that was just updated
300
+		 */
301
+		$restored_user = apply_filters( 'gravityview/edit_entry/user_registration/restored_user', $restored_user, $this->_user_before_update, $user_after_update, $entry );
302
+
303
+		$updated = wp_update_user( $restored_user );
304
+
305
+		if( is_wp_error( $updated ) ) {
306
+			gravityview()->log->error( 'There was an error updating user #{user_id} details', array( 'user_id' => $user_id, 'data' => $updated ) );
307
+		} else {
308
+			gravityview()->log->debug( 'User #{user_id} details restored', array( 'user_id' => $user_id ) );
309
+		}
310
+
311
+		$this->_user_before_update = null;
312
+
313
+		unset( $restored_user, $user_after_update );
314
+
315
+		return $updated;
316
+	}
317 317
 
318 318
 } //end class
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-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/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.
includes/class-template.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -328,34 +328,34 @@  discard block
 block discarded – undo
328 328
 	}
329 329
 
330 330
 	/**
331
-     * Get the fields for a specific context
332
-     *
333
-     * @since 1.19.2
334
-     *
331
+	 * Get the fields for a specific context
332
+	 *
333
+	 * @since 1.19.2
334
+	 *
335 335
 	 * @param string $context [Optional] "directory", "single", or "edit"
336 336
 	 *
337 337
 	 * @return array Array of GravityView field layout configurations
338 338
 	 */
339 339
 	public function getContextFields( $context = '' ) {
340 340
 
341
-	    if( '' === $context ) {
342
-	        $context = $this->getContext();
343
-        }
341
+		if( '' === $context ) {
342
+			$context = $this->getContext();
343
+		}
344 344
 
345 345
 		$fields = $this->getFields();
346 346
 
347
-        foreach ( (array) $fields as $key => $context_fields ) {
347
+		foreach ( (array) $fields as $key => $context_fields ) {
348 348
 
349
-            // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against
350
-            $matches = explode( '_', $key );
349
+			// Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against
350
+			$matches = explode( '_', $key );
351 351
 
352
-            if( isset( $matches[0] ) && $matches[0] === $context ) {
353
-                return $context_fields;
354
-            }
355
-        }
352
+			if( isset( $matches[0] ) && $matches[0] === $context ) {
353
+				return $context_fields;
354
+			}
355
+		}
356 356
 
357 357
 		return array();
358
-    }
358
+	}
359 359
 
360 360
 	/**
361 361
 	 * @param array $fields
@@ -448,10 +448,10 @@  discard block
 block discarded – undo
448 448
 	 */
449 449
 	public function getPaging() {
450 450
 
451
-	    $default_params = array(
452
-            'offset' => 0,
453
-            'page_size' => 20,
454
-        );
451
+		$default_params = array(
452
+			'offset' => 0,
453
+			'page_size' => 20,
454
+		);
455 455
 
456 456
 		return wp_parse_args( $this->paging, $default_params );
457 457
 	}
@@ -508,10 +508,10 @@  discard block
 block discarded – undo
508 508
 	public function getSorting() {
509 509
 
510 510
 		$defaults_params = array(
511
-            'sort_field' => 'date_created',
512
-            'sort_direction' => 'ASC',
513
-            'is_numeric' => false,
514
-        );
511
+			'sort_field' => 'date_created',
512
+			'sort_direction' => 'ASC',
513
+			'is_numeric' => false,
514
+		);
515 515
 
516 516
 		return wp_parse_args( $this->sorting, $defaults_params );
517 517
 	}
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 	 */
838 838
 	public function render_widget_hooks( $view_id_or_context ) {
839 839
 
840
-	    /**
840
+		/**
841 841
 		 * @deprecated Numeric argument is deprecated. Pass a \GV\Template_Context instead.
842 842
 		 */
843 843
 		if ( is_numeric( $view_id_or_context ) ) {
Please login to merge, or discard this patch.
includes/extensions/entry-notes/class-gravityview-field-notes.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
 
176 176
 		if( 'gv_note_add' === $_POST['action'] ) {
177 177
 
178
-            if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
179
-                do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' );
180
-                return;
181
-            }
178
+			if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
179
+				do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' );
180
+				return;
181
+			}
182 182
 
183 183
 			$post = wp_unslash( $_POST );
184 184
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 *
279 279
 	 * Verify permissions. Check expected $_POST. Parse args, then send to process_delete_notes
280 280
 	 *
281
-  	 * @since 1.17
281
+	 * @since 1.17
282 282
 	 *
283 283
 	 * @see process_delete_notes
284 284
 	 *
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 			'subject-label' => __( 'Subject', 'gravityview' ),
432 432
 			'subject' => __( 'Email subject', 'gravityview' ),
433 433
 			'default-email-subject' => __( 'New entry note', 'gravityview' ),
434
-            'email-footer' => __( 'This note was sent from {url}', 'gravityview' ),
434
+			'email-footer' => __( 'This note was sent from {url}', 'gravityview' ),
435 435
 			'also-email' => __( 'Also email this note to', 'gravityview' ),
436 436
 			'error-add-note' => __( 'There was an error adding the note.', 'gravityview' ),
437 437
 			'error-invalid' => __( 'The request was invalid. Refresh the page and try again.', 'gravityview' ),
@@ -501,11 +501,11 @@  discard block
 block discarded – undo
501 501
 
502 502
 		if ( $context instanceof \GV\Template_Context ) {
503 503
 
504
-		    ob_start();
505
-		    $context->template->get_template_part( 'note', 'detail', true );
506
-            $note_detail_html = ob_get_clean();
504
+			ob_start();
505
+			$context->template->get_template_part( 'note', 'detail', true );
506
+			$note_detail_html = ob_get_clean();
507 507
 
508
-            ob_start();
508
+			ob_start();
509 509
 			$context->template->get_template_part( 'note', $note_row_template, true );
510 510
 			$note_row = ob_get_clean();
511 511
 		} else {
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 				'gv-note-to-custom' => '',
762 762
 				'gv-note-subject' => '',
763 763
 				'gv-note-content' => '',
764
-                'current-url' => '',
764
+				'current-url' => '',
765 765
 			);
766 766
 
767 767
 			$current_user  = wp_get_current_user();
@@ -813,9 +813,9 @@  discard block
 block discarded – undo
813 813
 			$message .= $this->get_email_footer( $email_footer, $is_html, $email_data );
814 814
 
815 815
 			/**
816
-             * @filter `gravityview/field/notes/wpautop_email` Should the message content have paragraphs added automatically, if using HTML message format
816
+			 * @filter `gravityview/field/notes/wpautop_email` Should the message content have paragraphs added automatically, if using HTML message format
817 817
 			 * @since 1.18
818
-             * @param bool $wpautop_email True: Apply wpautop() to the email message if using; False: Leave as entered (Default: true)
818
+			 * @param bool $wpautop_email True: Apply wpautop() to the email message if using; False: Leave as entered (Default: true)
819 819
 			 */
820 820
 			$wpautop_email = apply_filters( 'gravityview/field/notes/wpautop_email', true );
821 821
 
@@ -835,12 +835,12 @@  discard block
 block discarded – undo
835 835
 	}
836 836
 
837 837
 	/**
838
-     * Get the footer for Entry Note emails
839
-     *
840
-     * `{url}` is replaced by the URL of the page where the note form was embedded
841
-     *
842
-     * @since 1.18
843
-     * @see GravityView_Field_Notes::strings The default value of $message_footer is set here, with the key 'email-footer'
838
+	 * Get the footer for Entry Note emails
839
+	 *
840
+	 * `{url}` is replaced by the URL of the page where the note form was embedded
841
+	 *
842
+	 * @since 1.18
843
+	 * @see GravityView_Field_Notes::strings The default value of $message_footer is set here, with the key 'email-footer'
844 844
 	 *
845 845
 	 * @param string $email_footer The message footer value
846 846
 	 * @param bool $is_html True: Email is being sent as HTML; False: sent as text
@@ -849,10 +849,10 @@  discard block
 block discarded – undo
849 849
 	 */
850 850
 	private function get_email_footer( $email_footer = '', $is_html = true, $email_data = array() ) {
851 851
 
852
-	    $output = '';
852
+		$output = '';
853 853
 
854 854
 		if( ! empty( $email_footer ) ) {
855
-		    $url = \GV\Utils::get( $email_data, 'current-url' );
855
+			$url = \GV\Utils::get( $email_data, 'current-url' );
856 856
 			$url = html_entity_decode( $url );
857 857
 			$url = site_url( $url );
858 858
 
Please login to merge, or discard this patch.