@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | |
43 | 43 | add_action( 'wp', array( $this, 'process_delete' ), 10000 ); |
44 | 44 | |
45 | - add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field'), 10, 3 ); |
|
45 | + add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 ); |
|
46 | 46 | |
47 | 47 | add_action( 'gravityview_before', array( $this, 'display_message' ) ); |
48 | 48 | |
49 | 49 | // For the Delete Entry Link, you don't want visible to all users. |
50 | - add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps'), 10, 5 ); |
|
50 | + add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 ); |
|
51 | 51 | |
52 | 52 | // Modify the field options based on the name of the field type |
53 | 53 | add_filter( 'gravityview_template_delete_link_options', array( $this, 'delete_link_field_options' ), 10, 5 ); |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | // add template path to check for field |
56 | 56 | add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
57 | 57 | |
58 | - add_action( 'gravityview/edit-entry/publishing-action/after', array( $this, 'add_delete_button'), 10, 4 ); |
|
58 | + add_action( 'gravityview/edit-entry/publishing-action/after', array( $this, 'add_delete_button' ), 10, 4 ); |
|
59 | 59 | |
60 | - add_action ( 'gravityview/delete-entry/deleted', array( $this, 'process_connected_posts' ), 10, 2 ); |
|
61 | - add_action ( 'gravityview/delete-entry/trashed', array( $this, 'process_connected_posts' ), 10, 2 ); |
|
60 | + add_action( 'gravityview/delete-entry/deleted', array( $this, 'process_connected_posts' ), 10, 2 ); |
|
61 | + add_action( 'gravityview/delete-entry/trashed', array( $this, 'process_connected_posts' ), 10, 2 ); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | static function getInstance() { |
71 | 71 | |
72 | - if( empty( self::$instance ) ) { |
|
72 | + if ( empty( self::$instance ) ) { |
|
73 | 73 | self::$instance = new self; |
74 | 74 | } |
75 | 75 | |
@@ -105,20 +105,20 @@ discard block |
||
105 | 105 | function delete_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
106 | 106 | |
107 | 107 | // Always a link, never a filter |
108 | - unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
108 | + unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] ); |
|
109 | 109 | |
110 | 110 | // Delete Entry link should only appear to visitors capable of editing entries |
111 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
111 | + unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] ); |
|
112 | 112 | |
113 | - $add_option['delete_link'] = array( |
|
113 | + $add_option[ 'delete_link' ] = array( |
|
114 | 114 | 'type' => 'text', |
115 | 115 | 'label' => __( 'Delete Link Text', 'gravityview' ), |
116 | 116 | 'desc' => NULL, |
117 | - 'value' => __('Delete Entry', 'gravityview'), |
|
117 | + 'value' => __( 'Delete Entry', 'gravityview' ), |
|
118 | 118 | 'merge_tags' => true, |
119 | 119 | ); |
120 | 120 | |
121 | - $field_options['allow_edit_cap'] = array( |
|
121 | + $field_options[ 'allow_edit_cap' ] = array( |
|
122 | 122 | 'type' => 'select', |
123 | 123 | 'label' => __( 'Allow the following users to delete the entry:', 'gravityview' ), |
124 | 124 | 'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ), |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | */ |
143 | 143 | function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
144 | 144 | |
145 | - if( 'edit' !== $zone ) { |
|
146 | - $entry_default_fields['delete_link'] = array( |
|
145 | + if ( 'edit' !== $zone ) { |
|
146 | + $entry_default_fields[ 'delete_link' ] = array( |
|
147 | 147 | 'label' => __( 'Delete Entry', 'gravityview' ), |
148 | 148 | 'type' => 'delete_link', |
149 | 149 | 'desc' => __( 'A link to delete the entry. Respects the Delete Entry permissions.', 'gravityview' ), |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | function add_available_field( $available_fields = array() ) { |
162 | 162 | |
163 | - $available_fields['delete_link'] = array( |
|
163 | + $available_fields[ 'delete_link' ] = array( |
|
164 | 164 | 'label_text' => __( 'Delete Entry', 'gravityview' ), |
165 | 165 | 'field_id' => 'delete_link', |
166 | 166 | 'label_type' => 'field', |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | $caps = $visibility_caps; |
189 | 189 | |
190 | 190 | // If we're configuring fields in the edit context, we want a limited selection |
191 | - if( $field_id === 'delete_link' ) { |
|
191 | + if ( $field_id === 'delete_link' ) { |
|
192 | 192 | |
193 | 193 | // Remove other built-in caps. |
194 | - unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
194 | + unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] ); |
|
195 | 195 | |
196 | - $caps['read'] = _x('Entry Creator', 'User capability', 'gravityview'); |
|
196 | + $caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' ); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | return $caps; |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @param [type] $entry [description] |
207 | 207 | */ |
208 | 208 | function set_entry( $entry = null ) { |
209 | - $this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[0] : $entry; |
|
209 | + $this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[ 0 ] : $entry; |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | |
240 | 240 | self::getInstance()->set_entry( $entry ); |
241 | 241 | |
242 | - $base = GravityView_API::directory_link( $post_id ? : $view_id, true ); |
|
242 | + $base = GravityView_API::directory_link( $post_id ?: $view_id, true ); |
|
243 | 243 | |
244 | 244 | if ( empty( $base ) ) { |
245 | 245 | gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) ); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | } |
248 | 248 | |
249 | 249 | // Use the slug instead of the ID for consistent security |
250 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
250 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
251 | 251 | |
252 | 252 | $actionurl = add_query_arg( array( |
253 | 253 | 'action' => 'delete', |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | 'view_id' => $view_id, |
257 | 257 | ), $base ); |
258 | 258 | |
259 | - $url = wp_nonce_url( $actionurl, 'delete_'.$entry_slug, 'delete' ); |
|
259 | + $url = wp_nonce_url( $actionurl, 'delete_' . $entry_slug, 'delete' ); |
|
260 | 260 | |
261 | 261 | return $url; |
262 | 262 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | public function add_delete_button( $form = array(), $entry = array(), $view_id = null, $post_id = null ) { |
279 | 279 | |
280 | 280 | // Only show the link to those who are allowed to see it. |
281 | - if( !self::check_user_cap_delete_entry( $entry, array(), $view_id ) ) { |
|
281 | + if ( ! self::check_user_cap_delete_entry( $entry, array(), $view_id ) ) { |
|
282 | 282 | return; |
283 | 283 | } |
284 | 284 | |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | $show_delete_button = apply_filters( 'gravityview/delete-entry/show-delete-button', true ); |
290 | 290 | |
291 | 291 | // If the button is hidden by the filter, don't show. |
292 | - if( !$show_delete_button ) { |
|
292 | + if ( ! $show_delete_button ) { |
|
293 | 293 | return; |
294 | 294 | } |
295 | 295 | |
296 | 296 | $attributes = array( |
297 | 297 | 'class' => 'btn btn-sm button button-small alignright pull-right btn-danger gv-button-delete', |
298 | - 'tabindex' => ( GFCommon::$tab_index ++ ), |
|
298 | + 'tabindex' => ( GFCommon::$tab_index++ ), |
|
299 | 299 | 'onclick' => self::get_confirm_dialog(), |
300 | 300 | ); |
301 | 301 | |
@@ -319,27 +319,27 @@ discard block |
||
319 | 319 | function process_delete() { |
320 | 320 | |
321 | 321 | // If the form is submitted |
322 | - if( isset( $_GET['action'] ) && 'delete' === $_GET['action'] && isset( $_GET['entry_id'] ) ) { |
|
322 | + if ( isset( $_GET[ 'action' ] ) && 'delete' === $_GET[ 'action' ] && isset( $_GET[ 'entry_id' ] ) ) { |
|
323 | 323 | |
324 | 324 | // Make sure it's a GravityView request |
325 | - $valid_nonce_key = wp_verify_nonce( $_GET['delete'], self::get_nonce_key( $_GET['entry_id'] ) ); |
|
325 | + $valid_nonce_key = wp_verify_nonce( $_GET[ 'delete' ], self::get_nonce_key( $_GET[ 'entry_id' ] ) ); |
|
326 | 326 | |
327 | - if( ! $valid_nonce_key ) { |
|
327 | + if ( ! $valid_nonce_key ) { |
|
328 | 328 | gravityview()->log->debug( 'Delete entry not processed: nonce validation failed.' ); |
329 | 329 | return; |
330 | 330 | } |
331 | 331 | |
332 | 332 | // Get the entry slug |
333 | - $entry_slug = esc_attr( $_GET['entry_id'] ); |
|
333 | + $entry_slug = esc_attr( $_GET[ 'entry_id' ] ); |
|
334 | 334 | |
335 | 335 | // See if there's an entry there |
336 | 336 | $entry = gravityview_get_entry( $entry_slug, true, false ); |
337 | 337 | |
338 | - if( $entry ) { |
|
338 | + if ( $entry ) { |
|
339 | 339 | |
340 | 340 | $has_permission = $this->user_can_delete_entry( $entry ); |
341 | 341 | |
342 | - if( is_wp_error( $has_permission ) ) { |
|
342 | + if ( is_wp_error( $has_permission ) ) { |
|
343 | 343 | |
344 | 344 | $messages = array( |
345 | 345 | 'message' => urlencode( $has_permission->get_error_message() ), |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | // Delete the entry |
352 | 352 | $delete_response = $this->delete_or_trash_entry( $entry ); |
353 | 353 | |
354 | - if( is_wp_error( $delete_response ) ) { |
|
354 | + if ( is_wp_error( $delete_response ) ) { |
|
355 | 355 | |
356 | 356 | $messages = array( |
357 | 357 | 'message' => urlencode( $delete_response->get_error_message() ), |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | gravityview()->log->debug( 'Delete entry failed: there was no entry with the entry slug {entry_slug}', array( 'entry_slug' => $entry_slug ) ); |
374 | 374 | |
375 | 375 | $messages = array( |
376 | - 'message' => urlencode( __('The entry does not exist.', 'gravityview') ), |
|
376 | + 'message' => urlencode( __( 'The entry does not exist.', 'gravityview' ) ), |
|
377 | 377 | 'status' => 'error', |
378 | 378 | ); |
379 | 379 | } |
@@ -413,18 +413,18 @@ discard block |
||
413 | 413 | */ |
414 | 414 | private function delete_or_trash_entry( $entry ) { |
415 | 415 | |
416 | - $entry_id = $entry['id']; |
|
416 | + $entry_id = $entry[ 'id' ]; |
|
417 | 417 | |
418 | 418 | $mode = $this->get_delete_mode(); |
419 | 419 | |
420 | - if( 'delete' === $mode ) { |
|
420 | + if ( 'delete' === $mode ) { |
|
421 | 421 | |
422 | 422 | gravityview()->log->debug( 'Starting delete entry: {entry_id}', array( 'entry_id' => $entry_id ) ); |
423 | 423 | |
424 | 424 | // Delete the entry |
425 | 425 | $delete_response = GFAPI::delete_entry( $entry_id ); |
426 | 426 | |
427 | - if( ! is_wp_error( $delete_response ) ) { |
|
427 | + if ( ! is_wp_error( $delete_response ) ) { |
|
428 | 428 | $delete_response = 'deleted'; |
429 | 429 | |
430 | 430 | /** |
@@ -445,8 +445,8 @@ discard block |
||
445 | 445 | $trashed = GFAPI::update_entry_property( $entry_id, 'status', 'trash' ); |
446 | 446 | new GravityView_Cache; |
447 | 447 | |
448 | - if( ! $trashed ) { |
|
449 | - $delete_response = new WP_Error( 'trash_entry_failed', __('Moving the entry to the trash failed.', 'gravityview' ) ); |
|
448 | + if ( ! $trashed ) { |
|
449 | + $delete_response = new WP_Error( 'trash_entry_failed', __( 'Moving the entry to the trash failed.', 'gravityview' ) ); |
|
450 | 450 | } else { |
451 | 451 | |
452 | 452 | /** |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | public function process_connected_posts( $entry_id = 0, $entry = array() ) { |
478 | 478 | |
479 | 479 | // The entry had no connected post |
480 | - if( empty( $entry['post_id'] ) ) { |
|
480 | + if ( empty( $entry[ 'post_id' ] ) ) { |
|
481 | 481 | return; |
482 | 482 | } |
483 | 483 | |
@@ -488,19 +488,19 @@ discard block |
||
488 | 488 | */ |
489 | 489 | $delete_post = apply_filters( 'gravityview/delete-entry/delete-connected-post', true ); |
490 | 490 | |
491 | - if( false === $delete_post ) { |
|
491 | + if ( false === $delete_post ) { |
|
492 | 492 | return; |
493 | 493 | } |
494 | 494 | |
495 | 495 | $action = current_action(); |
496 | 496 | |
497 | - if( 'gravityview/delete-entry/deleted' === $action ) { |
|
498 | - $result = wp_delete_post( $entry['post_id'], true ); |
|
497 | + if ( 'gravityview/delete-entry/deleted' === $action ) { |
|
498 | + $result = wp_delete_post( $entry[ 'post_id' ], true ); |
|
499 | 499 | } else { |
500 | - $result = wp_trash_post( $entry['post_id'] ); |
|
500 | + $result = wp_trash_post( $entry[ 'post_id' ] ); |
|
501 | 501 | } |
502 | 502 | |
503 | - if( false === $result ) { |
|
503 | + if ( false === $result ) { |
|
504 | 504 | gravityview()->log->error( '(called by {action}): Error processing the Post connected to the entry.', array( 'action' => $action, 'data' => $entry ) ); |
505 | 505 | } else { |
506 | 506 | gravityview()->log->debug( '(called by {action}): Successfully processed Post connected to the entry.', array( 'action' => $action, 'data' => $entry ) ); |
@@ -516,13 +516,13 @@ discard block |
||
516 | 516 | public function verify_nonce() { |
517 | 517 | |
518 | 518 | // No delete entry request was made |
519 | - if( empty( $_GET['entry_id'] ) || empty( $_GET['delete'] ) ) { |
|
519 | + if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'delete' ] ) ) { |
|
520 | 520 | return false; |
521 | 521 | } |
522 | 522 | |
523 | - $nonce_key = self::get_nonce_key( $_GET['entry_id'] ); |
|
523 | + $nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] ); |
|
524 | 524 | |
525 | - $valid = wp_verify_nonce( $_GET['delete'], $nonce_key ); |
|
525 | + $valid = wp_verify_nonce( $_GET[ 'delete' ], $nonce_key ); |
|
526 | 526 | |
527 | 527 | /** |
528 | 528 | * @filter `gravityview/delete-entry/verify_nonce` Override Delete Entry nonce validation. Return true to declare nonce valid. |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | */ |
545 | 545 | public static function get_confirm_dialog() { |
546 | 546 | |
547 | - $confirm = __('Are you sure you want to delete this entry? This cannot be undone.', 'gravityview'); |
|
547 | + $confirm = __( 'Are you sure you want to delete this entry? This cannot be undone.', 'gravityview' ); |
|
548 | 548 | |
549 | 549 | /** |
550 | 550 | * @filter `gravityview/delete-entry/confirm-text` Modify the Delete Entry Javascript confirmation text |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | */ |
553 | 553 | $confirm = apply_filters( 'gravityview/delete-entry/confirm-text', $confirm ); |
554 | 554 | |
555 | - return 'return window.confirm(\''. esc_js( $confirm ) .'\');'; |
|
555 | + return 'return window.confirm(\'' . esc_js( $confirm ) . '\');'; |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | /** |
@@ -570,16 +570,16 @@ discard block |
||
570 | 570 | |
571 | 571 | $error = NULL; |
572 | 572 | |
573 | - if( ! $this->verify_nonce() ) { |
|
574 | - $error = __( 'The link to delete this entry is not valid; it may have expired.', 'gravityview'); |
|
573 | + if ( ! $this->verify_nonce() ) { |
|
574 | + $error = __( 'The link to delete this entry is not valid; it may have expired.', 'gravityview' ); |
|
575 | 575 | } |
576 | 576 | |
577 | - if( ! self::check_user_cap_delete_entry( $entry, array(), $view_id ) ) { |
|
578 | - $error = __( 'You do not have permission to delete this entry.', 'gravityview'); |
|
577 | + if ( ! self::check_user_cap_delete_entry( $entry, array(), $view_id ) ) { |
|
578 | + $error = __( 'You do not have permission to delete this entry.', 'gravityview' ); |
|
579 | 579 | } |
580 | 580 | |
581 | - if( $entry['status'] === 'trash' ) { |
|
582 | - if( 'trash' === $this->get_delete_mode() ) { |
|
581 | + if ( $entry[ 'status' ] === 'trash' ) { |
|
582 | + if ( 'trash' === $this->get_delete_mode() ) { |
|
583 | 583 | $error = __( 'The entry is already in the trash.', 'gravityview' ); |
584 | 584 | } else { |
585 | 585 | $error = __( 'You cannot delete the entry; it is already in the trash.', 'gravityview' ); |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | } |
588 | 588 | |
589 | 589 | // No errors; everything's fine here! |
590 | - if( empty( $error ) ) { |
|
590 | + if ( empty( $error ) ) { |
|
591 | 591 | return true; |
592 | 592 | } |
593 | 593 | |
@@ -616,10 +616,10 @@ discard block |
||
616 | 616 | |
617 | 617 | $current_user = wp_get_current_user(); |
618 | 618 | |
619 | - $entry_id = isset( $entry['id'] ) ? $entry['id'] : NULL; |
|
619 | + $entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : NULL; |
|
620 | 620 | |
621 | 621 | // Or if they can delete any entries (as defined in Gravity Forms), we're good. |
622 | - if( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) { |
|
622 | + if ( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) { |
|
623 | 623 | |
624 | 624 | gravityview()->log->debug( 'Current user has `gravityforms_delete_entries` or `gravityview_delete_others_entries` capability.' ); |
625 | 625 | |
@@ -628,20 +628,20 @@ discard block |
||
628 | 628 | |
629 | 629 | |
630 | 630 | // If field options are passed, check if current user can view the link |
631 | - if( !empty( $field ) ) { |
|
631 | + if ( ! empty( $field ) ) { |
|
632 | 632 | |
633 | 633 | // If capability is not defined, something is not right! |
634 | - if( empty( $field['allow_edit_cap'] ) ) { |
|
634 | + if ( empty( $field[ 'allow_edit_cap' ] ) ) { |
|
635 | 635 | |
636 | 636 | gravityview()->log->error( 'Cannot read delete entry field caps', array( 'data' => $field ) ); |
637 | 637 | |
638 | 638 | return false; |
639 | 639 | } |
640 | 640 | |
641 | - if( GVCommon::has_cap( $field['allow_edit_cap'] ) ) { |
|
641 | + if ( GVCommon::has_cap( $field[ 'allow_edit_cap' ] ) ) { |
|
642 | 642 | |
643 | 643 | // Do not return true if cap is read, as we need to check if the current user created the entry |
644 | - if( $field['allow_edit_cap'] !== 'read' ) { |
|
644 | + if ( $field[ 'allow_edit_cap' ] !== 'read' ) { |
|
645 | 645 | return true; |
646 | 646 | } |
647 | 647 | |
@@ -654,21 +654,21 @@ discard block |
||
654 | 654 | |
655 | 655 | } |
656 | 656 | |
657 | - if( !isset( $entry['created_by'] ) ) { |
|
657 | + if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
658 | 658 | |
659 | - gravityview()->log->error( 'Entry `created_by` doesn\'t exist.'); |
|
659 | + gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' ); |
|
660 | 660 | |
661 | 661 | return false; |
662 | 662 | } |
663 | 663 | |
664 | 664 | // Only checks user_delete view option if view is already set |
665 | - if( $view_id ) { |
|
665 | + if ( $view_id ) { |
|
666 | 666 | |
667 | 667 | $current_view = gravityview_get_current_view_data( $view_id ); |
668 | 668 | |
669 | - $user_delete = isset( $current_view['atts']['user_delete'] ) ? $current_view['atts']['user_delete'] : false; |
|
669 | + $user_delete = isset( $current_view[ 'atts' ][ 'user_delete' ] ) ? $current_view[ 'atts' ][ 'user_delete' ] : false; |
|
670 | 670 | |
671 | - if( empty( $user_delete ) ) { |
|
671 | + if ( empty( $user_delete ) ) { |
|
672 | 672 | |
673 | 673 | gravityview()->log->debug( 'User Delete is disabled. Returning false.' ); |
674 | 674 | |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | } |
678 | 678 | |
679 | 679 | // If the logged-in user is the same as the user who created the entry, we're good. |
680 | - if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
680 | + if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
681 | 681 | |
682 | 682 | gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) ); |
683 | 683 | |
@@ -702,16 +702,16 @@ discard block |
||
702 | 702 | */ |
703 | 703 | public function display_message( $current_view_id = 0 ) { |
704 | 704 | |
705 | - if( empty( $_GET['status'] ) || ! self::verify_nonce() ) { |
|
705 | + if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) { |
|
706 | 706 | return; |
707 | 707 | } |
708 | 708 | |
709 | 709 | // Entry wasn't deleted from current View |
710 | - if( isset( $_GET['view_id'] ) && intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) { |
|
710 | + if ( isset( $_GET[ 'view_id' ] ) && intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) { |
|
711 | 711 | return; |
712 | 712 | } |
713 | 713 | |
714 | - $status = esc_attr( $_GET['status'] ); |
|
714 | + $status = esc_attr( $_GET[ 'status' ] ); |
|
715 | 715 | $message_from_url = \GV\Utils::_GET( 'message' ); |
716 | 716 | $message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) ); |
717 | 717 | $class = ''; |
@@ -719,14 +719,14 @@ discard block |
||
719 | 719 | switch ( $status ) { |
720 | 720 | case 'error': |
721 | 721 | $class = ' gv-error error'; |
722 | - $error_message = __('There was an error deleting the entry: %s', 'gravityview'); |
|
722 | + $error_message = __( 'There was an error deleting the entry: %s', 'gravityview' ); |
|
723 | 723 | $message = sprintf( $error_message, $message_from_url ); |
724 | 724 | break; |
725 | 725 | case 'trashed': |
726 | - $message = __('The entry was successfully moved to the trash.', 'gravityview'); |
|
726 | + $message = __( 'The entry was successfully moved to the trash.', 'gravityview' ); |
|
727 | 727 | break; |
728 | 728 | default: |
729 | - $message = __('The entry was successfully deleted.', 'gravityview'); |
|
729 | + $message = __( 'The entry was successfully deleted.', 'gravityview' ); |
|
730 | 730 | break; |
731 | 731 | } |
732 | 732 | |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | $message = apply_filters( 'gravityview/delete-entry/message', esc_attr( $message ), $status, $message_from_url ); |
741 | 741 | |
742 | 742 | // DISPLAY ERROR/SUCCESS MESSAGE |
743 | - echo '<div class="gv-notice' . esc_attr( $class ) .'">'. $message .'</div>'; |
|
743 | + echo '<div class="gv-notice' . esc_attr( $class ) . '">' . $message . '</div>'; |
|
744 | 744 | } |
745 | 745 | |
746 | 746 |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | $disapproved_result = $wpdb->query( $wpdb->prepare( $sql, GravityView_Entry_Approval_Status::DISAPPROVED, '0' ) ); |
74 | 74 | |
75 | - if( false === $approved_result || false === $disapproved_result ) { |
|
75 | + if ( false === $approved_result || false === $disapproved_result ) { |
|
76 | 76 | gravityview()->log->error( 'There was an error processing the query. {error}', array( 'error' => $wpdb->last_error ) ); |
77 | 77 | } else { |
78 | 78 | // All done: Meta values are migrated |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | $redux_settings = $this->get_redux_settings(); |
106 | 106 | |
107 | 107 | // No need to process |
108 | - if( false === $redux_settings ) { |
|
108 | + if ( false === $redux_settings ) { |
|
109 | 109 | return; |
110 | 110 | } |
111 | 111 | |
112 | - if( empty( $redux_settings['license_key_status'] ) ) { |
|
112 | + if ( empty( $redux_settings[ 'license_key_status' ] ) ) { |
|
113 | 113 | $redux_settings = $this->get_redux_license_status( $redux_settings ); |
114 | 114 | } |
115 | 115 | |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | gravityview()->plugin->settings->update( $updated_settings ); |
124 | 124 | |
125 | 125 | // And now remove the previous option, so this is a one-time thing. |
126 | - delete_option('gravityview_settings'); |
|
127 | - delete_option('gravityview_settings-transients'); |
|
126 | + delete_option( 'gravityview_settings' ); |
|
127 | + delete_option( 'gravityview_settings-transients' ); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | |
148 | 148 | $license_call = \GV\License_Handler::get()->license_call( $data ); |
149 | 149 | |
150 | - if( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
151 | - $redux_settings['license_key_status'] = $license_call->license; |
|
152 | - $redux_settings['license_key_response'] = json_encode( $license_call ); |
|
150 | + if ( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
151 | + $redux_settings[ 'license_key_status' ] = $license_call->license; |
|
152 | + $redux_settings[ 'license_key_response' ] = json_encode( $license_call ); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | return $redux_settings; |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | function get_redux_settings() { |
164 | 164 | |
165 | 165 | // Previous settings set by Redux |
166 | - $redux_option = get_option('gravityview_settings'); |
|
166 | + $redux_option = get_option( 'gravityview_settings' ); |
|
167 | 167 | |
168 | 168 | // No Redux settings? Don't proceed. |
169 | - if( false === $redux_option ) { |
|
169 | + if ( false === $redux_option ) { |
|
170 | 170 | return false; |
171 | 171 | } |
172 | 172 | |
@@ -178,19 +178,19 @@ discard block |
||
178 | 178 | |
179 | 179 | if ( $license_array = \GV\Utils::get( $redux_option, 'license' ) ) { |
180 | 180 | |
181 | - $redux_settings['license_key'] = $license_key = \GV\Utils::get( $license_array, 'license' ); |
|
181 | + $redux_settings[ 'license_key' ] = $license_key = \GV\Utils::get( $license_array, 'license' ); |
|
182 | 182 | |
183 | - $redux_last_changed_values = get_option('gravityview_settings-transients'); |
|
183 | + $redux_last_changed_values = get_option( 'gravityview_settings-transients' ); |
|
184 | 184 | |
185 | 185 | // This contains the last response for license validation |
186 | - if( !empty( $redux_last_changed_values ) && $saved_values = \GV\Utils::get( $redux_last_changed_values, 'changed_values' ) ) { |
|
186 | + if ( ! empty( $redux_last_changed_values ) && $saved_values = \GV\Utils::get( $redux_last_changed_values, 'changed_values' ) ) { |
|
187 | 187 | |
188 | 188 | $saved_license = \GV\Utils::get( $saved_values, 'license' ); |
189 | 189 | |
190 | 190 | // Only use the last-saved values if they are for the same license |
191 | - if( $saved_license && \GV\Utils::get( $saved_license, 'license' ) === $license_key ) { |
|
192 | - $redux_settings['license_key_status'] = \GV\Utils::get( $saved_license, 'status' ); |
|
193 | - $redux_settings['license_key_response'] = \GV\Utils::get( $saved_license, 'response' ); |
|
191 | + if ( $saved_license && \GV\Utils::get( $saved_license, 'license' ) === $license_key ) { |
|
192 | + $redux_settings[ 'license_key_status' ] = \GV\Utils::get( $saved_license, 'status' ); |
|
193 | + $redux_settings[ 'license_key_response' ] = \GV\Utils::get( $saved_license, 'response' ); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | } |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | /** ---- Migrate from old search widget to new search widget ---- */ |
203 | 203 | function update_search_on_views() { |
204 | 204 | |
205 | - if( !class_exists('GravityView_Widget_Search') ) { |
|
206 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/search-widget/class-search-widget.php' ); |
|
205 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
206 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/search-widget/class-search-widget.php' ); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | // Loop through all the views |
@@ -215,20 +215,20 @@ discard block |
||
215 | 215 | |
216 | 216 | $views = get_posts( $query_args ); |
217 | 217 | |
218 | - foreach( $views as $view ) { |
|
218 | + foreach ( $views as $view ) { |
|
219 | 219 | |
220 | 220 | $widgets = gravityview_get_directory_widgets( $view->ID ); |
221 | 221 | $search_fields = null; |
222 | 222 | |
223 | - if( empty( $widgets ) || !is_array( $widgets ) ) { continue; } |
|
223 | + if ( empty( $widgets ) || ! is_array( $widgets ) ) { continue; } |
|
224 | 224 | |
225 | 225 | gravityview()->log->debug( '[GravityView_Migrate/update_search_on_views] Loading View ID: {view_id}', array( 'view_id' => $view->ID ) ); |
226 | 226 | |
227 | - foreach( $widgets as $area => $ws ) { |
|
228 | - foreach( $ws as $k => $widget ) { |
|
229 | - if( $widget['id'] !== 'search_bar' ) { continue; } |
|
227 | + foreach ( $widgets as $area => $ws ) { |
|
228 | + foreach ( $ws as $k => $widget ) { |
|
229 | + if ( $widget[ 'id' ] !== 'search_bar' ) { continue; } |
|
230 | 230 | |
231 | - if( is_null( $search_fields ) ) { |
|
231 | + if ( is_null( $search_fields ) ) { |
|
232 | 232 | $search_fields = $this->get_search_fields( $view->ID ); |
233 | 233 | } |
234 | 234 | |
@@ -236,24 +236,24 @@ discard block |
||
236 | 236 | // [search_free] => 1 |
237 | 237 | // [search_date] => 1 |
238 | 238 | $search_generic = array(); |
239 | - if( !empty( $widget['search_free'] ) ) { |
|
240 | - $search_generic[] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
239 | + if ( ! empty( $widget[ 'search_free' ] ) ) { |
|
240 | + $search_generic[ ] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
241 | 241 | } |
242 | - if( !empty( $widget['search_date'] ) ) { |
|
243 | - $search_generic[] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
242 | + if ( ! empty( $widget[ 'search_date' ] ) ) { |
|
243 | + $search_generic[ ] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | $search_config = array_merge( $search_generic, $search_fields ); |
247 | 247 | |
248 | 248 | // don't throw '[]' when json_encode an empty array |
249 | - if( empty( $search_config ) ) { |
|
249 | + if ( empty( $search_config ) ) { |
|
250 | 250 | $search_config = ''; |
251 | 251 | } else { |
252 | 252 | $search_config = json_encode( $search_config ); |
253 | 253 | } |
254 | 254 | |
255 | - $widgets[ $area ][ $k ]['search_fields'] = $search_config; |
|
256 | - $widgets[ $area ][ $k ]['search_layout'] = 'horizontal'; |
|
255 | + $widgets[ $area ][ $k ][ 'search_fields' ] = $search_config; |
|
256 | + $widgets[ $area ][ $k ][ 'search_layout' ] = 'horizontal'; |
|
257 | 257 | |
258 | 258 | gravityview()->log->debug( '[GravityView_Migrate/update_search_on_views] Updated Widget: ', array( 'data' => $widgets[ $area ][ $k ] ) ); |
259 | 259 | } |
@@ -281,26 +281,26 @@ discard block |
||
281 | 281 | // check view fields' settings |
282 | 282 | $fields = gravityview_get_directory_fields( $view_id, false ); |
283 | 283 | |
284 | - if( !empty( $fields ) && is_array( $fields ) ) { |
|
284 | + if ( ! empty( $fields ) && is_array( $fields ) ) { |
|
285 | 285 | |
286 | - foreach( $fields as $t => $fs ) { |
|
286 | + foreach ( $fields as $t => $fs ) { |
|
287 | 287 | |
288 | - foreach( $fs as $k => $field ) { |
|
288 | + foreach ( $fs as $k => $field ) { |
|
289 | 289 | // is field a search_filter ? |
290 | - if( empty( $field['search_filter'] ) ) { continue; } |
|
290 | + if ( empty( $field[ 'search_filter' ] ) ) { continue; } |
|
291 | 291 | |
292 | 292 | // get field type & calculate the input type (by default) |
293 | - $form_field = gravityview_get_field( $form, $field['id'] ); |
|
293 | + $form_field = gravityview_get_field( $form, $field[ 'id' ] ); |
|
294 | 294 | |
295 | - if( empty( $form_field['type'] ) ) { |
|
295 | + if ( empty( $form_field[ 'type' ] ) ) { |
|
296 | 296 | continue; |
297 | 297 | } |
298 | 298 | |
299 | 299 | // depending on the field type assign a group of possible search field types |
300 | - $type = GravityView_Widget_Search::get_search_input_types( $field['id'], $form_field['type'] ); |
|
300 | + $type = GravityView_Widget_Search::get_search_input_types( $field[ 'id' ], $form_field[ 'type' ] ); |
|
301 | 301 | |
302 | 302 | // add field to config |
303 | - $search_fields[] = array( 'field' => $field['id'], 'input' => $type ); |
|
303 | + $search_fields[ ] = array( 'field' => $field[ 'id' ], 'input' => $type ); |
|
304 | 304 | |
305 | 305 | } |
306 | 306 | } |
@@ -4,10 +4,10 @@ discard block |
||
4 | 4 | |
5 | 5 | function __construct() { |
6 | 6 | |
7 | - if( ! is_admin() ) { return; } |
|
7 | + if ( ! is_admin() ) { return; } |
|
8 | 8 | |
9 | 9 | // If Gravity Forms isn't active or compatibile, stop loading |
10 | - if( false === GravityView_Compatibility::is_valid() ) { |
|
10 | + if ( false === GravityView_Compatibility::is_valid() ) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
49 | 49 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
50 | 50 | |
51 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
51 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
52 | 52 | |
53 | 53 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
54 | 54 | |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public static function no_views_text() { |
66 | 66 | |
67 | - if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { |
|
67 | + if ( isset( $_REQUEST[ 'post_status' ] ) && 'trash' === $_REQUEST[ 'post_status' ] ) { |
|
68 | 68 | return __( 'No Views found in Trash', 'gravityview' ); |
69 | - } elseif( ! empty( $_GET['s'] ) ) { |
|
69 | + } elseif ( ! empty( $_GET[ 's' ] ) ) { |
|
70 | 70 | return __( 'No Views found.', 'gravityview' ); |
71 | 71 | } |
72 | 72 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $error .= ' ' . esc_html__( 'or select another form.', 'gravityview' ); |
111 | 111 | } |
112 | 112 | |
113 | - if( $error ) { |
|
113 | + if ( $error ) { |
|
114 | 114 | ?> |
115 | 115 | <div class="wp-dialog notice-warning inline error wp-clearfix"> |
116 | 116 | <?php echo gravityview_get_floaty(); ?> |
@@ -129,23 +129,23 @@ discard block |
||
129 | 129 | public function backend_actions() { |
130 | 130 | |
131 | 131 | /** @define "GRAVITYVIEW_DIR" "../" */ |
132 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
133 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
134 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-item.php' ); |
|
135 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-field.php' ); |
|
136 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
137 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
138 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
139 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-installer.php' ); |
|
140 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
141 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
132 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
133 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
134 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-item.php' ); |
|
135 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-field.php' ); |
|
136 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
137 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
138 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
139 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-installer.php' ); |
|
140 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
141 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
142 | 142 | |
143 | 143 | /** |
144 | 144 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
145 | 145 | * |
146 | 146 | * Nice place to insert extensions' backend stuff |
147 | 147 | */ |
148 | - do_action('gravityview_include_backend_actions'); |
|
148 | + do_action( 'gravityview_include_backend_actions' ); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | |
162 | 162 | $actions = array(); |
163 | 163 | |
164 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
165 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
164 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
165 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
166 | 166 | } |
167 | 167 | |
168 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
169 | - $actions[] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
168 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
169 | + $actions[ ] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | return array_merge( $actions, $links ); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | // By default, there will only be one item being modified. |
195 | 195 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
196 | 196 | // of modified items that will override this array. |
197 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
197 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
198 | 198 | |
199 | 199 | // If we're starting fresh, a new form was created. |
200 | 200 | // We should let the user know this is the case. |
@@ -202,60 +202,60 @@ discard block |
||
202 | 202 | |
203 | 203 | $new_form_text = ''; |
204 | 204 | |
205 | - if( !empty( $start_fresh ) ) { |
|
205 | + if ( ! empty( $start_fresh ) ) { |
|
206 | 206 | |
207 | 207 | // Get the form that was created |
208 | 208 | $connected_form = gravityview_get_form_id( $post_id ); |
209 | 209 | |
210 | - if( !empty( $connected_form ) ) { |
|
210 | + if ( ! empty( $connected_form ) ) { |
|
211 | 211 | $form = gravityview_get_form( $connected_form ); |
212 | - $form_name = esc_attr( $form['title'] ); |
|
212 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
213 | 213 | $image = self::get_floaty(); |
214 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
215 | - $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
214 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
215 | + $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
216 | 216 | |
217 | 217 | You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. |
218 | - ', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).'">', '</a>'); |
|
218 | + ', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&view=settings&id=' . $connected_form ) . '">', '</a>' ); |
|
219 | 219 | $new_form_text = wpautop( $new_form_text ); |
220 | 220 | |
221 | 221 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
225 | - $messages['gravityview'] = array( |
|
225 | + $messages[ 'gravityview' ] = array( |
|
226 | 226 | 0 => '', // Unused. Messages start at index 1. |
227 | 227 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
228 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
228 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
229 | 229 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
230 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
230 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
231 | 231 | 3 => __( 'View deleted.', 'gravityview' ), |
232 | 232 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
233 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
233 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
234 | 234 | /* translators: %s: date and time of the revision */ |
235 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
235 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
236 | 236 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
237 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
237 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
238 | 238 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
239 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
239 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
240 | 240 | 8 => __( 'View submitted.', 'gravityview' ), |
241 | 241 | 9 => sprintf( |
242 | 242 | /* translators: Date and time the View is scheduled to be published */ |
243 | 243 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
244 | 244 | // translators: Publish box date format, see http://php.net/date |
245 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
245 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
246 | 246 | ) . $new_form_text, |
247 | 247 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
248 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
248 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
249 | 249 | |
250 | 250 | /** |
251 | 251 | * These apply to `bulk_post_updated_messages` |
252 | 252 | * @file wp-admin/edit.php |
253 | 253 | */ |
254 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
255 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
256 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
257 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
258 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
254 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
255 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
256 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
257 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
258 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
259 | 259 | ); |
260 | 260 | |
261 | 261 | return $messages; |
@@ -7,15 +7,15 @@ |
||
7 | 7 | |
8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
9 | 9 | $view_id = $gravityview_view->getViewId(); |
10 | -$value = $gravityview_view->search_field['value']; |
|
11 | -$label = $gravityview_view->search_field['label']; |
|
10 | +$value = $gravityview_view->search_field[ 'value' ]; |
|
11 | +$label = $gravityview_view->search_field[ 'label' ]; |
|
12 | 12 | |
13 | 13 | $html_input_type = RGFormsModel::is_html5_enabled() ? 'search' : 'text'; |
14 | 14 | ?> |
15 | 15 | |
16 | 16 | <div class="gv-search-box gv-search-field-text gv-search-field-search_all"> |
17 | 17 | <div class="gv-search"> |
18 | - <?php if( ! gv_empty( $label, false, false ) ) { ?> |
|
18 | + <?php if ( ! gv_empty( $label, false, false ) ) { ?> |
|
19 | 19 | <label for="gv_search_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label> |
20 | 20 | <?php } ?> |
21 | 21 | <p><input type="<?php echo $html_input_type; ?>" name="gv_search" id="gv_search_<?php echo $view_id; ?>" value="<?php echo esc_attr( $value ); ?>" /></p> |
@@ -7,13 +7,13 @@ |
||
7 | 7 | |
8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
9 | 9 | $view_id = $gravityview_view->getViewId(); |
10 | -$value = $gravityview_view->search_field['value']; |
|
11 | -$label = $gravityview_view->search_field['label']; |
|
10 | +$value = $gravityview_view->search_field[ 'value' ]; |
|
11 | +$label = $gravityview_view->search_field[ 'label' ]; |
|
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class="gv-search-box gv-search-field-entry_id"> |
15 | 15 | <div class="gv-search"> |
16 | - <?php if( ! gv_empty( $label, false, false ) ) { ?> |
|
16 | + <?php if ( ! gv_empty( $label, false, false ) ) { ?> |
|
17 | 17 | <label for="gv_entry_id_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label> |
18 | 18 | <?php } ?> |
19 | 19 | <p><input type="text" name="gv_id" id="gv_entry_id_<?php echo $view_id; ?>" value="<?php echo esc_attr( $value ); ?>" /></p> |
@@ -7,17 +7,17 @@ |
||
7 | 7 | |
8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
9 | 9 | $view_id = $gravityview_view->getViewId(); |
10 | -$value = $gravityview_view->search_field['value']; |
|
11 | -$label = $gravityview_view->search_field['label']; |
|
10 | +$value = $gravityview_view->search_field[ 'value' ]; |
|
11 | +$label = $gravityview_view->search_field[ 'label' ]; |
|
12 | 12 | |
13 | 13 | ?> |
14 | 14 | |
15 | 15 | <div class="gv-search-box gv-search-date gv-search-date-range gv-search-field-entry_date"> |
16 | - <?php if( ! gv_empty( $label, false, false ) ) { ?> |
|
16 | + <?php if ( ! gv_empty( $label, false, false ) ) { ?> |
|
17 | 17 | <label for="gv_start_date_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label> |
18 | 18 | <?php } ?> |
19 | 19 | <p> |
20 | - <input name="gv_start" id="gv_start_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('Start date', 'gravityview' ); ?>" value="<?php echo $value['start']; ?>"> |
|
21 | - <input name="gv_end" id="gv_end_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('End date', 'gravityview' ); ?>" value="<?php echo $value['end']; ?>"> |
|
20 | + <input name="gv_start" id="gv_start_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'Start date', 'gravityview' ); ?>" value="<?php echo $value[ 'start' ]; ?>"> |
|
21 | + <input name="gv_end" id="gv_end_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'End date', 'gravityview' ); ?>" value="<?php echo $value[ 'end' ]; ?>"> |
|
22 | 22 | </p> |
23 | 23 | </div> |
24 | 24 | \ No newline at end of file |
@@ -7,17 +7,17 @@ |
||
7 | 7 | |
8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
9 | 9 | $view_id = $gravityview_view->getViewId(); |
10 | -$value = $gravityview_view->search_field['value']; |
|
11 | -$label = $gravityview_view->search_field['label']; |
|
12 | -$name = $gravityview_view->search_field['name']; |
|
10 | +$value = $gravityview_view->search_field[ 'value' ]; |
|
11 | +$label = $gravityview_view->search_field[ 'label' ]; |
|
12 | +$name = $gravityview_view->search_field[ 'name' ]; |
|
13 | 13 | ?> |
14 | 14 | |
15 | 15 | <div class="gv-search-box gv-search-date gv-search-date-range"> |
16 | - <?php if( ! gv_empty( $label, false, false ) ) { ?> |
|
17 | - <label for="search-box-<?php echo esc_attr( $name ).'-start'; ?>"><?php echo esc_html( $label ); ?></label> |
|
16 | + <?php if ( ! gv_empty( $label, false, false ) ) { ?> |
|
17 | + <label for="search-box-<?php echo esc_attr( $name ) . '-start'; ?>"><?php echo esc_html( $label ); ?></label> |
|
18 | 18 | <?php } ?> |
19 | 19 | <p> |
20 | - <input name="<?php echo esc_attr( $name ).'[start]'; ?>" id="search-box-<?php echo esc_attr( $name ).'-start'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('Start date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value['start'] ); ?>"> |
|
21 | - <input name="<?php echo esc_attr( $name ).'[end]'; ?>" id="search-box-<?php echo esc_attr( $name ).'-end'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('End date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value['end'] ); ?>"> |
|
20 | + <input name="<?php echo esc_attr( $name ) . '[start]'; ?>" id="search-box-<?php echo esc_attr( $name ) . '-start'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'Start date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value[ 'start' ] ); ?>"> |
|
21 | + <input name="<?php echo esc_attr( $name ) . '[end]'; ?>" id="search-box-<?php echo esc_attr( $name ) . '-end'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'End date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value[ 'end' ] ); ?>"> |
|
22 | 22 | </p> |
23 | 23 | </div> |
24 | 24 | \ No newline at end of file |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $args = array(); |
115 | 115 | |
116 | - $view_id = is_null ( $view ) ? null : $view->ID; |
|
116 | + $view_id = is_null( $view ) ? null : $view->ID; |
|
117 | 117 | |
118 | 118 | $permalink = null; |
119 | 119 | |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | |
127 | 127 | $view_collection = View_Collection::from_post( $post ); |
128 | 128 | |
129 | - if( 1 < $view_collection->count() ) { |
|
130 | - $args['gvid'] = $view_id; |
|
129 | + if ( 1 < $view_collection->count() ) { |
|
130 | + $args[ 'gvid' ] = $view_id; |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | } |
@@ -156,21 +156,21 @@ discard block |
||
156 | 156 | */ |
157 | 157 | $link_parts = explode( '?', $permalink ); |
158 | 158 | |
159 | - $query = ! empty( $link_parts[1] ) ? '?' . $link_parts[1] : ''; |
|
159 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
160 | 160 | |
161 | - $permalink = trailingslashit( $link_parts[0] ) . $entry_endpoint_name . '/'. $entry_slug .'/' . $query; |
|
161 | + $permalink = trailingslashit( $link_parts[ 0 ] ) . $entry_endpoint_name . '/' . $entry_slug . '/' . $query; |
|
162 | 162 | } else { |
163 | 163 | $args[ $entry_endpoint_name ] = $entry_slug; |
164 | 164 | } |
165 | 165 | |
166 | 166 | if ( $track_directory ) { |
167 | - if ( ! empty( $_GET['pagenum'] ) ) { |
|
168 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
167 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
168 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | if ( $sort = Utils::_GET( 'sort' ) ) { |
172 | - $args['sort'] = $sort; |
|
173 | - $args['dir'] = Utils::_GET( 'dir' ); |
|
172 | + $args[ 'sort' ] = $sort; |
|
173 | + $args[ 'dir' ] = Utils::_GET( 'dir' ); |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | $atts = shortcode_atts( self::$defaults, $atts ); |
77 | 77 | |
78 | - $atts['action'] = 'edit'; |
|
78 | + $atts[ 'action' ] = 'edit'; |
|
79 | 79 | |
80 | 80 | return $this->shortcode( $atts, $content, $context ); |
81 | 81 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $atts = shortcode_atts( self::$defaults, $atts ); |
93 | 93 | |
94 | - $atts['action'] = 'delete'; |
|
94 | + $atts[ 'action' ] = 'delete'; |
|
95 | 95 | |
96 | 96 | return $this->shortcode( $atts, $content, $context ); |
97 | 97 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | $this->settings = shortcode_atts( self::$defaults, $atts, $context ); |
133 | 133 | |
134 | - $this->view_id = empty( $this->settings['view_id'] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings['view_id'] ); |
|
134 | + $this->view_id = empty( $this->settings[ 'view_id' ] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings[ 'view_id' ] ); |
|
135 | 135 | |
136 | 136 | if ( empty( $this->view_id ) ) { |
137 | 137 | gravityview()->log->error( 'A View ID was not defined and we are not inside a View' ); |
@@ -139,10 +139,10 @@ discard block |
||
139 | 139 | return null; |
140 | 140 | } |
141 | 141 | |
142 | - $this->entry = $this->get_entry( $this->settings['entry_id'] ); |
|
142 | + $this->entry = $this->get_entry( $this->settings[ 'entry_id' ] ); |
|
143 | 143 | |
144 | 144 | if ( empty( $this->entry ) ) { |
145 | - gravityview()->log->error( 'An Entry ID was not defined or found. Entry ID: {entry_id}', array( 'entry_id' => $this->settings['entry_id'] ) ); |
|
145 | + gravityview()->log->error( 'An Entry ID was not defined or found. Entry ID: {entry_id}', array( 'entry_id' => $this->settings[ 'entry_id' ] ) ); |
|
146 | 146 | |
147 | 147 | return null; |
148 | 148 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | gravityview()->log->debug( '{context} atts:', array( 'context' => $context, 'data' => $atts ) ); |
151 | 151 | |
152 | 152 | if ( ! $this->has_cap() ) { |
153 | - gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings['action'] ), 'entry_id' => $this->entry['id'] ) ); |
|
153 | + gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings[ 'action' ] ), 'entry_id' => $this->entry[ 'id' ] ) ); |
|
154 | 154 | |
155 | 155 | return null; |
156 | 156 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | // Get just the URL, not the tag |
167 | - if ( 'url' === $this->settings['return'] ) { |
|
167 | + if ( 'url' === $this->settings[ 'return' ] ) { |
|
168 | 168 | return $url; |
169 | 169 | } |
170 | 170 | |
@@ -185,13 +185,13 @@ discard block |
||
185 | 185 | */ |
186 | 186 | private function get_link_atts() { |
187 | 187 | |
188 | - wp_parse_str( $this->settings['link_atts'], $link_atts ); |
|
188 | + wp_parse_str( $this->settings[ 'link_atts' ], $link_atts ); |
|
189 | 189 | |
190 | - if ( 'delete' === $this->settings['action'] ) { |
|
191 | - $link_atts['onclick'] = isset( $link_atts['onclick'] ) ? $link_atts['onclick'] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
190 | + if ( 'delete' === $this->settings[ 'action' ] ) { |
|
191 | + $link_atts[ 'onclick' ] = isset( $link_atts[ 'onclick' ] ) ? $link_atts[ 'onclick' ] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
192 | 192 | } |
193 | 193 | |
194 | - return (array) $link_atts; |
|
194 | + return (array)$link_atts; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | return do_shortcode( $content ); |
212 | 212 | } |
213 | 213 | |
214 | - switch ( $this->settings['action'] ) { |
|
214 | + switch ( $this->settings[ 'action' ] ) { |
|
215 | 215 | case 'edit': |
216 | 216 | $anchor_text = __( 'Edit Entry', 'gravityview' ); |
217 | 217 | break; |
@@ -239,9 +239,9 @@ discard block |
||
239 | 239 | private function get_url() { |
240 | 240 | |
241 | 241 | // if post_id is not defined, default to view_id |
242 | - $post_id = empty( $this->settings['post_id'] ) ? $this->view_id : $this->settings['post_id']; |
|
242 | + $post_id = empty( $this->settings[ 'post_id' ] ) ? $this->view_id : $this->settings[ 'post_id' ]; |
|
243 | 243 | |
244 | - switch ( $this->settings['action'] ) { |
|
244 | + switch ( $this->settings[ 'action' ] ) { |
|
245 | 245 | case 'edit': |
246 | 246 | $url = GravityView_Edit_Entry::get_edit_link( $this->entry, $this->view_id, $post_id ); |
247 | 247 | break; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | */ |
267 | 267 | private function has_cap() { |
268 | 268 | |
269 | - switch ( $this->settings['action'] ) { |
|
269 | + switch ( $this->settings[ 'action' ] ) { |
|
270 | 270 | case 'edit': |
271 | 271 | $has_cap = GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view_id ); |
272 | 272 | break; |
@@ -331,9 +331,9 @@ discard block |
||
331 | 331 | */ |
332 | 332 | private function maybe_add_field_values_query_args( $url ) { |
333 | 333 | |
334 | - if ( $url && ! empty( $this->settings['field_values'] ) ) { |
|
334 | + if ( $url && ! empty( $this->settings[ 'field_values' ] ) ) { |
|
335 | 335 | |
336 | - wp_parse_str( $this->settings['field_values'], $field_values ); |
|
336 | + wp_parse_str( $this->settings[ 'field_values' ], $field_values ); |
|
337 | 337 | |
338 | 338 | $url = add_query_arg( $field_values, $url ); |
339 | 339 | } |