@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | 'detail' => null, |
| 38 | 38 | ) ); |
| 39 | 39 | |
| 40 | - if ( ! $view_id = $atts['id'] ? : $atts['view_id'] ) { |
|
| 41 | - if ( $atts['detail'] && $view = $request->is_view() ) { |
|
| 40 | + if ( ! $view_id = $atts[ 'id' ] ?: $atts[ 'view_id' ] ) { |
|
| 41 | + if ( $atts[ 'detail' ] && $view = $request->is_view() ) { |
|
| 42 | 42 | $view_id = $view->ID; |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | return get_the_password_form( $view->ID ); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - if ( ! $view->form ) { |
|
| 79 | + if ( ! $view->form ) { |
|
| 80 | 80 | gravityview()->log->notice( 'View #{id} has no form attached to it.', array( 'id' => $view->ID ) ); |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -100,14 +100,14 @@ discard block |
||
| 100 | 100 | /** |
| 101 | 101 | * View details. |
| 102 | 102 | */ |
| 103 | - if ( $atts['detail'] ) { |
|
| 103 | + if ( $atts[ 'detail' ] ) { |
|
| 104 | 104 | return $this->detail( $view, $entries, $atts ); |
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | 107 | * Editing a single entry. |
| 108 | 108 | */ |
| 109 | 109 | } else if ( ! $is_reembedded && ( $entry = $request->is_edit_entry() ) ) { |
| 110 | - if ( $entry['status'] != 'active' ) { |
|
| 110 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 111 | 111 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 112 | 112 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 113 | 113 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | if ( $view->settings->get( 'show_only_approved' ) ) { |
| 121 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 121 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 122 | 122 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 123 | 123 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 124 | 124 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * Viewing a single entry. |
| 132 | 132 | */ |
| 133 | 133 | } else if ( ! $is_reembedded && ( $entry = $request->is_entry() ) ) { |
| 134 | - if ( $entry['status'] != 'active' ) { |
|
| 134 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 135 | 135 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 136 | 136 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 137 | 137 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if ( $view->settings->get( 'show_only_approved' ) ) { |
| 145 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 145 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 146 | 146 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 147 | 147 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 148 | 148 | } |
@@ -159,10 +159,10 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | // Mock the request with the actual View, not the global one |
| 161 | 161 | $mock_request = new \GV\Mock_Request(); |
| 162 | - $mock_request->returns['is_view'] = $view; |
|
| 163 | - $mock_request->returns['is_entry'] = $request->is_entry(); |
|
| 164 | - $mock_request->returns['is_edit_entry'] = $request->is_edit_entry(); |
|
| 165 | - $mock_request->returns['is_search'] = $request->is_search(); |
|
| 162 | + $mock_request->returns[ 'is_view' ] = $view; |
|
| 163 | + $mock_request->returns[ 'is_entry' ] = $request->is_entry(); |
|
| 164 | + $mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry(); |
|
| 165 | + $mock_request->returns[ 'is_search' ] = $request->is_search(); |
|
| 166 | 166 | |
| 167 | 167 | $request = $mock_request; |
| 168 | 168 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | private function detail( $view, $entries, $atts ) { |
| 185 | 185 | $output = ''; |
| 186 | 186 | |
| 187 | - switch ( $key = $atts['detail'] ): |
|
| 187 | + switch ( $key = $atts[ 'detail' ] ): |
|
| 188 | 188 | case 'total_entries': |
| 189 | 189 | $output = number_format_i18n( $entries->total() ); |
| 190 | 190 | break; |