|
@@ -85,9 +85,9 @@ discard block |
|
|
block discarded – undo |
|
85
|
85
|
private function __construct() {} |
|
86
|
86
|
|
|
87
|
87
|
private function initialize() { |
|
88
|
|
- add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
|
88
|
+ add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
89
|
89
|
add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 ); |
|
90
|
|
- add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
|
90
|
+ add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
91
|
91
|
|
|
92
|
92
|
// Enqueue scripts and styles after GravityView_Template::register_styles() |
|
93
|
93
|
add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
|
@@ -236,15 +236,15 @@ discard block |
|
|
block discarded – undo |
|
236
|
236
|
|
|
237
|
237
|
$this->context_view_id = $view_id; |
|
238
|
238
|
|
|
239
|
|
- } elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
|
239
|
+ } elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
240
|
240
|
/** |
|
241
|
241
|
* used on a has_multiple_views context |
|
242
|
242
|
* @see GravityView_API::entry_link |
|
243
|
243
|
* @see GravityView_View_Data::getInstance()->has_multiple_views() |
|
244
|
244
|
*/ |
|
245
|
|
- $this->context_view_id = $_GET['gvid']; |
|
|
245
|
+ $this->context_view_id = $_GET[ 'gvid' ]; |
|
246
|
246
|
|
|
247
|
|
- } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
|
247
|
+ } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
248
|
248
|
$array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
|
249
|
249
|
$this->context_view_id = array_pop( $array_keys ); |
|
250
|
250
|
unset( $array_keys ); |
|
@@ -279,24 +279,24 @@ discard block |
|
|
block discarded – undo |
|
279
|
279
|
global $wp_rewrite; |
|
280
|
280
|
|
|
281
|
281
|
$is_front_page = ( $query->is_home || $query->is_page ); |
|
282
|
|
- $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
283
|
|
- $front_page_id = get_option('page_on_front'); |
|
|
282
|
+ $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
|
283
|
+ $front_page_id = get_option( 'page_on_front' ); |
|
284
|
284
|
|
|
285
|
|
- if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
|
285
|
+ if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
286
|
286
|
|
|
287
|
287
|
// Force to be an array, potentially a query string ( entry=16 ) |
|
288
|
288
|
$_query = wp_parse_args( $query->query ); |
|
289
|
289
|
|
|
290
|
290
|
// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
|
291
|
|
- if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
292
|
|
- unset( $_query['pagename'] ); |
|
|
291
|
+ if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
|
292
|
+ unset( $_query[ 'pagename' ] ); |
|
293
|
293
|
} |
|
294
|
294
|
|
|
295
|
295
|
// this is where will break from core wordpress |
|
296
|
296
|
$ignore = array( 'preview', 'page', 'paged', 'cpage' ); |
|
297
|
297
|
$endpoints = rgobj( $wp_rewrite, 'endpoints' ); |
|
298
|
|
- foreach ( (array) $endpoints as $endpoint ) { |
|
299
|
|
- $ignore[] = $endpoint[1]; |
|
|
298
|
+ foreach ( (array)$endpoints as $endpoint ) { |
|
|
299
|
+ $ignore[ ] = $endpoint[ 1 ]; |
|
300
|
300
|
} |
|
301
|
301
|
unset( $endpoints ); |
|
302
|
302
|
|
|
@@ -306,21 +306,21 @@ discard block |
|
|
block discarded – undo |
|
306
|
306
|
// - The query includes keys that are associated with registered endpoints. `entry`, for example. |
|
307
|
307
|
if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
|
308
|
308
|
|
|
309
|
|
- $qv =& $query->query_vars; |
|
|
309
|
+ $qv = & $query->query_vars; |
|
310
|
310
|
|
|
311
|
311
|
// Prevent redirect when on the single entry endpoint |
|
312
|
|
- if( self::is_single_entry() ) { |
|
|
312
|
+ if ( self::is_single_entry() ) { |
|
313
|
313
|
add_filter( 'redirect_canonical', '__return_false' ); |
|
314
|
314
|
} |
|
315
|
315
|
|
|
316
|
316
|
$query->is_page = true; |
|
317
|
317
|
$query->is_home = false; |
|
318
|
|
- $qv['page_id'] = $front_page_id; |
|
|
318
|
+ $qv[ 'page_id' ] = $front_page_id; |
|
319
|
319
|
|
|
320
|
320
|
// Correct <!--nextpage--> for page_on_front |
|
321
|
|
- if ( ! empty( $qv['paged'] ) ) { |
|
322
|
|
- $qv['page'] = $qv['paged']; |
|
323
|
|
- unset( $qv['paged'] ); |
|
|
321
|
+ if ( ! empty( $qv[ 'paged' ] ) ) { |
|
|
322
|
+ $qv[ 'page' ] = $qv[ 'paged' ]; |
|
|
323
|
+ unset( $qv[ 'paged' ] ); |
|
324
|
324
|
} |
|
325
|
325
|
} |
|
326
|
326
|
|
|
@@ -353,7 +353,7 @@ discard block |
|
|
block discarded – undo |
|
353
|
353
|
|
|
354
|
354
|
$this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
|
355
|
355
|
|
|
356
|
|
- $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
|
356
|
+ $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
357
|
357
|
$this->setPostId( $post_id ); |
|
358
|
358
|
$post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
|
359
|
359
|
$this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
|
@@ -389,7 +389,7 @@ discard block |
|
|
block discarded – undo |
|
389
|
389
|
|
|
390
|
390
|
$search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
|
391
|
391
|
|
|
392
|
|
- if( 'post' === $search_method ) { |
|
|
392
|
+ if ( 'post' === $search_method ) { |
|
393
|
393
|
$get = $_POST; |
|
394
|
394
|
} else { |
|
395
|
395
|
$get = $_GET; |
|
@@ -445,20 +445,20 @@ discard block |
|
|
block discarded – undo |
|
445
|
445
|
* @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
|
446
|
446
|
* @param array $entry Current entry |
|
447
|
447
|
*/ |
|
448
|
|
- $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
|
448
|
+ $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
449
|
449
|
|
|
450
|
450
|
if ( ! $apply_outside_loop ) { |
|
451
|
451
|
return $title; |
|
452
|
452
|
} |
|
453
|
453
|
|
|
454
|
454
|
// User reported WooCommerce doesn't pass two args. |
|
455
|
|
- if ( empty( $passed_post_id ) ) { |
|
|
455
|
+ if ( empty( $passed_post_id ) ) { |
|
456
|
456
|
return $title; |
|
457
|
457
|
} |
|
458
|
458
|
|
|
459
|
459
|
// Don't modify the title for anything other than the current view/post. |
|
460
|
460
|
// This is true for embedded shortcodes and Views. |
|
461
|
|
- if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
|
461
|
+ if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
462
|
462
|
return $title; |
|
463
|
463
|
} |
|
464
|
464
|
|
|
@@ -468,19 +468,19 @@ discard block |
|
|
block discarded – undo |
|
468
|
468
|
$view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
|
469
|
469
|
} else { |
|
470
|
470
|
foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
|
471
|
|
- if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
|
471
|
+ if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
472
|
472
|
$view_meta = $view_data; |
|
473
|
473
|
break; |
|
474
|
474
|
} |
|
475
|
475
|
} |
|
476
|
476
|
} |
|
477
|
477
|
|
|
478
|
|
- if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
|
478
|
+ if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
479
|
479
|
|
|
480
|
|
- $title = $view_meta['atts']['single_title']; |
|
|
480
|
+ $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
481
|
481
|
|
|
482
|
482
|
// We are allowing HTML in the fields, so no escaping the output |
|
483
|
|
- $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
|
483
|
+ $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
484
|
484
|
|
|
485
|
485
|
$title = do_shortcode( $title ); |
|
486
|
486
|
} |
|
@@ -516,7 +516,7 @@ discard block |
|
|
block discarded – undo |
|
516
|
516
|
} |
|
517
|
517
|
|
|
518
|
518
|
// Only render in the loop. Fixes issues with the_content filter being applied in places like the sidebar |
|
519
|
|
- if( ! in_the_loop() ) { |
|
|
519
|
+ if ( ! in_the_loop() ) { |
|
520
|
520
|
return $content; |
|
521
|
521
|
} |
|
522
|
522
|
|
|
@@ -584,7 +584,7 @@ discard block |
|
|
block discarded – undo |
|
584
|
584
|
|
|
585
|
585
|
$context = GravityView_View::getInstance()->getContext(); |
|
586
|
586
|
|
|
587
|
|
- switch( $context ) { |
|
|
587
|
+ switch ( $context ) { |
|
588
|
588
|
case 'directory': |
|
589
|
589
|
$tab = __( 'Multiple Entries', 'gravityview' ); |
|
590
|
590
|
break; |
|
@@ -598,9 +598,9 @@ discard block |
|
|
block discarded – undo |
|
598
|
598
|
} |
|
599
|
599
|
|
|
600
|
600
|
|
|
601
|
|
- $title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
|
601
|
+ $title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
602
|
602
|
$edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) ); |
|
603
|
|
- $action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab ); |
|
|
603
|
+ $action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab ); |
|
604
|
604
|
$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
|
605
|
605
|
|
|
606
|
606
|
$output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
|
@@ -633,7 +633,7 @@ discard block |
|
|
block discarded – undo |
|
633
|
633
|
public function render_view( $passed_args ) { |
|
634
|
634
|
|
|
635
|
635
|
// validate attributes |
|
636
|
|
- if ( empty( $passed_args['id'] ) ) { |
|
|
636
|
+ if ( empty( $passed_args[ 'id' ] ) ) { |
|
637
|
637
|
do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
|
638
|
638
|
return null; |
|
639
|
639
|
} |
|
@@ -655,7 +655,7 @@ discard block |
|
|
block discarded – undo |
|
655
|
655
|
return null; |
|
656
|
656
|
} |
|
657
|
657
|
|
|
658
|
|
- $view_id = $passed_args['id']; |
|
|
658
|
+ $view_id = $passed_args[ 'id' ]; |
|
659
|
659
|
|
|
660
|
660
|
$view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args ); |
|
661
|
661
|
|
|
@@ -668,7 +668,7 @@ discard block |
|
|
block discarded – undo |
|
668
|
668
|
$passed_args = array_filter( $passed_args, 'strlen' ); |
|
669
|
669
|
|
|
670
|
670
|
//Override shortcode args over View template settings |
|
671
|
|
- $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
|
671
|
+ $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
672
|
672
|
|
|
673
|
673
|
do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
|
674
|
674
|
|
|
@@ -691,14 +691,14 @@ discard block |
|
|
block discarded – undo |
|
691
|
691
|
* @since 1.15 |
|
692
|
692
|
* @since 1.17.2 Added check for if a user has no caps but is logged in (member of multisite, but not any site). Treat as if logged-out. |
|
693
|
693
|
*/ |
|
694
|
|
- if( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
|
694
|
+ if ( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
695
|
695
|
|
|
696
|
696
|
do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) ); |
|
697
|
697
|
|
|
698
|
698
|
return null; |
|
699
|
699
|
} |
|
700
|
700
|
|
|
701
|
|
- if( $this->isGravityviewPostType() ) { |
|
|
701
|
+ if ( $this->isGravityviewPostType() ) { |
|
702
|
702
|
|
|
703
|
703
|
/** |
|
704
|
704
|
* @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
|
@@ -710,9 +710,9 @@ discard block |
|
|
block discarded – undo |
|
710
|
710
|
*/ |
|
711
|
711
|
$direct_access = apply_filters( 'gravityview_direct_access', true, $view_id ); |
|
712
|
712
|
|
|
713
|
|
- $embed_only = ! empty( $atts['embed_only'] ); |
|
|
713
|
+ $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
714
|
714
|
|
|
715
|
|
- if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
|
715
|
+ if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
716
|
716
|
return __( 'You are not allowed to view this content.', 'gravityview' ); |
|
717
|
717
|
} |
|
718
|
718
|
} |
|
@@ -727,7 +727,7 @@ discard block |
|
|
block discarded – undo |
|
727
|
727
|
|
|
728
|
728
|
$gravityview_view = new GravityView_View( $view_data ); |
|
729
|
729
|
|
|
730
|
|
- $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : get_the_ID(); |
|
|
730
|
+ $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : get_the_ID(); |
|
731
|
731
|
|
|
732
|
732
|
$gravityview_view->setPostId( $post_id ); |
|
733
|
733
|
|
|
@@ -737,20 +737,20 @@ discard block |
|
|
block discarded – undo |
|
737
|
737
|
do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
|
738
|
738
|
|
|
739
|
739
|
//fetch template and slug |
|
740
|
|
- $view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' ); |
|
|
740
|
+ $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' ); |
|
741
|
741
|
|
|
742
|
742
|
do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
|
743
|
743
|
|
|
744
|
744
|
/** |
|
745
|
745
|
* Disable fetching initial entries for views that don't need it (DataTables) |
|
746
|
746
|
*/ |
|
747
|
|
- $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
|
747
|
+ $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
748
|
748
|
|
|
749
|
749
|
/** |
|
750
|
750
|
* Hide View data until search is performed |
|
751
|
751
|
* @since 1.5.4 |
|
752
|
752
|
*/ |
|
753
|
|
- if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) { |
|
|
753
|
+ if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) { |
|
754
|
754
|
$gravityview_view->setHideUntilSearched( true ); |
|
755
|
755
|
$get_entries = false; |
|
756
|
756
|
} |
|
@@ -758,23 +758,23 @@ discard block |
|
|
block discarded – undo |
|
758
|
758
|
|
|
759
|
759
|
if ( $get_entries ) { |
|
760
|
760
|
|
|
761
|
|
- if ( ! empty( $atts['sort_columns'] ) ) { |
|
|
761
|
+ if ( ! empty( $atts[ 'sort_columns' ] ) ) { |
|
762
|
762
|
// add filter to enable column sorting |
|
763
|
|
- add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
|
763
|
+ add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
764
|
764
|
} |
|
765
|
765
|
|
|
766
|
|
- $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
|
766
|
+ $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
767
|
767
|
|
|
768
|
|
- do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
|
768
|
+ do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
769
|
769
|
|
|
770
|
770
|
} else { |
|
771
|
771
|
|
|
772
|
772
|
$view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
|
773
|
773
|
|
|
774
|
|
- do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
|
774
|
+ do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
775
|
775
|
} |
|
776
|
776
|
|
|
777
|
|
- $gravityview_view->setPaging( $view_entries['paging'] ); |
|
|
777
|
+ $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
778
|
778
|
$gravityview_view->setContext( 'directory' ); |
|
779
|
779
|
$sections = array( 'header', 'body', 'footer' ); |
|
780
|
780
|
|
|
@@ -788,7 +788,7 @@ discard block |
|
|
block discarded – undo |
|
788
|
788
|
* @action `gravityview_render_entry_{View ID}` Before rendering a single entry for a specific View ID |
|
789
|
789
|
* @since 1.17 |
|
790
|
790
|
*/ |
|
791
|
|
- do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
|
791
|
+ do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
792
|
792
|
|
|
793
|
793
|
$entry = $this->getEntry(); |
|
794
|
794
|
|
|
@@ -798,7 +798,7 @@ discard block |
|
|
block discarded – undo |
|
798
|
798
|
do_action( 'gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.' ); |
|
799
|
799
|
|
|
800
|
800
|
// Only display warning once when multiple Views are embedded |
|
801
|
|
- if( $view_id !== (int) GravityView_frontend::get_context_view_id() ) { |
|
|
801
|
+ if ( $view_id !== (int)GravityView_frontend::get_context_view_id() ) { |
|
802
|
802
|
ob_end_clean(); |
|
803
|
803
|
return null; |
|
804
|
804
|
} |
|
@@ -822,21 +822,21 @@ discard block |
|
|
block discarded – undo |
|
822
|
822
|
// We're in single view, but the view being processed is not the same view the single entry belongs to. |
|
823
|
823
|
// important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
|
824
|
824
|
if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) { |
|
825
|
|
- do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id ); |
|
|
825
|
+ do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id ); |
|
826
|
826
|
ob_end_clean(); |
|
827
|
827
|
return null; |
|
828
|
828
|
} |
|
829
|
829
|
|
|
830
|
830
|
//fetch template and slug |
|
831
|
|
- $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' ); |
|
|
831
|
+ $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' ); |
|
832
|
832
|
do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
|
833
|
833
|
|
|
834
|
834
|
//fetch entry detail |
|
835
|
|
- $view_entries['count'] = 1; |
|
836
|
|
- $view_entries['entries'][] = $entry; |
|
837
|
|
- do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
|
835
|
+ $view_entries[ 'count' ] = 1; |
|
|
836
|
+ $view_entries[ 'entries' ][ ] = $entry; |
|
|
837
|
+ do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
838
|
838
|
|
|
839
|
|
- $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
|
839
|
+ $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
840
|
840
|
|
|
841
|
841
|
// set back link label |
|
842
|
842
|
$gravityview_view->setBackLinkLabel( $back_link_label ); |
|
@@ -846,11 +846,11 @@ discard block |
|
|
block discarded – undo |
|
846
|
846
|
} |
|
847
|
847
|
|
|
848
|
848
|
// add template style |
|
849
|
|
- self::add_style( $view_data['template_id'] ); |
|
|
849
|
+ self::add_style( $view_data[ 'template_id' ] ); |
|
850
|
850
|
|
|
851
|
851
|
// Prepare to render view and set vars |
|
852
|
|
- $gravityview_view->setEntries( $view_entries['entries'] ); |
|
853
|
|
- $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
|
852
|
+ $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
|
853
|
+ $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
854
|
854
|
|
|
855
|
855
|
// If Edit |
|
856
|
856
|
if ( 'edit' === gravityview_get_context() ) { |
|
@@ -863,11 +863,11 @@ discard block |
|
|
block discarded – undo |
|
863
|
863
|
|
|
864
|
864
|
} else { |
|
865
|
865
|
// finaly we'll render some html |
|
866
|
|
- $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] ); |
|
|
866
|
+ $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] ); |
|
867
|
867
|
|
|
868
|
868
|
do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
|
869
|
869
|
foreach ( $sections as $section ) { |
|
870
|
|
- do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
|
870
|
+ do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
871
|
871
|
$gravityview_view->render( $view_slug, $section, false ); |
|
872
|
872
|
} |
|
873
|
873
|
} |
|
@@ -921,7 +921,7 @@ discard block |
|
|
block discarded – undo |
|
921
|
921
|
$datetime_format = 'Y-m-d H:i:s'; |
|
922
|
922
|
$search_is_outside_view_bounds = false; |
|
923
|
923
|
|
|
924
|
|
- if( ! empty( $search_criteria[ $key ] ) ) { |
|
|
924
|
+ if ( ! empty( $search_criteria[ $key ] ) ) { |
|
925
|
925
|
|
|
926
|
926
|
$search_date = strtotime( $search_criteria[ $key ] ); |
|
927
|
927
|
|
|
@@ -949,14 +949,14 @@ discard block |
|
|
block discarded – undo |
|
949
|
949
|
if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
|
950
|
950
|
|
|
951
|
951
|
// Then we override the search and re-set the start date |
|
952
|
|
- $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
|
952
|
+ $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
953
|
953
|
} |
|
954
|
954
|
} |
|
955
|
955
|
} |
|
956
|
956
|
|
|
957
|
|
- if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
|
957
|
+ if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
958
|
958
|
// The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
|
959
|
|
- if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
|
959
|
+ if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
960
|
960
|
do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
|
961
|
961
|
} |
|
962
|
962
|
} |
|
@@ -975,19 +975,19 @@ discard block |
|
|
block discarded – undo |
|
975
|
975
|
public static function process_search_only_approved( $args, $search_criteria ) { |
|
976
|
976
|
|
|
977
|
977
|
/** @since 1.19 */ |
|
978
|
|
- if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
|
978
|
+ if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
979
|
979
|
do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries; showing all approval statuses' ); |
|
980
|
980
|
return $search_criteria; |
|
981
|
981
|
} |
|
982
|
982
|
|
|
983
|
|
- if ( ! empty( $args['show_only_approved'] ) ) { |
|
|
983
|
+ if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
984
|
984
|
|
|
985
|
|
- $search_criteria['field_filters'][] = array( |
|
|
985
|
+ $search_criteria[ 'field_filters' ][ ] = array( |
|
986
|
986
|
'key' => GravityView_Entry_Approval::meta_key, |
|
987
|
987
|
'value' => GravityView_Entry_Approval_Status::APPROVED |
|
988
|
988
|
); |
|
989
|
989
|
|
|
990
|
|
- $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
|
990
|
+ $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
991
|
991
|
|
|
992
|
992
|
do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
|
993
|
993
|
} |
|
@@ -1014,18 +1014,18 @@ discard block |
|
|
block discarded – undo |
|
1014
|
1014
|
*/ |
|
1015
|
1015
|
public static function is_entry_approved( $entry, $args = array() ) { |
|
1016
|
1016
|
|
|
1017
|
|
- if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
|
1017
|
+ if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
1018
|
1018
|
// is implicitly approved if entry is null or View settings doesn't require to check for approval |
|
1019
|
1019
|
return true; |
|
1020
|
1020
|
} |
|
1021
|
1021
|
|
|
1022
|
1022
|
/** @since 1.19 */ |
|
1023
|
|
- if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
|
1023
|
+ if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
1024
|
1024
|
do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries, so entry is approved for viewing' ); |
|
1025
|
1025
|
return true; |
|
1026
|
1026
|
} |
|
1027
|
1027
|
|
|
1028
|
|
- $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
|
1028
|
+ $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
1029
|
1029
|
|
|
1030
|
1030
|
return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
|
1031
|
1031
|
} |
|
@@ -1059,26 +1059,26 @@ discard block |
|
|
block discarded – undo |
|
1059
|
1059
|
do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
|
1060
|
1060
|
|
|
1061
|
1061
|
// implicity search |
|
1062
|
|
- if ( ! empty( $args['search_value'] ) ) { |
|
|
1062
|
+ if ( ! empty( $args[ 'search_value' ] ) ) { |
|
1063
|
1063
|
|
|
1064
|
1064
|
// Search operator options. Options: `is` or `contains` |
|
1065
|
|
- $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
|
1065
|
+ $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
1066
|
1066
|
|
|
1067
|
|
- $search_criteria['field_filters'][] = array( |
|
|
1067
|
+ $search_criteria[ 'field_filters' ][ ] = array( |
|
1068
|
1068
|
'key' => rgget( 'search_field', $args ), // The field ID to search |
|
1069
|
|
- 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
|
1069
|
+ 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
1070
|
1070
|
'operator' => $operator, |
|
1071
|
1071
|
); |
|
1072
|
1072
|
} |
|
1073
|
1073
|
|
|
1074
|
|
- if( $search_criteria !== $original_search_criteria ) { |
|
|
1074
|
+ if ( $search_criteria !== $original_search_criteria ) { |
|
1075
|
1075
|
do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
|
1076
|
1076
|
} |
|
1077
|
1077
|
|
|
1078
|
1078
|
// Handle setting date range |
|
1079
|
1079
|
$search_criteria = self::process_search_dates( $args, $search_criteria ); |
|
1080
|
1080
|
|
|
1081
|
|
- if( $search_criteria !== $original_search_criteria ) { |
|
|
1081
|
+ if ( $search_criteria !== $original_search_criteria ) { |
|
1082
|
1082
|
do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
|
1083
|
1083
|
} |
|
1084
|
1084
|
|
|
@@ -1089,7 +1089,7 @@ discard block |
|
|
block discarded – undo |
|
1089
|
1089
|
* @filter `gravityview_status` Modify entry status requirements to be included in search results. |
|
1090
|
1090
|
* @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
|
1091
|
1091
|
*/ |
|
1092
|
|
- $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
|
1092
|
+ $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1093
|
1093
|
|
|
1094
|
1094
|
return $search_criteria; |
|
1095
|
1095
|
} |
|
@@ -1201,7 +1201,7 @@ discard block |
|
|
block discarded – undo |
|
1201
|
1201
|
'search_criteria' => $search_criteria, |
|
1202
|
1202
|
'sorting' => self::updateViewSorting( $args, $form_id ), |
|
1203
|
1203
|
'paging' => $paging, |
|
1204
|
|
- 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
|
1204
|
+ 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
1205
|
1205
|
); |
|
1206
|
1206
|
|
|
1207
|
1207
|
/** |
|
@@ -1226,7 +1226,7 @@ discard block |
|
|
block discarded – undo |
|
1226
|
1226
|
* @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
|
1227
|
1227
|
* @param array $args View configuration args. |
|
1228
|
1228
|
*/ |
|
1229
|
|
- $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
|
1229
|
+ $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
1230
|
1230
|
|
|
1231
|
1231
|
do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters ); |
|
1232
|
1232
|
|
|
@@ -1251,16 +1251,16 @@ discard block |
|
|
block discarded – undo |
|
1251
|
1251
|
$default_page_size = apply_filters( 'gravityview_default_page_size', 25 ); |
|
1252
|
1252
|
|
|
1253
|
1253
|
// Paging & offset |
|
1254
|
|
- $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size; |
|
|
1254
|
+ $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size; |
|
1255
|
1255
|
|
|
1256
|
1256
|
if ( -1 === $page_size ) { |
|
1257
|
1257
|
$page_size = PHP_INT_MAX; |
|
1258
|
1258
|
} |
|
1259
|
1259
|
|
|
1260
|
|
- if ( isset( $args['offset'] ) ) { |
|
1261
|
|
- $offset = intval( $args['offset'] ); |
|
|
1260
|
+ if ( isset( $args[ 'offset' ] ) ) { |
|
|
1261
|
+ $offset = intval( $args[ 'offset' ] ); |
|
1262
|
1262
|
} else { |
|
1263
|
|
- $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
|
1263
|
+ $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
1264
|
1264
|
$offset = ( $curr_page - 1 ) * $page_size; |
|
1265
|
1265
|
} |
|
1266
|
1266
|
|
|
@@ -1285,8 +1285,8 @@ discard block |
|
|
block discarded – undo |
|
1285
|
1285
|
*/ |
|
1286
|
1286
|
public static function updateViewSorting( $args, $form_id ) { |
|
1287
|
1287
|
$sorting = array(); |
|
1288
|
|
- $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
1289
|
|
- $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
|
1288
|
+ $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
|
1289
|
+ $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
1290
|
1290
|
|
|
1291
|
1291
|
$sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
|
1292
|
1292
|
|
|
@@ -1326,11 +1326,11 @@ discard block |
|
|
block discarded – undo |
|
1326
|
1326
|
|
|
1327
|
1327
|
$sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
|
1328
|
1328
|
|
|
1329
|
|
- if( ! $sort_field ) { |
|
|
1329
|
+ if ( ! $sort_field ) { |
|
1330
|
1330
|
return $sort_field_id; |
|
1331
|
1331
|
} |
|
1332
|
1332
|
|
|
1333
|
|
- switch ( $sort_field['type'] ) { |
|
|
1333
|
+ switch ( $sort_field[ 'type' ] ) { |
|
1334
|
1334
|
|
|
1335
|
1335
|
case 'address': |
|
1336
|
1336
|
// Sorting by full address |
|
@@ -1347,7 +1347,7 @@ discard block |
|
|
block discarded – undo |
|
1347
|
1347
|
*/ |
|
1348
|
1348
|
$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
|
1349
|
1349
|
|
|
1350
|
|
- switch( strtolower( $address_part ) ){ |
|
|
1350
|
+ switch ( strtolower( $address_part ) ) { |
|
1351
|
1351
|
case 'street': |
|
1352
|
1352
|
$sort_field_id .= '.1'; |
|
1353
|
1353
|
break; |
|
@@ -1432,7 +1432,7 @@ discard block |
|
|
block discarded – undo |
|
1432
|
1432
|
*/ |
|
1433
|
1433
|
$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
|
1434
|
1434
|
|
|
1435
|
|
- if ( empty( $single_entry ) ){ |
|
|
1435
|
+ if ( empty( $single_entry ) ) { |
|
1436
|
1436
|
return false; |
|
1437
|
1437
|
} else { |
|
1438
|
1438
|
return $single_entry; |
|
@@ -1459,7 +1459,7 @@ discard block |
|
|
block discarded – undo |
|
1459
|
1459
|
* Don't enqueue the scripts or styles if it's not going to be displayed. |
|
1460
|
1460
|
* @since 1.15 |
|
1461
|
1461
|
*/ |
|
1462
|
|
- if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
|
1462
|
+ if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1463
|
1463
|
continue; |
|
1464
|
1464
|
} |
|
1465
|
1465
|
|
|
@@ -1468,19 +1468,19 @@ discard block |
|
|
block discarded – undo |
|
1468
|
1468
|
$css_dependencies = array(); |
|
1469
|
1469
|
|
|
1470
|
1470
|
// If the thickbox is enqueued, add dependencies |
|
1471
|
|
- if ( ! empty( $data['atts']['lightbox'] ) ) { |
|
|
1471
|
+ if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) { |
|
1472
|
1472
|
|
|
1473
|
1473
|
/** |
|
1474
|
1474
|
* @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
|
1475
|
1475
|
* @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
|
1476
|
1476
|
*/ |
|
1477
|
|
- $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
|
1477
|
+ $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1478
|
1478
|
|
|
1479
|
1479
|
/** |
|
1480
|
1480
|
* @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
|
1481
|
1481
|
* @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
|
1482
|
1482
|
*/ |
|
1483
|
|
- $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
|
1483
|
+ $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1484
|
1484
|
} |
|
1485
|
1485
|
|
|
1486
|
1486
|
/** |
|
@@ -1488,25 +1488,25 @@ discard block |
|
|
block discarded – undo |
|
1488
|
1488
|
* @see https://github.com/katzwebservices/GravityView/issues/536 |
|
1489
|
1489
|
* @since 1.15 |
|
1490
|
1490
|
*/ |
|
1491
|
|
- if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1492
|
|
- $css_dependencies[] = 'dashicons'; |
|
|
1491
|
+ if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
|
1492
|
+ $css_dependencies[ ] = 'dashicons'; |
|
1493
|
1493
|
} |
|
1494
|
1494
|
|
|
1495
|
1495
|
wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
1496
|
1496
|
|
|
1497
|
1497
|
$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
1498
|
1498
|
|
|
1499
|
|
- wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true ); |
|
|
1499
|
+ wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true ); |
|
1500
|
1500
|
|
|
1501
|
1501
|
wp_enqueue_script( 'gravityview-fe-view' ); |
|
1502
|
1502
|
|
|
1503
|
|
- if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
|
1503
|
+ if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1504
|
1504
|
wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
|
1505
|
1505
|
} |
|
1506
|
1506
|
|
|
1507
|
1507
|
$this->enqueue_default_style( $css_dependencies ); |
|
1508
|
1508
|
|
|
1509
|
|
- self::add_style( $data['template_id'] ); |
|
|
1509
|
+ self::add_style( $data[ 'template_id' ] ); |
|
1510
|
1510
|
} |
|
1511
|
1511
|
|
|
1512
|
1512
|
if ( 'wp_print_footer_scripts' === current_filter() ) { |
|
@@ -1568,7 +1568,7 @@ discard block |
|
|
block discarded – undo |
|
1568
|
1568
|
} elseif ( empty( $template_id ) ) { |
|
1569
|
1569
|
do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
|
1570
|
1570
|
} else { |
|
1571
|
|
- do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
|
1571
|
+ do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
1572
|
1572
|
} |
|
1573
|
1573
|
|
|
1574
|
1574
|
} |
|
@@ -1593,11 +1593,11 @@ discard block |
|
|
block discarded – undo |
|
1593
|
1593
|
* Not a table-based template; don't add sort icons |
|
1594
|
1594
|
* @since 1.12 |
|
1595
|
1595
|
*/ |
|
1596
|
|
- if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
|
1596
|
+ if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1597
|
1597
|
return $label; |
|
1598
|
1598
|
} |
|
1599
|
1599
|
|
|
1600
|
|
- if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
|
1600
|
+ if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1601
|
1601
|
return $label; |
|
1602
|
1602
|
} |
|
1603
|
1603
|
|
|
@@ -1605,29 +1605,29 @@ discard block |
|
|
block discarded – undo |
|
1605
|
1605
|
|
|
1606
|
1606
|
$class = 'gv-sort'; |
|
1607
|
1607
|
|
|
1608
|
|
- $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
|
1608
|
+ $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1609
|
1609
|
|
|
1610
|
1610
|
$sort_args = array( |
|
1611
|
|
- 'sort' => $field['id'], |
|
|
1611
|
+ 'sort' => $field[ 'id' ], |
|
1612
|
1612
|
'dir' => 'asc', |
|
1613
|
1613
|
); |
|
1614
|
1614
|
|
|
1615
|
|
- if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
|
1615
|
+ if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1616
|
1616
|
//toggle sorting direction. |
|
1617
|
|
- if ( 'asc' === $sorting['direction'] ) { |
|
1618
|
|
- $sort_args['dir'] = 'desc'; |
|
|
1617
|
+ if ( 'asc' === $sorting[ 'direction' ] ) { |
|
|
1618
|
+ $sort_args[ 'dir' ] = 'desc'; |
|
1619
|
1619
|
$class .= ' gv-icon-sort-desc'; |
|
1620
|
1620
|
} else { |
|
1621
|
|
- $sort_args['dir'] = 'asc'; |
|
|
1621
|
+ $sort_args[ 'dir' ] = 'asc'; |
|
1622
|
1622
|
$class .= ' gv-icon-sort-asc'; |
|
1623
|
1623
|
} |
|
1624
|
1624
|
} else { |
|
1625
|
1625
|
$class .= ' gv-icon-caret-up-down'; |
|
1626
|
1626
|
} |
|
1627
|
1627
|
|
|
1628
|
|
- $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
|
1628
|
+ $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
1629
|
1629
|
|
|
1630
|
|
- return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
|
1630
|
+ return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
1631
|
1631
|
|
|
1632
|
1632
|
} |
|
1633
|
1633
|
|
|
@@ -1645,7 +1645,7 @@ discard block |
|
|
block discarded – undo |
|
1645
|
1645
|
|
|
1646
|
1646
|
$field_type = $field_id; |
|
1647
|
1647
|
|
|
1648
|
|
- if( is_numeric( $field_id ) ) { |
|
|
1648
|
+ if ( is_numeric( $field_id ) ) { |
|
1649
|
1649
|
$field = GFFormsModel::get_field( $form, $field_id ); |
|
1650
|
1650
|
$field_type = $field->type; |
|
1651
|
1651
|
} |
|
@@ -1668,7 +1668,7 @@ discard block |
|
|
block discarded – undo |
|
1668
|
1668
|
return false; |
|
1669
|
1669
|
} |
|
1670
|
1670
|
|
|
1671
|
|
- return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
|
1671
|
+ return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1672
|
1672
|
|
|
1673
|
1673
|
} |
|
1674
|
1674
|
|