|
@@ -108,7 +108,7 @@ discard block |
|
|
block discarded – undo |
|
108
|
108
|
$supports = array( 'title', 'revisions' ); |
|
109
|
109
|
|
|
110
|
110
|
if ( $is_hierarchical ) { |
|
111
|
|
- $supports[] = 'page-attributes'; |
|
|
111
|
+ $supports[ ] = 'page-attributes'; |
|
112
|
112
|
} |
|
113
|
113
|
|
|
114
|
114
|
/** |
|
@@ -282,7 +282,7 @@ discard block |
|
|
block discarded – undo |
|
282
|
282
|
* Editing a single entry. |
|
283
|
283
|
*/ |
|
284
|
284
|
if ( $entry = $request->is_edit_entry() ) { |
|
285
|
|
- if ( $entry['status'] != 'active' ) { |
|
|
285
|
+ if ( $entry[ 'status' ] != 'active' ) { |
|
286
|
286
|
gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
|
287
|
287
|
return __( 'You are not allowed to view this content.', 'gravityview' ); |
|
288
|
288
|
} |
|
@@ -293,7 +293,7 @@ discard block |
|
|
block discarded – undo |
|
293
|
293
|
} |
|
294
|
294
|
|
|
295
|
295
|
if ( $view->settings->get( 'show_only_approved' ) ) { |
|
296
|
|
- if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
|
296
|
+ if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
297
|
297
|
gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
|
298
|
298
|
return __( 'You are not allowed to view this content.', 'gravityview' ); |
|
299
|
299
|
} |
|
@@ -306,7 +306,7 @@ discard block |
|
|
block discarded – undo |
|
306
|
306
|
* Viewing a single entry. |
|
307
|
307
|
*/ |
|
308
|
308
|
} else if ( $entry = $request->is_entry() ) { |
|
309
|
|
- if ( $entry['status'] != 'active' ) { |
|
|
309
|
+ if ( $entry[ 'status' ] != 'active' ) { |
|
310
|
310
|
gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
|
311
|
311
|
return __( 'You are not allowed to view this content.', 'gravityview' ); |
|
312
|
312
|
} |
|
@@ -317,7 +317,7 @@ discard block |
|
|
block discarded – undo |
|
317
|
317
|
} |
|
318
|
318
|
|
|
319
|
319
|
if ( $view->settings->get( 'show_only_approved' ) ) { |
|
320
|
|
- if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
|
320
|
+ if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
321
|
321
|
gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
|
322
|
322
|
return __( 'You are not allowed to view this content.', 'gravityview' ); |
|
323
|
323
|
} |
|
@@ -365,11 +365,11 @@ discard block |
|
|
block discarded – undo |
|
365
|
365
|
if ( ! $view->form ) { |
|
366
|
366
|
gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array( |
|
367
|
367
|
'view_id' => $view->ID, |
|
368
|
|
- 'form_id' => $view->_gravityview_form_id ? : 0, |
|
|
368
|
+ 'form_id' => $view->_gravityview_form_id ?: 0, |
|
369
|
369
|
) ); |
|
370
|
370
|
} else if ( gravityview()->plugin->supports( Plugin::FEATURE_JOINS ) ) { |
|
371
|
371
|
/** And the connected joins. */ |
|
372
|
|
- foreach( (array)get_post_meta( $view->ID, '_gravityview_form_joins', true ) as $_join ) { |
|
|
372
|
+ foreach ( (array)get_post_meta( $view->ID, '_gravityview_form_joins', true ) as $_join ) { |
|
373
|
373
|
if ( ! is_array( $_join ) || count( $_join ) != 4 ) { |
|
374
|
374
|
continue; |
|
375
|
375
|
} |
|
@@ -381,7 +381,7 @@ discard block |
|
|
block discarded – undo |
|
381
|
381
|
$join_column = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field( $join_column ); |
|
382
|
382
|
$join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field( $join_on_column ); |
|
383
|
383
|
|
|
384
|
|
- $view->joins []= new Join( $join, $join_column, $join_on, $join_on_column ); |
|
|
384
|
+ $view->joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
385
|
385
|
} |
|
386
|
386
|
} |
|
387
|
387
|
|
|
@@ -605,28 +605,27 @@ discard block |
|
|
block discarded – undo |
|
605
|
605
|
* @todo: Stop using _frontend and use something like $request->get_search_criteria() instead |
|
606
|
606
|
*/ |
|
607
|
607
|
$parameters = \GravityView_frontend::get_view_entries_parameters( $this->settings->as_atts(), $this->form->ID ); |
|
608
|
|
- $parameters['context_view_id'] = $this->ID; |
|
|
608
|
+ $parameters[ 'context_view_id' ] = $this->ID; |
|
609
|
609
|
$parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID ); |
|
610
|
610
|
|
|
611
|
611
|
if ( $request instanceof REST\Request ) { |
|
612
|
612
|
$atts = $this->settings->as_atts(); |
|
613
|
613
|
$paging_parameters = wp_parse_args( $request->get_paging(), array( |
|
614
|
|
- 'paging' => array( 'page_size' => $atts['page_size'] ), |
|
|
614
|
+ 'paging' => array( 'page_size' => $atts[ 'page_size' ] ), |
|
615
|
615
|
) ); |
|
616
|
|
- $parameters['paging'] = $paging_parameters['paging']; |
|
|
616
|
+ $parameters[ 'paging' ] = $paging_parameters[ 'paging' ]; |
|
617
|
617
|
} |
|
618
|
618
|
|
|
619
|
|
- $page = Utils::get( $parameters['paging'], 'current_page' ) ? |
|
620
|
|
- : ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / $parameters['paging']['page_size'] ) + 1 ); |
|
|
619
|
+ $page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 ); |
|
621
|
620
|
|
|
622
|
621
|
if ( gravityview()->plugin->supports( Plugin::FEATURE_GFQUERY ) ) { |
|
623
|
622
|
/** |
|
624
|
623
|
* New \GF_Query stuff :) |
|
625
|
624
|
*/ |
|
626
|
|
- $query = new \GF_Query( $this->form->ID, $parameters['search_criteria'], $parameters['sorting'] ); |
|
|
625
|
+ $query = new \GF_Query( $this->form->ID, $parameters[ 'search_criteria' ], $parameters[ 'sorting' ] ); |
|
627
|
626
|
|
|
628
|
|
- $query->limit( $parameters['paging']['page_size'] ) |
|
629
|
|
- ->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) ); |
|
|
627
|
+ $query->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
|
628
|
+ ->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) ); |
|
630
|
629
|
|
|
631
|
630
|
/** |
|
632
|
631
|
* Any joins? |
|
@@ -666,15 +665,15 @@ discard block |
|
|
block discarded – undo |
|
666
|
665
|
} ); |
|
667
|
666
|
} else { |
|
668
|
667
|
$entries = $this->form->entries |
|
669
|
|
- ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) ) |
|
|
668
|
+ ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) ) |
|
670
|
669
|
->offset( $this->settings->get( 'offset' ) ) |
|
671
|
|
- ->limit( $parameters['paging']['page_size'] ) |
|
|
670
|
+ ->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
672
|
671
|
->page( $page ); |
|
673
|
672
|
|
|
674
|
|
- if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) { |
|
|
673
|
+ if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) { |
|
675
|
674
|
$field = new \GV\Field(); |
|
676
|
|
- $field->ID = $parameters['sorting']['key']; |
|
677
|
|
- $direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
|
675
|
+ $field->ID = $parameters[ 'sorting' ][ 'key' ]; |
|
|
676
|
+ $direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
678
|
677
|
$entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) ); |
|
679
|
678
|
} |
|
680
|
679
|
} |