@@ -36,7 +36,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |