@@ -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,7 +100,7 @@ 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 | /** |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | return ''; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if ( $entry['status'] != 'active' ) { |
|
| 117 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 118 | 118 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 119 | 119 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 120 | 120 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if ( $view->settings->get( 'show_only_approved' ) ) { |
| 128 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 128 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 129 | 129 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 130 | 130 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 131 | 131 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | return ''; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if ( $entry['status'] != 'active' ) { |
|
| 148 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 149 | 149 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 150 | 150 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 151 | 151 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | if ( $view->settings->get( 'show_only_approved' ) ) { |
| 159 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 159 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 160 | 160 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 161 | 161 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 162 | 162 | } |
@@ -173,10 +173,10 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | // Mock the request with the actual View, not the global one |
| 175 | 175 | $mock_request = new \GV\Mock_Request(); |
| 176 | - $mock_request->returns['is_view'] = $view; |
|
| 177 | - $mock_request->returns['is_entry'] = $request->is_entry(); |
|
| 178 | - $mock_request->returns['is_edit_entry'] = $request->is_edit_entry(); |
|
| 179 | - $mock_request->returns['is_search'] = $request->is_search(); |
|
| 176 | + $mock_request->returns[ 'is_view' ] = $view; |
|
| 177 | + $mock_request->returns[ 'is_entry' ] = $request->is_entry(); |
|
| 178 | + $mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry(); |
|
| 179 | + $mock_request->returns[ 'is_search' ] = $request->is_search(); |
|
| 180 | 180 | |
| 181 | 181 | $request = $mock_request; |
| 182 | 182 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | private function detail( $view, $entries, $atts ) { |
| 199 | 199 | $output = ''; |
| 200 | 200 | |
| 201 | - switch ( $key = $atts['detail'] ): |
|
| 201 | + switch ( $key = $atts[ 'detail' ] ): |
|
| 202 | 202 | case 'total_entries': |
| 203 | 203 | $output = number_format_i18n( $entries->total() ); |
| 204 | 204 | break; |