|
@@ -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 ); |
|
@@ -237,12 +237,12 @@ discard block |
|
|
block discarded – undo |
|
237
|
237
|
|
|
238
|
238
|
$this->context_view_id = $view_id; |
|
239
|
239
|
|
|
240
|
|
- } elseif ( isset( $_GET['gvid'] ) && $multiple_views ) { |
|
|
240
|
+ } elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) { |
|
241
|
241
|
/** |
|
242
|
242
|
* used on a has_multiple_views context |
|
243
|
243
|
* @see GravityView_API::entry_link |
|
244
|
244
|
*/ |
|
245
|
|
- $this->context_view_id = $_GET['gvid']; |
|
|
245
|
+ $this->context_view_id = $_GET[ 'gvid' ]; |
|
246
|
246
|
|
|
247
|
247
|
} elseif ( ! $multiple_views ) { |
|
248
|
248
|
if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
|
@@ -285,25 +285,25 @@ discard block |
|
|
block discarded – undo |
|
285
|
285
|
global $wp_rewrite; |
|
286
|
286
|
|
|
287
|
287
|
$is_front_page = ( $query->is_home || $query->is_page ); |
|
288
|
|
- $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
289
|
|
- $front_page_id = get_option('page_on_front'); |
|
|
288
|
+ $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
|
289
|
+ $front_page_id = get_option( 'page_on_front' ); |
|
290
|
290
|
|
|
291
|
|
- if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
|
291
|
+ if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
292
|
292
|
|
|
293
|
293
|
// Force to be an array, potentially a query string ( entry=16 ) |
|
294
|
294
|
$_query = wp_parse_args( $query->query ); |
|
295
|
295
|
|
|
296
|
296
|
// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
|
297
|
|
- if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
298
|
|
- unset( $_query['pagename'] ); |
|
|
297
|
+ if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
|
298
|
+ unset( $_query[ 'pagename' ] ); |
|
299
|
299
|
} |
|
300
|
300
|
|
|
301
|
301
|
// this is where will break from core wordpress |
|
302
|
302
|
/** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */ |
|
303
|
303
|
$ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query ); |
|
304
|
304
|
$endpoints = rgobj( $wp_rewrite, 'endpoints' ); |
|
305
|
|
- foreach ( (array) $endpoints as $endpoint ) { |
|
306
|
|
- $ignore[] = $endpoint[1]; |
|
|
305
|
+ foreach ( (array)$endpoints as $endpoint ) { |
|
|
306
|
+ $ignore[ ] = $endpoint[ 1 ]; |
|
307
|
307
|
} |
|
308
|
308
|
unset( $endpoints ); |
|
309
|
309
|
|
|
@@ -313,21 +313,21 @@ discard block |
|
|
block discarded – undo |
|
313
|
313
|
// - The query includes keys that are associated with registered endpoints. `entry`, for example. |
|
314
|
314
|
if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
|
315
|
315
|
|
|
316
|
|
- $qv =& $query->query_vars; |
|
|
316
|
+ $qv = & $query->query_vars; |
|
317
|
317
|
|
|
318
|
318
|
// Prevent redirect when on the single entry endpoint |
|
319
|
|
- if( self::is_single_entry() ) { |
|
|
319
|
+ if ( self::is_single_entry() ) { |
|
320
|
320
|
add_filter( 'redirect_canonical', '__return_false' ); |
|
321
|
321
|
} |
|
322
|
322
|
|
|
323
|
323
|
$query->is_page = true; |
|
324
|
324
|
$query->is_home = false; |
|
325
|
|
- $qv['page_id'] = $front_page_id; |
|
|
325
|
+ $qv[ 'page_id' ] = $front_page_id; |
|
326
|
326
|
|
|
327
|
327
|
// Correct <!--nextpage--> for page_on_front |
|
328
|
|
- if ( ! empty( $qv['paged'] ) ) { |
|
329
|
|
- $qv['page'] = $qv['paged']; |
|
330
|
|
- unset( $qv['paged'] ); |
|
|
328
|
+ if ( ! empty( $qv[ 'paged' ] ) ) { |
|
|
329
|
+ $qv[ 'page' ] = $qv[ 'paged' ]; |
|
|
330
|
+ unset( $qv[ 'paged' ] ); |
|
331
|
331
|
} |
|
332
|
332
|
} |
|
333
|
333
|
|
|
@@ -360,7 +360,7 @@ discard block |
|
|
block discarded – undo |
|
360
|
360
|
|
|
361
|
361
|
$this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
|
362
|
362
|
|
|
363
|
|
- $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
|
363
|
+ $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
364
|
364
|
$this->setPostId( $post_id ); |
|
365
|
365
|
$post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
|
366
|
366
|
$this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
|
@@ -396,7 +396,7 @@ discard block |
|
|
block discarded – undo |
|
396
|
396
|
|
|
397
|
397
|
$search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
|
398
|
398
|
|
|
399
|
|
- if( 'post' === $search_method ) { |
|
|
399
|
+ if ( 'post' === $search_method ) { |
|
400
|
400
|
$get = $_POST; |
|
401
|
401
|
} else { |
|
402
|
402
|
$get = $_GET; |
|
@@ -452,20 +452,20 @@ discard block |
|
|
block discarded – undo |
|
452
|
452
|
* @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
|
453
|
453
|
* @param array $entry Current entry |
|
454
|
454
|
*/ |
|
455
|
|
- $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
|
455
|
+ $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
456
|
456
|
|
|
457
|
457
|
if ( ! $apply_outside_loop ) { |
|
458
|
458
|
return $title; |
|
459
|
459
|
} |
|
460
|
460
|
|
|
461
|
461
|
// User reported WooCommerce doesn't pass two args. |
|
462
|
|
- if ( empty( $passed_post_id ) ) { |
|
|
462
|
+ if ( empty( $passed_post_id ) ) { |
|
463
|
463
|
return $title; |
|
464
|
464
|
} |
|
465
|
465
|
|
|
466
|
466
|
// Don't modify the title for anything other than the current view/post. |
|
467
|
467
|
// This is true for embedded shortcodes and Views. |
|
468
|
|
- if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
|
468
|
+ if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
469
|
469
|
return $title; |
|
470
|
470
|
} |
|
471
|
471
|
|
|
@@ -488,7 +488,7 @@ discard block |
|
|
block discarded – undo |
|
488
|
488
|
} else { |
|
489
|
489
|
if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
|
490
|
490
|
foreach ( gravityview()->views->all() as $_view ) { |
|
491
|
|
- if ( intval( $_view->form->ID ) === intval( $entry['form_id'] ) ) { |
|
|
491
|
+ if ( intval( $_view->form->ID ) === intval( $entry[ 'form_id' ] ) ) { |
|
492
|
492
|
$view = $_view; |
|
493
|
493
|
break; |
|
494
|
494
|
} |
|
@@ -500,7 +500,7 @@ discard block |
|
|
block discarded – undo |
|
500
|
500
|
} else { |
|
501
|
501
|
/** Deprecated. Use gravityview()->views->all() or gravityview()->request->all() */ |
|
502
|
502
|
foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
|
503
|
|
- if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
|
503
|
+ if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
504
|
504
|
$view_meta = $view_data; |
|
505
|
505
|
break; |
|
506
|
506
|
} |
|
@@ -515,12 +515,12 @@ discard block |
|
|
block discarded – undo |
|
515
|
515
|
} |
|
516
|
516
|
} else { |
|
517
|
517
|
/** Deprecated stuff in the future. See the branch above. */ |
|
518
|
|
- if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
|
518
|
+ if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
519
|
519
|
|
|
520
|
|
- $title = $view_meta['atts']['single_title']; |
|
|
520
|
+ $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
521
|
521
|
|
|
522
|
522
|
// We are allowing HTML in the fields, so no escaping the output |
|
523
|
|
- $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
|
523
|
+ $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
524
|
524
|
|
|
525
|
525
|
$title = do_shortcode( $title ); |
|
526
|
526
|
} |
|
@@ -558,7 +558,7 @@ discard block |
|
|
block discarded – undo |
|
558
|
558
|
} |
|
559
|
559
|
|
|
560
|
560
|
// Only render in the loop. Fixes issues with the_content filter being applied in places like the sidebar |
|
561
|
|
- if( ! in_the_loop() ) { |
|
|
561
|
+ if ( ! in_the_loop() ) { |
|
562
|
562
|
return $content; |
|
563
|
563
|
} |
|
564
|
564
|
|
|
@@ -633,7 +633,7 @@ discard block |
|
|
block discarded – undo |
|
633
|
633
|
|
|
634
|
634
|
$context = GravityView_View::getInstance()->getContext(); |
|
635
|
635
|
|
|
636
|
|
- switch( $context ) { |
|
|
636
|
+ switch ( $context ) { |
|
637
|
637
|
case 'directory': |
|
638
|
638
|
$tab = __( 'Multiple Entries', 'gravityview' ); |
|
639
|
639
|
break; |
|
@@ -647,12 +647,12 @@ discard block |
|
|
block discarded – undo |
|
647
|
647
|
} |
|
648
|
648
|
|
|
649
|
649
|
|
|
650
|
|
- $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 ); |
|
|
650
|
+ $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 ); |
|
651
|
651
|
$edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) ); |
|
652
|
|
- $action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab ); |
|
|
652
|
+ $action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab ); |
|
653
|
653
|
$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
|
654
|
654
|
|
|
655
|
|
- $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 ) ) ); |
|
|
655
|
+ $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 ) ) ); |
|
656
|
656
|
$output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
|
657
|
657
|
|
|
658
|
658
|
echo GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $view_id ); |
|
@@ -683,7 +683,7 @@ discard block |
|
|
block discarded – undo |
|
683
|
683
|
public function render_view( $passed_args ) { |
|
684
|
684
|
|
|
685
|
685
|
// validate attributes |
|
686
|
|
- if ( empty( $passed_args['id'] ) ) { |
|
|
686
|
+ if ( empty( $passed_args[ 'id' ] ) ) { |
|
687
|
687
|
do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
|
688
|
688
|
return null; |
|
689
|
689
|
} |
|
@@ -705,7 +705,7 @@ discard block |
|
|
block discarded – undo |
|
705
|
705
|
return null; |
|
706
|
706
|
} |
|
707
|
707
|
|
|
708
|
|
- $view_id = $passed_args['id']; |
|
|
708
|
+ $view_id = $passed_args[ 'id' ]; |
|
709
|
709
|
|
|
710
|
710
|
if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
|
711
|
711
|
$view = gravityview()->views->get( $view_id ); |
|
@@ -742,7 +742,7 @@ discard block |
|
|
block discarded – undo |
|
742
|
742
|
$passed_args = array_filter( $passed_args, 'strlen' ); |
|
743
|
743
|
|
|
744
|
744
|
//Override shortcode args over View template settings |
|
745
|
|
- $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
|
745
|
+ $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
746
|
746
|
|
|
747
|
747
|
do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
|
748
|
748
|
} |
|
@@ -766,14 +766,14 @@ discard block |
|
|
block discarded – undo |
|
766
|
766
|
* @since 1.15 |
|
767
|
767
|
* @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. |
|
768
|
768
|
*/ |
|
769
|
|
- 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 ) ) { |
|
|
769
|
+ 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 ) ) { |
|
770
|
770
|
|
|
771
|
771
|
do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) ); |
|
772
|
772
|
|
|
773
|
773
|
return null; |
|
774
|
774
|
} |
|
775
|
775
|
|
|
776
|
|
- if( $this->isGravityviewPostType() ) { |
|
|
776
|
+ if ( $this->isGravityviewPostType() ) { |
|
777
|
777
|
|
|
778
|
778
|
/** |
|
779
|
779
|
* @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
|
@@ -789,10 +789,10 @@ discard block |
|
|
block discarded – undo |
|
789
|
789
|
$embed_only = $view->settings->get( 'embed_only' ); |
|
790
|
790
|
} else { |
|
791
|
791
|
/** Deprecated. View attributes moved to \GV\View::$settings. */ |
|
792
|
|
- $embed_only = ! empty( $atts['embed_only'] ); |
|
|
792
|
+ $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
793
|
793
|
} |
|
794
|
794
|
|
|
795
|
|
- if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
|
795
|
+ if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
796
|
796
|
return __( 'You are not allowed to view this content.', 'gravityview' ); |
|
797
|
797
|
} |
|
798
|
798
|
} |
|
@@ -808,13 +808,13 @@ discard block |
|
|
block discarded – undo |
|
808
|
808
|
if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
|
809
|
809
|
$view_data = $view->as_data(); |
|
810
|
810
|
$gravityview_view = new GravityView_View( $view_data ); |
|
811
|
|
- $post_id = intval( $view->settings->get( 'post_id' ) ? : get_the_ID() ); |
|
|
811
|
+ $post_id = intval( $view->settings->get( 'post_id' ) ?: get_the_ID() ); |
|
812
|
812
|
$template_id = $view->template ? $view->template->ID : null; |
|
813
|
813
|
} else { |
|
814
|
814
|
/** These constructs are deprecated. Use the new gravityview() wrapper. */ |
|
815
|
815
|
$gravityview_view = new GravityView_View( $view_data ); |
|
816
|
|
- $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : get_the_ID(); |
|
817
|
|
- $template_id = $view_data['template_id']; |
|
|
816
|
+ $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : get_the_ID(); |
|
|
817
|
+ $template_id = $view_data[ 'template_id' ]; |
|
818
|
818
|
} |
|
819
|
819
|
|
|
820
|
820
|
$gravityview_view->setPostId( $post_id ); |
|
@@ -825,20 +825,20 @@ discard block |
|
|
block discarded – undo |
|
825
|
825
|
do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
|
826
|
826
|
|
|
827
|
827
|
//fetch template and slug |
|
828
|
|
- $view_slug = apply_filters( 'gravityview_template_slug_'. $template_id, 'table', 'directory' ); |
|
|
828
|
+ $view_slug = apply_filters( 'gravityview_template_slug_' . $template_id, 'table', 'directory' ); |
|
829
|
829
|
|
|
830
|
830
|
do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
|
831
|
831
|
|
|
832
|
832
|
/** |
|
833
|
833
|
* Disable fetching initial entries for views that don't need it (DataTables) |
|
834
|
834
|
*/ |
|
835
|
|
- $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
|
835
|
+ $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
836
|
836
|
|
|
837
|
837
|
if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
|
838
|
838
|
$hide_until_searched = $view->settings->get( 'hide_until_searched' ); |
|
839
|
839
|
} else { |
|
840
|
840
|
/** $atts is deprecated, use \GV\View:$settings */ |
|
841
|
|
- $hide_until_searched = ! empty( $atts['hide_until_searched'] ); |
|
|
841
|
+ $hide_until_searched = ! empty( $atts[ 'hide_until_searched' ] ); |
|
842
|
842
|
} |
|
843
|
843
|
|
|
844
|
844
|
/** |
|
@@ -856,12 +856,12 @@ discard block |
|
|
block discarded – undo |
|
856
|
856
|
$sort_columns = $view->settings->get( 'sort_columns' ); |
|
857
|
857
|
} else { |
|
858
|
858
|
/** $atts is deprecated, use \GV\View:$settings */ |
|
859
|
|
- $sort_columns = ! empty( $atts['sort_columns'] ); |
|
|
859
|
+ $sort_columns = ! empty( $atts[ 'sort_columns' ] ); |
|
860
|
860
|
} |
|
861
|
861
|
|
|
862
|
862
|
if ( $sort_columns ) { |
|
863
|
863
|
// add filter to enable column sorting |
|
864
|
|
- add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
|
864
|
+ add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
865
|
865
|
} |
|
866
|
866
|
|
|
867
|
867
|
if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
|
@@ -869,19 +869,19 @@ discard block |
|
|
block discarded – undo |
|
869
|
869
|
} else { |
|
870
|
870
|
/** $atts is deprecated, use \GV\View:$settings */ |
|
871
|
871
|
/** $view_data is depreacted, use \GV\View properties */ |
|
872
|
|
- $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
|
872
|
+ $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
873
|
873
|
} |
|
874
|
874
|
|
|
875
|
|
- do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
|
875
|
+ do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
876
|
876
|
|
|
877
|
877
|
} else { |
|
878
|
878
|
|
|
879
|
879
|
$view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
|
880
|
880
|
|
|
881
|
|
- do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
|
881
|
+ do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
882
|
882
|
} |
|
883
|
883
|
|
|
884
|
|
- $gravityview_view->setPaging( $view_entries['paging'] ); |
|
|
884
|
+ $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
885
|
885
|
$gravityview_view->setContext( 'directory' ); |
|
886
|
886
|
$sections = array( 'header', 'body', 'footer' ); |
|
887
|
887
|
|
|
@@ -898,7 +898,7 @@ discard block |
|
|
block discarded – undo |
|
898
|
898
|
do_action( 'gravityview_render_entry_' . $view->ID ); |
|
899
|
899
|
} else { |
|
900
|
900
|
/** $view_data is depreacted, use \GV\View properties */ |
|
901
|
|
- do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
|
901
|
+ do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
902
|
902
|
} |
|
903
|
903
|
|
|
904
|
904
|
$entry = $this->getEntry(); |
|
@@ -909,7 +909,7 @@ discard block |
|
|
block discarded – undo |
|
909
|
909
|
do_action( 'gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.' ); |
|
910
|
910
|
|
|
911
|
911
|
// Only display warning once when multiple Views are embedded |
|
912
|
|
- if( $view_id !== (int) GravityView_frontend::get_context_view_id() ) { |
|
|
912
|
+ if ( $view_id !== (int)GravityView_frontend::get_context_view_id() ) { |
|
913
|
913
|
ob_end_clean(); |
|
914
|
914
|
return null; |
|
915
|
915
|
} |
|
@@ -934,7 +934,7 @@ discard block |
|
|
block discarded – undo |
|
934
|
934
|
// important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
|
935
|
935
|
$multiple_views = defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ? gravityview()->views->count() > 1 : $this->getGvOutputData()->has_multiple_views(); |
|
936
|
936
|
if ( $multiple_views && $view_id != $this->get_context_view_id() ) { |
|
937
|
|
- 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 ); |
|
|
937
|
+ 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 ); |
|
938
|
938
|
ob_end_clean(); |
|
939
|
939
|
return null; |
|
940
|
940
|
} |
|
@@ -944,14 +944,14 @@ discard block |
|
|
block discarded – undo |
|
944
|
944
|
do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
|
945
|
945
|
|
|
946
|
946
|
//fetch entry detail |
|
947
|
|
- $view_entries['count'] = 1; |
|
948
|
|
- $view_entries['entries'][] = $entry; |
|
949
|
|
- do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
|
947
|
+ $view_entries[ 'count' ] = 1; |
|
|
948
|
+ $view_entries[ 'entries' ][ ] = $entry; |
|
|
949
|
+ do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
950
|
950
|
|
|
951
|
951
|
if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
|
952
|
952
|
$back_link_label = $view->settings->get( 'back_link_label', null ); |
|
953
|
953
|
} else { |
|
954
|
|
- $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
|
954
|
+ $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
955
|
955
|
} |
|
956
|
956
|
|
|
957
|
957
|
// set back link label |
|
@@ -965,8 +965,8 @@ discard block |
|
|
block discarded – undo |
|
965
|
965
|
self::add_style( $template_id ); |
|
966
|
966
|
|
|
967
|
967
|
// Prepare to render view and set vars |
|
968
|
|
- $gravityview_view->setEntries( $view_entries['entries'] ); |
|
969
|
|
- $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
|
968
|
+ $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
|
969
|
+ $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
970
|
970
|
|
|
971
|
971
|
// If Edit |
|
972
|
972
|
if ( 'edit' === gravityview_get_context() ) { |
|
@@ -983,7 +983,7 @@ discard block |
|
|
block discarded – undo |
|
983
|
983
|
|
|
984
|
984
|
do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
|
985
|
985
|
foreach ( $sections as $section ) { |
|
986
|
|
- do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
|
986
|
+ do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
987
|
987
|
$gravityview_view->render( $view_slug, $section, false ); |
|
988
|
988
|
} |
|
989
|
989
|
} |
|
@@ -1037,7 +1037,7 @@ discard block |
|
|
block discarded – undo |
|
1037
|
1037
|
$datetime_format = 'Y-m-d H:i:s'; |
|
1038
|
1038
|
$search_is_outside_view_bounds = false; |
|
1039
|
1039
|
|
|
1040
|
|
- if( ! empty( $search_criteria[ $key ] ) ) { |
|
|
1040
|
+ if ( ! empty( $search_criteria[ $key ] ) ) { |
|
1041
|
1041
|
|
|
1042
|
1042
|
$search_date = strtotime( $search_criteria[ $key ] ); |
|
1043
|
1043
|
|
|
@@ -1065,14 +1065,14 @@ discard block |
|
|
block discarded – undo |
|
1065
|
1065
|
if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
|
1066
|
1066
|
|
|
1067
|
1067
|
// Then we override the search and re-set the start date |
|
1068
|
|
- $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
|
1068
|
+ $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
1069
|
1069
|
} |
|
1070
|
1070
|
} |
|
1071
|
1071
|
} |
|
1072
|
1072
|
|
|
1073
|
|
- if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
|
1073
|
+ if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
1074
|
1074
|
// The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
|
1075
|
|
- if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
|
1075
|
+ if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
1076
|
1076
|
do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
|
1077
|
1077
|
} |
|
1078
|
1078
|
} |
|
@@ -1091,19 +1091,19 @@ discard block |
|
|
block discarded – undo |
|
1091
|
1091
|
public static function process_search_only_approved( $args, $search_criteria ) { |
|
1092
|
1092
|
|
|
1093
|
1093
|
/** @since 1.19 */ |
|
1094
|
|
- if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
|
1094
|
+ if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
1095
|
1095
|
do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries; showing all approval statuses' ); |
|
1096
|
1096
|
return $search_criteria; |
|
1097
|
1097
|
} |
|
1098
|
1098
|
|
|
1099
|
|
- if ( ! empty( $args['show_only_approved'] ) ) { |
|
|
1099
|
+ if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
1100
|
1100
|
|
|
1101
|
|
- $search_criteria['field_filters'][] = array( |
|
|
1101
|
+ $search_criteria[ 'field_filters' ][ ] = array( |
|
1102
|
1102
|
'key' => GravityView_Entry_Approval::meta_key, |
|
1103
|
1103
|
'value' => GravityView_Entry_Approval_Status::APPROVED |
|
1104
|
1104
|
); |
|
1105
|
1105
|
|
|
1106
|
|
- $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
|
1106
|
+ $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
1107
|
1107
|
|
|
1108
|
1108
|
do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
|
1109
|
1109
|
} |
|
@@ -1130,18 +1130,18 @@ discard block |
|
|
block discarded – undo |
|
1130
|
1130
|
*/ |
|
1131
|
1131
|
public static function is_entry_approved( $entry, $args = array() ) { |
|
1132
|
1132
|
|
|
1133
|
|
- if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
|
1133
|
+ if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
1134
|
1134
|
// is implicitly approved if entry is null or View settings doesn't require to check for approval |
|
1135
|
1135
|
return true; |
|
1136
|
1136
|
} |
|
1137
|
1137
|
|
|
1138
|
1138
|
/** @since 1.19 */ |
|
1139
|
|
- if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
|
1139
|
+ if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
1140
|
1140
|
do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries, so entry is approved for viewing' ); |
|
1141
|
1141
|
return true; |
|
1142
|
1142
|
} |
|
1143
|
1143
|
|
|
1144
|
|
- $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
|
1144
|
+ $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
1145
|
1145
|
|
|
1146
|
1146
|
return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
|
1147
|
1147
|
} |
|
@@ -1175,29 +1175,29 @@ discard block |
|
|
block discarded – undo |
|
1175
|
1175
|
do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
|
1176
|
1176
|
|
|
1177
|
1177
|
// implicity search |
|
1178
|
|
- if ( ! empty( $args['search_value'] ) ) { |
|
|
1178
|
+ if ( ! empty( $args[ 'search_value' ] ) ) { |
|
1179
|
1179
|
|
|
1180
|
1180
|
// Search operator options. Options: `is` or `contains` |
|
1181
|
|
- $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
|
1181
|
+ $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
1182
|
1182
|
|
|
1183
|
|
- $search_criteria['field_filters'][] = array( |
|
|
1183
|
+ $search_criteria[ 'field_filters' ][ ] = array( |
|
1184
|
1184
|
'key' => rgget( 'search_field', $args ), // The field ID to search |
|
1185
|
|
- 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
|
1185
|
+ 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
1186
|
1186
|
'operator' => $operator, |
|
1187
|
1187
|
); |
|
1188
|
1188
|
|
|
1189
|
1189
|
// Lock search mode to "all" with implicit presearch filter. |
|
1190
|
|
- $search_criteria['field_filters']['mode'] = 'all'; |
|
|
1190
|
+ $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; |
|
1191
|
1191
|
} |
|
1192
|
1192
|
|
|
1193
|
|
- if( $search_criteria !== $original_search_criteria ) { |
|
|
1193
|
+ if ( $search_criteria !== $original_search_criteria ) { |
|
1194
|
1194
|
do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
|
1195
|
1195
|
} |
|
1196
|
1196
|
|
|
1197
|
1197
|
// Handle setting date range |
|
1198
|
1198
|
$search_criteria = self::process_search_dates( $args, $search_criteria ); |
|
1199
|
1199
|
|
|
1200
|
|
- if( $search_criteria !== $original_search_criteria ) { |
|
|
1200
|
+ if ( $search_criteria !== $original_search_criteria ) { |
|
1201
|
1201
|
do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
|
1202
|
1202
|
} |
|
1203
|
1203
|
|
|
@@ -1208,7 +1208,7 @@ discard block |
|
|
block discarded – undo |
|
1208
|
1208
|
* @filter `gravityview_status` Modify entry status requirements to be included in search results. |
|
1209
|
1209
|
* @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
|
1210
|
1210
|
*/ |
|
1211
|
|
- $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
|
1211
|
+ $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1212
|
1212
|
|
|
1213
|
1213
|
return $search_criteria; |
|
1214
|
1214
|
} |
|
@@ -1332,7 +1332,7 @@ discard block |
|
|
block discarded – undo |
|
1332
|
1332
|
'search_criteria' => $search_criteria, |
|
1333
|
1333
|
'sorting' => self::updateViewSorting( $args, $form_id ), |
|
1334
|
1334
|
'paging' => $paging, |
|
1335
|
|
- 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
|
1335
|
+ 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
1336
|
1336
|
); |
|
1337
|
1337
|
|
|
1338
|
1338
|
/** |
|
@@ -1357,7 +1357,7 @@ discard block |
|
|
block discarded – undo |
|
1357
|
1357
|
* @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
|
1358
|
1358
|
* @param array $args View configuration args. |
|
1359
|
1359
|
*/ |
|
1360
|
|
- $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
|
1360
|
+ $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
1361
|
1361
|
|
|
1362
|
1362
|
do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters ); |
|
1363
|
1363
|
|
|
@@ -1382,17 +1382,17 @@ discard block |
|
|
block discarded – undo |
|
1382
|
1382
|
$default_page_size = apply_filters( 'gravityview_default_page_size', 25 ); |
|
1383
|
1383
|
|
|
1384
|
1384
|
// Paging & offset |
|
1385
|
|
- $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size; |
|
|
1385
|
+ $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size; |
|
1386
|
1386
|
|
|
1387
|
1387
|
if ( -1 === $page_size ) { |
|
1388
|
1388
|
$page_size = PHP_INT_MAX; |
|
1389
|
1389
|
} |
|
1390
|
1390
|
|
|
1391
|
|
- $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
|
1391
|
+ $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
1392
|
1392
|
$offset = ( $curr_page - 1 ) * $page_size; |
|
1393
|
1393
|
|
|
1394
|
|
- if ( ! empty( $args['offset'] ) ) { |
|
1395
|
|
- $offset += intval( $args['offset'] ); |
|
|
1394
|
+ if ( ! empty( $args[ 'offset' ] ) ) { |
|
|
1395
|
+ $offset += intval( $args[ 'offset' ] ); |
|
1396
|
1396
|
} |
|
1397
|
1397
|
|
|
1398
|
1398
|
$paging = array( |
|
@@ -1416,8 +1416,8 @@ discard block |
|
|
block discarded – undo |
|
1416
|
1416
|
*/ |
|
1417
|
1417
|
public static function updateViewSorting( $args, $form_id ) { |
|
1418
|
1418
|
$sorting = array(); |
|
1419
|
|
- $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
1420
|
|
- $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
|
1419
|
+ $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
|
1420
|
+ $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
1421
|
1421
|
|
|
1422
|
1422
|
$sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
|
1423
|
1423
|
|
|
@@ -1457,11 +1457,11 @@ discard block |
|
|
block discarded – undo |
|
1457
|
1457
|
|
|
1458
|
1458
|
$sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
|
1459
|
1459
|
|
|
1460
|
|
- if( ! $sort_field ) { |
|
|
1460
|
+ if ( ! $sort_field ) { |
|
1461
|
1461
|
return $sort_field_id; |
|
1462
|
1462
|
} |
|
1463
|
1463
|
|
|
1464
|
|
- switch ( $sort_field['type'] ) { |
|
|
1464
|
+ switch ( $sort_field[ 'type' ] ) { |
|
1465
|
1465
|
|
|
1466
|
1466
|
case 'address': |
|
1467
|
1467
|
// Sorting by full address |
|
@@ -1478,7 +1478,7 @@ discard block |
|
|
block discarded – undo |
|
1478
|
1478
|
*/ |
|
1479
|
1479
|
$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
|
1480
|
1480
|
|
|
1481
|
|
- switch( strtolower( $address_part ) ){ |
|
|
1481
|
+ switch ( strtolower( $address_part ) ) { |
|
1482
|
1482
|
case 'street': |
|
1483
|
1483
|
$sort_field_id .= '.1'; |
|
1484
|
1484
|
break; |
|
@@ -1563,7 +1563,7 @@ discard block |
|
|
block discarded – undo |
|
1563
|
1563
|
*/ |
|
1564
|
1564
|
$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
|
1565
|
1565
|
|
|
1566
|
|
- if ( empty( $single_entry ) ){ |
|
|
1566
|
+ if ( empty( $single_entry ) ) { |
|
1567
|
1567
|
return false; |
|
1568
|
1568
|
} else { |
|
1569
|
1569
|
return $single_entry; |
|
@@ -1596,14 +1596,14 @@ discard block |
|
|
block discarded – undo |
|
1596
|
1596
|
$template_id = $view->template ? $view->template->ID : null; |
|
1597
|
1597
|
$data = $view->as_data(); |
|
1598
|
1598
|
} else { |
|
1599
|
|
- $template_id = $data['template_id']; |
|
|
1599
|
+ $template_id = $data[ 'template_id' ]; |
|
1600
|
1600
|
} |
|
1601
|
1601
|
|
|
1602
|
1602
|
/** |
|
1603
|
1603
|
* Don't enqueue the scripts or styles if it's not going to be displayed. |
|
1604
|
1604
|
* @since 1.15 |
|
1605
|
1605
|
*/ |
|
1606
|
|
- if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
|
1606
|
+ if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1607
|
1607
|
continue; |
|
1608
|
1608
|
} |
|
1609
|
1609
|
|
|
@@ -1615,7 +1615,7 @@ discard block |
|
|
block discarded – undo |
|
1615
|
1615
|
$lightbox = $view->settings->get( 'lightbox' ); |
|
1616
|
1616
|
} else { |
|
1617
|
1617
|
/** View data attributes are now stored in \GV\View::$settings */ |
|
1618
|
|
- $lightbox = ! empty( $data['atts']['lightbox'] ); |
|
|
1618
|
+ $lightbox = ! empty( $data[ 'atts' ][ 'lightbox' ] ); |
|
1619
|
1619
|
} |
|
1620
|
1620
|
|
|
1621
|
1621
|
// If the thickbox is enqueued, add dependencies |
|
@@ -1625,13 +1625,13 @@ discard block |
|
|
block discarded – undo |
|
1625
|
1625
|
* @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
|
1626
|
1626
|
* @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
|
1627
|
1627
|
*/ |
|
1628
|
|
- $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
|
1628
|
+ $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1629
|
1629
|
|
|
1630
|
1630
|
/** |
|
1631
|
1631
|
* @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
|
1632
|
1632
|
* @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
|
1633
|
1633
|
*/ |
|
1634
|
|
- $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
|
1634
|
+ $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1635
|
1635
|
} |
|
1636
|
1636
|
|
|
1637
|
1637
|
/** |
|
@@ -1639,19 +1639,19 @@ discard block |
|
|
block discarded – undo |
|
1639
|
1639
|
* @see https://github.com/katzwebservices/GravityView/issues/536 |
|
1640
|
1640
|
* @since 1.15 |
|
1641
|
1641
|
*/ |
|
1642
|
|
- if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1643
|
|
- $css_dependencies[] = 'dashicons'; |
|
|
1642
|
+ if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
|
1643
|
+ $css_dependencies[ ] = 'dashicons'; |
|
1644
|
1644
|
} |
|
1645
|
1645
|
|
|
1646
|
1646
|
wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
1647
|
1647
|
|
|
1648
|
1648
|
$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
1649
|
1649
|
|
|
1650
|
|
- 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 ); |
|
|
1650
|
+ 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 ); |
|
1651
|
1651
|
|
|
1652
|
1652
|
wp_enqueue_script( 'gravityview-fe-view' ); |
|
1653
|
1653
|
|
|
1654
|
|
- if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
|
1654
|
+ if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1655
|
1655
|
wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
|
1656
|
1656
|
} |
|
1657
|
1657
|
|
|
@@ -1742,11 +1742,11 @@ discard block |
|
|
block discarded – undo |
|
1742
|
1742
|
* Not a table-based template; don't add sort icons |
|
1743
|
1743
|
* @since 1.12 |
|
1744
|
1744
|
*/ |
|
1745
|
|
- if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
|
1745
|
+ if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1746
|
1746
|
return $label; |
|
1747
|
1747
|
} |
|
1748
|
1748
|
|
|
1749
|
|
- if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
|
1749
|
+ if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1750
|
1750
|
return $label; |
|
1751
|
1751
|
} |
|
1752
|
1752
|
|
|
@@ -1754,29 +1754,29 @@ discard block |
|
|
block discarded – undo |
|
1754
|
1754
|
|
|
1755
|
1755
|
$class = 'gv-sort'; |
|
1756
|
1756
|
|
|
1757
|
|
- $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
|
1757
|
+ $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1758
|
1758
|
|
|
1759
|
1759
|
$sort_args = array( |
|
1760
|
|
- 'sort' => $field['id'], |
|
|
1760
|
+ 'sort' => $field[ 'id' ], |
|
1761
|
1761
|
'dir' => 'asc', |
|
1762
|
1762
|
); |
|
1763
|
1763
|
|
|
1764
|
|
- if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
|
1764
|
+ if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1765
|
1765
|
//toggle sorting direction. |
|
1766
|
|
- if ( 'asc' === $sorting['direction'] ) { |
|
1767
|
|
- $sort_args['dir'] = 'desc'; |
|
|
1766
|
+ if ( 'asc' === $sorting[ 'direction' ] ) { |
|
|
1767
|
+ $sort_args[ 'dir' ] = 'desc'; |
|
1768
|
1768
|
$class .= ' gv-icon-sort-desc'; |
|
1769
|
1769
|
} else { |
|
1770
|
|
- $sort_args['dir'] = 'asc'; |
|
|
1770
|
+ $sort_args[ 'dir' ] = 'asc'; |
|
1771
|
1771
|
$class .= ' gv-icon-sort-asc'; |
|
1772
|
1772
|
} |
|
1773
|
1773
|
} else { |
|
1774
|
1774
|
$class .= ' gv-icon-caret-up-down'; |
|
1775
|
1775
|
} |
|
1776
|
1776
|
|
|
1777
|
|
- $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
|
1777
|
+ $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
1778
|
1778
|
|
|
1779
|
|
- return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
|
1779
|
+ return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
1780
|
1780
|
|
|
1781
|
1781
|
} |
|
1782
|
1782
|
|
|
@@ -1794,7 +1794,7 @@ discard block |
|
|
block discarded – undo |
|
1794
|
1794
|
|
|
1795
|
1795
|
$field_type = $field_id; |
|
1796
|
1796
|
|
|
1797
|
|
- if( is_numeric( $field_id ) ) { |
|
|
1797
|
+ if ( is_numeric( $field_id ) ) { |
|
1798
|
1798
|
$field = GFFormsModel::get_field( $form, $field_id ); |
|
1799
|
1799
|
$field_type = $field->type; |
|
1800
|
1800
|
} |
|
@@ -1817,7 +1817,7 @@ discard block |
|
|
block discarded – undo |
|
1817
|
1817
|
return false; |
|
1818
|
1818
|
} |
|
1819
|
1819
|
|
|
1820
|
|
- return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
|
1820
|
+ return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1821
|
1821
|
|
|
1822
|
1822
|
} |
|
1823
|
1823
|
|