Completed
Push — develop ( 90c25d...8a16d5 )
by
unknown
19:02
created
includes/extensions/edit-entry/class-edit-entry.php 2 patches
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -18,84 +18,84 @@  discard block
 block discarded – undo
18 18
 
19 19
 class GravityView_Edit_Entry {
20 20
 
21
-    /**
22
-     * @var string
23
-     */
21
+	/**
22
+	 * @var string
23
+	 */
24 24
 	static $file;
25 25
 
26 26
 	static $instance;
27 27
 
28
-    /**
29
-     * Component instances.
30
-     * @var array
31
-     */
32
-    public $instances = array();
28
+	/**
29
+	 * Component instances.
30
+	 * @var array
31
+	 */
32
+	public $instances = array();
33 33
 
34 34
 
35 35
 	function __construct() {
36 36
 
37
-        self::$file = plugin_dir_path( __FILE__ );
37
+		self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
40
-            $this->load_components( 'admin' );
41
-        }
39
+		if( is_admin() ) {
40
+			$this->load_components( 'admin' );
41
+		}
42 42
 
43 43
 		$this->load_components( 'locking' );
44 44
 
45
-        $this->load_components( 'render' );
45
+		$this->load_components( 'render' );
46 46
 
47
-        // If GF User Registration Add-on exists
48
-        $this->load_components( 'user-registration' );
47
+		// If GF User Registration Add-on exists
48
+		$this->load_components( 'user-registration' );
49 49
 
50
-        $this->add_hooks();
50
+		$this->add_hooks();
51 51
 
52 52
 		// Process hooks for addons that may or may not be present
53 53
 		$this->addon_specific_hooks();
54 54
 	}
55 55
 
56 56
 
57
-    static function getInstance() {
57
+	static function getInstance() {
58 58
 
59
-        if( empty( self::$instance ) ) {
60
-            self::$instance = new GravityView_Edit_Entry;
61
-        }
59
+		if( empty( self::$instance ) ) {
60
+			self::$instance = new GravityView_Edit_Entry;
61
+		}
62 62
 
63
-        return self::$instance;
64
-    }
63
+		return self::$instance;
64
+	}
65 65
 
66 66
 
67
-    private function load_components( $component ) {
67
+	private function load_components( $component ) {
68 68
 
69
-        $dir = trailingslashit( self::$file );
69
+		$dir = trailingslashit( self::$file );
70 70
 
71
-        $filename  = $dir . 'class-edit-entry-' . $component . '.php';
72
-        $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
71
+		$filename  = $dir . 'class-edit-entry-' . $component . '.php';
72
+		$classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
73 73
 
74
-        // Loads component and pass extension's instance so that component can
75
-        // talk each other.
76
-        require_once $filename;
77
-        $this->instances[ $component ] = new $classname( $this );
78
-        $this->instances[ $component ]->load();
74
+		// Loads component and pass extension's instance so that component can
75
+		// talk each other.
76
+		require_once $filename;
77
+		$this->instances[ $component ] = new $classname( $this );
78
+		$this->instances[ $component ]->load();
79 79
 
80
-    }
80
+	}
81 81
 
82
-    private function add_hooks() {
82
+	private function add_hooks() {
83 83
 
84
-        // Add front-end access to Gravity Forms delete file action
85
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( $this, 'delete_file') );
84
+		// Add front-end access to Gravity Forms delete file action
85
+		add_action( 'wp_ajax_nopriv_rg_delete_file', array( $this, 'delete_file') );
86 86
 
87
-        // Make sure this hook is run for non-admins
88
-        add_action( 'wp_ajax_rg_delete_file', array( $this, 'delete_file') );
87
+		// Make sure this hook is run for non-admins
88
+		add_action( 'wp_ajax_rg_delete_file', array( $this, 'delete_file') );
89 89
 
90
-        add_filter( 'gravityview_blocklist_field_types', array( $this, 'modify_field_blocklist' ), 10, 2 );
90
+		add_filter( 'gravityview_blocklist_field_types', array( $this, 'modify_field_blocklist' ), 10, 2 );
91 91
 
92
-        // add template path to check for field
93
-        add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
92
+		// add template path to check for field
93
+		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
94 94
 
95 95
 		add_filter( 'gravityview/field/is_visible', array( $this, 'maybe_not_visible' ), 10, 3 );
96 96
 
97 97
 		add_filter( 'gravityview/api/reserved_query_args', array( $this, 'add_reserved_arg' ) );
98
-    }
98
+	}
99 99
 
100 100
 	/**
101 101
 	 * Adds "edit" to the list of internal reserved query args
@@ -166,74 +166,74 @@  discard block
 block discarded – undo
166 166
 		return false;
167 167
 	}
168 168
 
169
-    /**
170
-     * Include this extension templates path
171
-     * @param array $file_paths List of template paths ordered
172
-     */
173
-    public function add_template_path( $file_paths ) {
174
-
175
-        // Index 100 is the default GravityView template path.
176
-        $file_paths[ 110 ] = self::$file;
177
-
178
-        return $file_paths;
179
-    }
180
-
181
-    /**
182
-     *
183
-     * Return a well formatted nonce key according to GravityView Edit Entry protocol
184
-     *
185
-     * @param $view_id int GravityView view id
186
-     * @param $form_id int Gravity Forms form id
187
-     * @param $entry_id int Gravity Forms entry id
188
-     * @return string
189
-     */
190
-    public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
191
-        return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
192
-    }
193
-
194
-
195
-    /**
196
-     * The edit entry link creates a secure link with a nonce
197
-     *
198
-     * It also mimics the URL structure Gravity Forms expects to have so that
199
-     * it formats the display of the edit form like it does in the backend, like
200
-     * "You can edit this post from the post page" fields, for example.
201
-     *
202
-     * @param $entry array Gravity Forms entry object
203
-     * @param $view_id int GravityView view id
204
-     * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
205
-     * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
206
-     * @return string
207
-     */
208
-    public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
209
-
210
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
211
-
212
-        $base = gv_entry_link( $entry, $post_id ? : $view_id  );
213
-
214
-        $url = add_query_arg( array(
215
-            'edit' => wp_create_nonce( $nonce_key )
216
-        ), $base );
217
-
218
-        if( $post_id ) {
219
-	        $url = add_query_arg( array( 'gvid' => $view_id ), $url );
220
-        }
221
-
222
-	    /**
223
-	     * Allow passing params to dynamically populate entry with values
224
-	     * @since 1.9.2
225
-	     */
226
-	    if( !empty( $field_values ) ) {
227
-
228
-		    if( is_array( $field_values ) ) {
229
-			    // If already an array, no parse_str() needed
230
-			    $params = $field_values;
231
-		    } else {
232
-			    parse_str( $field_values, $params );
233
-		    }
234
-
235
-		    $url = add_query_arg( $params, $url );
236
-	    }
169
+	/**
170
+	 * Include this extension templates path
171
+	 * @param array $file_paths List of template paths ordered
172
+	 */
173
+	public function add_template_path( $file_paths ) {
174
+
175
+		// Index 100 is the default GravityView template path.
176
+		$file_paths[ 110 ] = self::$file;
177
+
178
+		return $file_paths;
179
+	}
180
+
181
+	/**
182
+	 *
183
+	 * Return a well formatted nonce key according to GravityView Edit Entry protocol
184
+	 *
185
+	 * @param $view_id int GravityView view id
186
+	 * @param $form_id int Gravity Forms form id
187
+	 * @param $entry_id int Gravity Forms entry id
188
+	 * @return string
189
+	 */
190
+	public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
191
+		return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
192
+	}
193
+
194
+
195
+	/**
196
+	 * The edit entry link creates a secure link with a nonce
197
+	 *
198
+	 * It also mimics the URL structure Gravity Forms expects to have so that
199
+	 * it formats the display of the edit form like it does in the backend, like
200
+	 * "You can edit this post from the post page" fields, for example.
201
+	 *
202
+	 * @param $entry array Gravity Forms entry object
203
+	 * @param $view_id int GravityView view id
204
+	 * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
205
+	 * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
206
+	 * @return string
207
+	 */
208
+	public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
209
+
210
+		$nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
211
+
212
+		$base = gv_entry_link( $entry, $post_id ? : $view_id  );
213
+
214
+		$url = add_query_arg( array(
215
+			'edit' => wp_create_nonce( $nonce_key )
216
+		), $base );
217
+
218
+		if( $post_id ) {
219
+			$url = add_query_arg( array( 'gvid' => $view_id ), $url );
220
+		}
221
+
222
+		/**
223
+		 * Allow passing params to dynamically populate entry with values
224
+		 * @since 1.9.2
225
+		 */
226
+		if( !empty( $field_values ) ) {
227
+
228
+			if( is_array( $field_values ) ) {
229
+				// If already an array, no parse_str() needed
230
+				$params = $field_values;
231
+			} else {
232
+				parse_str( $field_values, $params );
233
+			}
234
+
235
+			$url = add_query_arg( $params, $url );
236
+		}
237 237
 
238 238
 		/**
239 239
 		 * @filter `gravityview/edit/link` Filter the edit URL link.
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		 * @param \GV\View $view The View.
243 243
 		 */
244 244
 		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id  ) );
245
-    }
245
+	}
246 246
 
247 247
 	/**
248 248
 	 * @depecated 2.14 Use {@see GravityView_Edit_Entry::modify_field_blocklist()}
@@ -333,19 +333,19 @@  discard block
 block discarded – undo
333 333
 	}
334 334
 
335 335
 
336
-    /**
337
-     * checks if user has permissions to edit a specific entry
338
-     *
339
-     * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
340
-     *
341
-     * @param  array $entry Gravity Forms entry array
342
-     * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
343
-     * @return bool
344
-     */
345
-    public static function check_user_cap_edit_entry( $entry, $view = 0 ) {
336
+	/**
337
+	 * checks if user has permissions to edit a specific entry
338
+	 *
339
+	 * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
340
+	 *
341
+	 * @param  array $entry Gravity Forms entry array
342
+	 * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
343
+	 * @return bool
344
+	 */
345
+	public static function check_user_cap_edit_entry( $entry, $view = 0 ) {
346 346
 
347
-        // No permission by default
348
-        $user_can_edit = false;
347
+		// No permission by default
348
+		$user_can_edit = false;
349 349
 
350 350
 		// get user_edit setting
351 351
 		if ( empty( $view ) ) {
@@ -363,60 +363,60 @@  discard block
 block discarded – undo
363 363
 			$user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' );
364 364
 		}
365 365
 
366
-        // If they can edit any entries (as defined in Gravity Forms)
367
-        // Or if they can edit other people's entries
368
-        // Then we're good.
369
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
366
+		// If they can edit any entries (as defined in Gravity Forms)
367
+		// Or if they can edit other people's entries
368
+		// Then we're good.
369
+		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
370 370
 
371
-            gravityview()->log->debug( 'User has ability to edit all entries.' );
371
+			gravityview()->log->debug( 'User has ability to edit all entries.' );
372 372
 
373
-            $user_can_edit = true;
373
+			$user_can_edit = true;
374 374
 
375
-        } else if( !isset( $entry['created_by'] ) ) {
375
+		} else if( !isset( $entry['created_by'] ) ) {
376 376
 
377
-            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
377
+			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
378 378
 
379
-            $user_can_edit = false;
379
+			$user_can_edit = false;
380 380
 
381
-        } else {
381
+		} else {
382 382
 
383
-            $current_user = wp_get_current_user();
383
+			$current_user = wp_get_current_user();
384 384
 
385
-            // User edit is disabled
386
-            if( empty( $user_edit ) ) {
385
+			// User edit is disabled
386
+			if( empty( $user_edit ) ) {
387 387
 
388
-                gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
388
+				gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
389 389
 
390
-                $user_can_edit = false;
391
-            }
390
+				$user_can_edit = false;
391
+			}
392 392
 
393
-            // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
394
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
393
+			// User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
394
+			else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
395 395
 
396
-                gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
396
+				gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
397 397
 
398
-                $user_can_edit = true;
398
+				$user_can_edit = true;
399 399
 
400
-            } else if( ! is_user_logged_in() ) {
400
+			} else if( ! is_user_logged_in() ) {
401 401
 
402
-                gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
402
+				gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
403 403
 
404
-	            $user_can_edit = false; // Here just for clarity
405
-            }
404
+				$user_can_edit = false; // Here just for clarity
405
+			}
406 406
 
407
-        }
407
+		}
408 408
 
409
-        /**
410
-         * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
411
-         * @since 1.15 Added `$entry` and `$view_id` parameters
412
-         * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
413
-         * @param[in] array $entry Gravity Forms entry array {@since 1.15}
414
-         * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
415
-         */
416
-        $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
409
+		/**
410
+		 * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
411
+		 * @since 1.15 Added `$entry` and `$view_id` parameters
412
+		 * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
413
+		 * @param[in] array $entry Gravity Forms entry array {@since 1.15}
414
+		 * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
415
+		 */
416
+		$user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
417 417
 
418
-        return (bool) $user_can_edit;
419
-    }
418
+		return (bool) $user_can_edit;
419
+	}
420 420
 
421 421
 	/**
422 422
 	 * Deletes a file.
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
39
+        if ( is_admin() ) {
40 40
             $this->load_components( 'admin' );
41 41
         }
42 42
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
     static function getInstance() {
58 58
 
59
-        if( empty( self::$instance ) ) {
59
+        if ( empty( self::$instance ) ) {
60 60
             self::$instance = new GravityView_Edit_Entry;
61 61
         }
62 62
 
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
     private function add_hooks() {
83 83
 
84 84
         // Add front-end access to Gravity Forms delete file action
85
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( $this, 'delete_file') );
85
+        add_action( 'wp_ajax_nopriv_rg_delete_file', array( $this, 'delete_file' ) );
86 86
 
87 87
         // Make sure this hook is run for non-admins
88
-        add_action( 'wp_ajax_rg_delete_file', array( $this, 'delete_file') );
88
+        add_action( 'wp_ajax_rg_delete_file', array( $this, 'delete_file' ) );
89 89
 
90 90
         add_filter( 'gravityview_blocklist_field_types', array( $this, 'modify_field_blocklist' ), 10, 2 );
91 91
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function add_reserved_arg( $args ) {
110 110
 
111
-		$args[] = 'edit';
111
+		$args[ ] = 'edit';
112 112
 
113 113
 		return $args;
114 114
 	}
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	private function addon_specific_hooks() {
121 121
 
122
-		if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
123
-			add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script'));
122
+		if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
123
+			add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) );
124 124
 		}
125 125
 
126 126
 	}
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
209 209
 
210
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
210
+        $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] );
211 211
 
212
-        $base = gv_entry_link( $entry, $post_id ? : $view_id  );
212
+        $base = gv_entry_link( $entry, $post_id ?: $view_id );
213 213
 
214 214
         $url = add_query_arg( array(
215 215
             'edit' => wp_create_nonce( $nonce_key )
216 216
         ), $base );
217 217
 
218
-        if( $post_id ) {
218
+        if ( $post_id ) {
219 219
 	        $url = add_query_arg( array( 'gvid' => $view_id ), $url );
220 220
         }
221 221
 
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 	     * Allow passing params to dynamically populate entry with values
224 224
 	     * @since 1.9.2
225 225
 	     */
226
-	    if( !empty( $field_values ) ) {
226
+	    if ( ! empty( $field_values ) ) {
227 227
 
228
-		    if( is_array( $field_values ) ) {
228
+		    if ( is_array( $field_values ) ) {
229 229
 			    // If already an array, no parse_str() needed
230 230
 			    $params = $field_values;
231 231
 		    } else {
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		 * @param array $entry The entry.
242 242
 		 * @param \GV\View $view The View.
243 243
 		 */
244
-		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id  ) );
244
+		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ) );
245 245
     }
246 246
 
247 247
 	/**
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 */
270 270
 	public function modify_field_blocklist( $fields = array(), $context = NULL ) {
271 271
 
272
-		if( empty( $context ) || $context !== 'edit' ) {
272
+		if ( empty( $context ) || $context !== 'edit' ) {
273 273
 			return $fields;
274 274
 		}
275 275
 
@@ -366,15 +366,15 @@  discard block
 block discarded – undo
366 366
         // If they can edit any entries (as defined in Gravity Forms)
367 367
         // Or if they can edit other people's entries
368 368
         // Then we're good.
369
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
369
+        if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) {
370 370
 
371 371
             gravityview()->log->debug( 'User has ability to edit all entries.' );
372 372
 
373 373
             $user_can_edit = true;
374 374
 
375
-        } else if( !isset( $entry['created_by'] ) ) {
375
+        } else if ( ! isset( $entry[ 'created_by' ] ) ) {
376 376
 
377
-            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
377
+            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
378 378
 
379 379
             $user_can_edit = false;
380 380
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
             $current_user = wp_get_current_user();
384 384
 
385 385
             // User edit is disabled
386
-            if( empty( $user_edit ) ) {
386
+            if ( empty( $user_edit ) ) {
387 387
 
388 388
                 gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
389 389
 
@@ -391,13 +391,13 @@  discard block
 block discarded – undo
391 391
             }
392 392
 
393 393
             // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
394
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
394
+            else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
395 395
 
396 396
                 gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
397 397
 
398 398
                 $user_can_edit = true;
399 399
 
400
-            } else if( ! is_user_logged_in() ) {
400
+            } else if ( ! is_user_logged_in() ) {
401 401
 
402 402
                 gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
403 403
 
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
          */
416 416
         $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
417 417
 
418
-        return (bool) $user_can_edit;
418
+        return (bool)$user_can_edit;
419 419
     }
420 420
 
421 421
 	/**
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 	 * @uses   GFForms::delete_file()
427 427
 	 */
428 428
 	public function delete_file() {
429
-		add_filter( 'user_has_cap', function ( $caps ) {
430
-			$caps['gravityforms_delete_entries'] = true;
429
+		add_filter( 'user_has_cap', function( $caps ) {
430
+			$caps[ 'gravityforms_delete_entries' ] = true;
431 431
 
432 432
 			return $caps;
433 433
 
Please login to merge, or discard this patch.