@@ -9,9 +9,9 @@ discard block |
||
| 9 | 9 | $gravityview_view = GravityView_View::getInstance(); |
| 10 | 10 | |
| 11 | 11 | $visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' ); |
| 12 | -$show_notes_logged_out = ( ! empty( $visibility_settings['view'] ) && ! empty( $visibility_settings['view_loggedout'] ) ); |
|
| 12 | +$show_notes_logged_out = ( ! empty( $visibility_settings[ 'view' ] ) && ! empty( $visibility_settings[ 'view_loggedout' ] ) ); |
|
| 13 | 13 | |
| 14 | -if( ! GVCommon::has_cap( array( 'gravityview_view_entry_notes', 'gravityview_add_entry_notes', 'gravityview_delete_entry_notes' ) ) && ! $show_notes_logged_out ) { |
|
| 14 | +if ( ! GVCommon::has_cap( array( 'gravityview_view_entry_notes', 'gravityview_add_entry_notes', 'gravityview_delete_entry_notes' ) ) && ! $show_notes_logged_out ) { |
|
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -25,20 +25,20 @@ discard block |
||
| 25 | 25 | do_action( 'gravityview/field/notes/scripts' ); |
| 26 | 26 | |
| 27 | 27 | $entry = $gravityview_view->getCurrentEntry(); |
| 28 | -$notes = (array) GravityView_Entry_Notes::get_notes( $entry['id'] ); |
|
| 28 | +$notes = (array)GravityView_Entry_Notes::get_notes( $entry[ 'id' ] ); |
|
| 29 | 29 | $strings = GravityView_Field_Notes::strings(); |
| 30 | -$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
| 30 | +$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 31 | 31 | |
| 32 | -$show_add = ! empty( $visibility_settings['add'] ); |
|
| 33 | -$show_delete = ( ! empty( $visibility_settings['delete'] ) && GVCommon::has_cap( 'gravityview_delete_entry_notes' ) ); |
|
| 34 | -$show_notes = $show_notes_logged_out || ( ! empty( $visibility_settings['view'] ) && GVCommon::has_cap( 'gravityview_view_entry_notes' ) ); |
|
| 32 | +$show_add = ! empty( $visibility_settings[ 'add' ] ); |
|
| 33 | +$show_delete = ( ! empty( $visibility_settings[ 'delete' ] ) && GVCommon::has_cap( 'gravityview_delete_entry_notes' ) ); |
|
| 34 | +$show_notes = $show_notes_logged_out || ( ! empty( $visibility_settings[ 'view' ] ) && GVCommon::has_cap( 'gravityview_view_entry_notes' ) ); |
|
| 35 | 35 | |
| 36 | 36 | $container_class = ( sizeof( $notes ) > 0 ? 'gv-has-notes' : 'gv-no-notes' ); |
| 37 | 37 | $container_class .= $show_notes ? ' gv-show-notes' : ' gv-hide-notes'; |
| 38 | 38 | ?> |
| 39 | 39 | <div class="gv-notes <?php echo $container_class; ?>"> |
| 40 | 40 | <?php |
| 41 | - if( $show_notes ) { |
|
| 41 | + if ( $show_notes ) { |
|
| 42 | 42 | ?> |
| 43 | 43 | <form method="post" class="gv-notes-list"> |
| 44 | 44 | <?php if ( $show_delete ) { wp_nonce_field( 'gv_delete_notes_' . $entry_slug, 'gv_delete_notes' ); } ?> |
@@ -46,21 +46,21 @@ discard block |
||
| 46 | 46 | <input type="hidden" name="action" value="gv_delete_notes" /> |
| 47 | 47 | <input type="hidden" name="entry-slug" value="<?php echo esc_attr( $entry_slug ); ?>" /> |
| 48 | 48 | <table> |
| 49 | - <caption><?php echo $strings['caption']; ?></caption> |
|
| 49 | + <caption><?php echo $strings[ 'caption' ]; ?></caption> |
|
| 50 | 50 | <?php |
| 51 | 51 | if ( $show_delete ) { |
| 52 | 52 | ?> |
| 53 | 53 | <thead> |
| 54 | 54 | <tr> |
| 55 | 55 | <th colspan="2"> |
| 56 | - <label><input type="checkbox" value="" class="gv-notes-toggle" title="<?php echo $strings['toggle-notes']; ?>"><span class="screen-reader-text"><?php echo $strings['toggle-notes']; ?></span></label> |
|
| 57 | - <button type="submit" class="button button-small gv-notes-delete"><?php echo $strings['delete']; ?></button> |
|
| 56 | + <label><input type="checkbox" value="" class="gv-notes-toggle" title="<?php echo $strings[ 'toggle-notes' ]; ?>"><span class="screen-reader-text"><?php echo $strings[ 'toggle-notes' ]; ?></span></label> |
|
| 57 | + <button type="submit" class="button button-small gv-notes-delete"><?php echo $strings[ 'delete' ]; ?></button> |
|
| 58 | 58 | </th> |
| 59 | 59 | </tr> |
| 60 | 60 | </thead> |
| 61 | 61 | <?php } ?> |
| 62 | 62 | <tbody> |
| 63 | - <tr class="gv-notes-no-notes"><td colspan="2"><?php echo $strings['no-notes']; ?></td></tr> |
|
| 63 | + <tr class="gv-notes-no-notes"><td colspan="2"><?php echo $strings[ 'no-notes' ]; ?></td></tr> |
|
| 64 | 64 | <?php |
| 65 | 65 | foreach ( $notes as $note ) { |
| 66 | 66 | echo GravityView_Field_Notes::display_note( $note, $show_delete ); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | <?php |
| 74 | 74 | } // End if can view notes |
| 75 | 75 | |
| 76 | - if( $show_add ) { |
|
| 76 | + if ( $show_add ) { |
|
| 77 | 77 | echo do_shortcode( '[gv_note_add]' ); |
| 78 | 78 | } |
| 79 | 79 | ?> |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $post_types = get_post_types(); |
| 51 | 51 | |
| 52 | - foreach( $post_types as $post_type ) { |
|
| 52 | + foreach ( $post_types as $post_type ) { |
|
| 53 | 53 | $post_type_rewrite = get_post_type_object( $post_type )->rewrite; |
| 54 | 54 | |
| 55 | 55 | if ( $slug = \GV\Utils::get( $post_type_rewrite, 'slug' ) ) { |
| 56 | - $reserved_slugs[] = $slug; |
|
| 56 | + $reserved_slugs[ ] = $slug; |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
@@ -89,8 +89,7 @@ discard block |
||
| 89 | 89 | $tab = __( 'Edit Entry', 'gravityview' ); |
| 90 | 90 | $context = 'edit'; |
| 91 | 91 | break; |
| 92 | - case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ): |
|
| 93 | - $tab = __( 'Single Entry', 'gravityview' ); |
|
| 92 | + case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ) : $tab = __( 'Single Entry', 'gravityview' ); |
|
| 94 | 93 | $context = 'single'; |
| 95 | 94 | break; |
| 96 | 95 | default: |
@@ -110,7 +109,7 @@ discard block |
||
| 110 | 109 | $action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab ); |
| 111 | 110 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
| 112 | 111 | |
| 113 | - $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
| 112 | + $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
| 114 | 113 | $output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
| 115 | 114 | |
| 116 | 115 | echo \GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $gravityview->view->ID ); |