@@ -2,8 +2,9 @@ discard block |
||
2 | 2 | namespace GV; |
3 | 3 | |
4 | 4 | /** If this file is called directly, abort. */ |
5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
6 | 6 | die(); |
7 | +} |
|
7 | 8 | |
8 | 9 | /** |
9 | 10 | * The base Entry class. |
@@ -24,8 +25,9 @@ discard block |
||
24 | 25 | $endpoint = self::get_endpoint_name(); |
25 | 26 | |
26 | 27 | /** Let's make sure the endpoint array is not polluted. */ |
27 | - if ( in_array( array( EP_ALL, $endpoint, $endpoint ), $wp_rewrite->endpoints ) ) |
|
28 | - return; |
|
28 | + if ( in_array( array( EP_ALL, $endpoint, $endpoint ), $wp_rewrite->endpoints ) ) { |
|
29 | + return; |
|
30 | + } |
|
29 | 31 | |
30 | 32 | add_rewrite_endpoint( $endpoint, EP_ALL ); |
31 | 33 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $supports = array( 'title', 'revisions' ); |
36 | 36 | |
37 | 37 | if ( $is_hierarchical ) { |
38 | - $supports[] = 'page-attributes'; |
|
38 | + $supports[ ] = 'page-attributes'; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -2,8 +2,9 @@ discard block |
||
2 | 2 | namespace GV; |
3 | 3 | |
4 | 4 | /** If this file is called directly, abort. */ |
5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
6 | 6 | die(); |
7 | +} |
|
7 | 8 | |
8 | 9 | /** |
9 | 10 | * The default GravityView View class. |
@@ -21,8 +22,9 @@ discard block |
||
21 | 22 | public static function register_post_type() { |
22 | 23 | |
23 | 24 | /** Register only once */ |
24 | - if ( post_type_exists( 'gravityview' ) ) |
|
25 | - return; |
|
25 | + if ( post_type_exists( 'gravityview' ) ) { |
|
26 | + return; |
|
27 | + } |
|
26 | 28 | |
27 | 29 | /** |
28 | 30 | * @filter `gravityview_is_hierarchical` Make GravityView Views hierarchical by returning TRUE |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Sets the single entry ID and also the entry |
156 | - * @param bool|int|string $single_entry |
|
156 | + * @param boolean|string $single_entry |
|
157 | 157 | */ |
158 | 158 | public function setSingleEntry( $single_entry ) { |
159 | 159 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | /** |
172 | 172 | * Set the current entry |
173 | - * @param array|int $entry Entry array or entry slug or ID |
|
173 | + * @param boolean|string $entry Entry array or entry slug or ID |
|
174 | 174 | */ |
175 | 175 | public function setEntry( $entry ) { |
176 | 176 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * |
229 | 229 | * |
230 | 230 | * |
231 | - * @param null $view_id |
|
231 | + * @param string $view_id |
|
232 | 232 | */ |
233 | 233 | public function set_context_view_id( $view_id = null ) { |
234 | 234 | |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | * |
1106 | 1106 | * @uses gravityview_get_entries() |
1107 | 1107 | * @access public |
1108 | - * @param array $args\n |
|
1108 | + * @param array $args |
|
1109 | 1109 | * - $id - View id |
1110 | 1110 | * - $page_size - Page |
1111 | 1111 | * - $sort_field - form field id to sort |
@@ -1193,7 +1193,6 @@ discard block |
||
1193 | 1193 | * @since 1.19.5 |
1194 | 1194 | * |
1195 | 1195 | * @param $args |
1196 | - * @param int $form_id |
|
1197 | 1196 | */ |
1198 | 1197 | public static function get_search_criteria_paging( $args ) { |
1199 | 1198 | |
@@ -1588,7 +1587,7 @@ discard block |
||
1588 | 1587 | /** |
1589 | 1588 | * Checks if field (column) is sortable |
1590 | 1589 | * |
1591 | - * @param string $field Field settings |
|
1590 | + * @param string $field_id Field settings |
|
1592 | 1591 | * @param array $form Gravity Forms form array |
1593 | 1592 | * |
1594 | 1593 | * @since 1.7 |
@@ -85,9 +85,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
727 | 727 | |
728 | 728 | $gravityview_view = new GravityView_View( $view_data ); |
729 | 729 | |
730 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId(); |
|
730 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId(); |
|
731 | 731 | |
732 | 732 | $gravityview_view->setPostId( $post_id ); |
733 | 733 | |
@@ -737,20 +737,20 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | 'search_criteria' => $search_criteria, |
1141 | 1141 | 'sorting' => self::updateViewSorting( $args, $form_id ), |
1142 | 1142 | 'paging' => $paging, |
1143 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
1143 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
1144 | 1144 | ); |
1145 | 1145 | |
1146 | 1146 | /** |
@@ -1165,7 +1165,7 @@ discard block |
||
1165 | 1165 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
1166 | 1166 | * @param array $args View configuration args. |
1167 | 1167 | */ |
1168 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
1168 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
1169 | 1169 | |
1170 | 1170 | do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters ); |
1171 | 1171 | |
@@ -1211,16 +1211,16 @@ discard block |
||
1211 | 1211 | $default_page_size = apply_filters( 'gravityview_default_page_size', 25 ); |
1212 | 1212 | |
1213 | 1213 | // Paging & offset |
1214 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size; |
|
1214 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size; |
|
1215 | 1215 | |
1216 | 1216 | if ( -1 === $page_size ) { |
1217 | 1217 | $page_size = PHP_INT_MAX; |
1218 | 1218 | } |
1219 | 1219 | |
1220 | - if ( isset( $args['offset'] ) ) { |
|
1221 | - $offset = intval( $args['offset'] ); |
|
1220 | + if ( isset( $args[ 'offset' ] ) ) { |
|
1221 | + $offset = intval( $args[ 'offset' ] ); |
|
1222 | 1222 | } else { |
1223 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
1223 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
1224 | 1224 | $offset = ( $curr_page - 1 ) * $page_size; |
1225 | 1225 | } |
1226 | 1226 | |
@@ -1245,8 +1245,8 @@ discard block |
||
1245 | 1245 | */ |
1246 | 1246 | public static function updateViewSorting( $args, $form_id ) { |
1247 | 1247 | $sorting = array(); |
1248 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
1249 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
1248 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
1249 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
1250 | 1250 | |
1251 | 1251 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
1252 | 1252 | |
@@ -1286,11 +1286,11 @@ discard block |
||
1286 | 1286 | |
1287 | 1287 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
1288 | 1288 | |
1289 | - if( ! $sort_field ) { |
|
1289 | + if ( ! $sort_field ) { |
|
1290 | 1290 | return $sort_field_id; |
1291 | 1291 | } |
1292 | 1292 | |
1293 | - switch ( $sort_field['type'] ) { |
|
1293 | + switch ( $sort_field[ 'type' ] ) { |
|
1294 | 1294 | |
1295 | 1295 | case 'address': |
1296 | 1296 | // Sorting by full address |
@@ -1307,7 +1307,7 @@ discard block |
||
1307 | 1307 | */ |
1308 | 1308 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1309 | 1309 | |
1310 | - switch( strtolower( $address_part ) ){ |
|
1310 | + switch ( strtolower( $address_part ) ) { |
|
1311 | 1311 | case 'street': |
1312 | 1312 | $sort_field_id .= '.1'; |
1313 | 1313 | break; |
@@ -1392,7 +1392,7 @@ discard block |
||
1392 | 1392 | */ |
1393 | 1393 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1394 | 1394 | |
1395 | - if ( empty( $single_entry ) ){ |
|
1395 | + if ( empty( $single_entry ) ) { |
|
1396 | 1396 | return false; |
1397 | 1397 | } else { |
1398 | 1398 | return $single_entry; |
@@ -1419,7 +1419,7 @@ discard block |
||
1419 | 1419 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
1420 | 1420 | * @since 1.15 |
1421 | 1421 | */ |
1422 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1422 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1423 | 1423 | continue; |
1424 | 1424 | } |
1425 | 1425 | |
@@ -1428,19 +1428,19 @@ discard block |
||
1428 | 1428 | $css_dependencies = array(); |
1429 | 1429 | |
1430 | 1430 | // If the thickbox is enqueued, add dependencies |
1431 | - if ( ! empty( $data['atts']['lightbox'] ) ) { |
|
1431 | + if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) { |
|
1432 | 1432 | |
1433 | 1433 | /** |
1434 | 1434 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
1435 | 1435 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
1436 | 1436 | */ |
1437 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1437 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1438 | 1438 | |
1439 | 1439 | /** |
1440 | 1440 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
1441 | 1441 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
1442 | 1442 | */ |
1443 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1443 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1444 | 1444 | } |
1445 | 1445 | |
1446 | 1446 | /** |
@@ -1448,25 +1448,25 @@ discard block |
||
1448 | 1448 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
1449 | 1449 | * @since 1.15 |
1450 | 1450 | */ |
1451 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1452 | - $css_dependencies[] = 'dashicons'; |
|
1451 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
1452 | + $css_dependencies[ ] = 'dashicons'; |
|
1453 | 1453 | } |
1454 | 1454 | |
1455 | 1455 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
1456 | 1456 | |
1457 | 1457 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
1458 | 1458 | |
1459 | - 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 ); |
|
1459 | + 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 ); |
|
1460 | 1460 | |
1461 | 1461 | wp_enqueue_script( 'gravityview-fe-view' ); |
1462 | 1462 | |
1463 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
1463 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1464 | 1464 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
1465 | 1465 | } |
1466 | 1466 | |
1467 | 1467 | $this->enqueue_default_style( $css_dependencies ); |
1468 | 1468 | |
1469 | - self::add_style( $data['template_id'] ); |
|
1469 | + self::add_style( $data[ 'template_id' ] ); |
|
1470 | 1470 | } |
1471 | 1471 | |
1472 | 1472 | if ( 'wp_print_footer_scripts' === current_filter() ) { |
@@ -1528,7 +1528,7 @@ discard block |
||
1528 | 1528 | } elseif ( empty( $template_id ) ) { |
1529 | 1529 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
1530 | 1530 | } else { |
1531 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
1531 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
1532 | 1532 | } |
1533 | 1533 | |
1534 | 1534 | } |
@@ -1553,11 +1553,11 @@ discard block |
||
1553 | 1553 | * Not a table-based template; don't add sort icons |
1554 | 1554 | * @since 1.12 |
1555 | 1555 | */ |
1556 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1556 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1557 | 1557 | return $label; |
1558 | 1558 | } |
1559 | 1559 | |
1560 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
1560 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1561 | 1561 | return $label; |
1562 | 1562 | } |
1563 | 1563 | |
@@ -1565,29 +1565,29 @@ discard block |
||
1565 | 1565 | |
1566 | 1566 | $class = 'gv-sort'; |
1567 | 1567 | |
1568 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
1568 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1569 | 1569 | |
1570 | 1570 | $sort_args = array( |
1571 | - 'sort' => $field['id'], |
|
1571 | + 'sort' => $field[ 'id' ], |
|
1572 | 1572 | 'dir' => 'asc', |
1573 | 1573 | ); |
1574 | 1574 | |
1575 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
1575 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1576 | 1576 | //toggle sorting direction. |
1577 | - if ( 'asc' === $sorting['direction'] ) { |
|
1578 | - $sort_args['dir'] = 'desc'; |
|
1577 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
1578 | + $sort_args[ 'dir' ] = 'desc'; |
|
1579 | 1579 | $class .= ' gv-icon-sort-desc'; |
1580 | 1580 | } else { |
1581 | - $sort_args['dir'] = 'asc'; |
|
1581 | + $sort_args[ 'dir' ] = 'asc'; |
|
1582 | 1582 | $class .= ' gv-icon-sort-asc'; |
1583 | 1583 | } |
1584 | 1584 | } else { |
1585 | 1585 | $class .= ' gv-icon-caret-up-down'; |
1586 | 1586 | } |
1587 | 1587 | |
1588 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
1588 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
1589 | 1589 | |
1590 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
1590 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
1591 | 1591 | |
1592 | 1592 | } |
1593 | 1593 | |
@@ -1605,7 +1605,7 @@ discard block |
||
1605 | 1605 | |
1606 | 1606 | $field_type = $field_id; |
1607 | 1607 | |
1608 | - if( is_numeric( $field_id ) ) { |
|
1608 | + if ( is_numeric( $field_id ) ) { |
|
1609 | 1609 | $field = GFFormsModel::get_field( $form, $field_id ); |
1610 | 1610 | $field_type = $field->type; |
1611 | 1611 | } |
@@ -1628,7 +1628,7 @@ discard block |
||
1628 | 1628 | return false; |
1629 | 1629 | } |
1630 | 1630 | |
1631 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1631 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1632 | 1632 | |
1633 | 1633 | } |
1634 | 1634 |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 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 ); |
@@ -452,7 +452,7 @@ discard block |
||
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 | |
@@ -1307,7 +1307,7 @@ discard block |
||
1307 | 1307 | */ |
1308 | 1308 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1309 | 1309 | |
1310 | - switch( strtolower( $address_part ) ){ |
|
1310 | + switch( strtolower( $address_part ) ) { |
|
1311 | 1311 | case 'street': |
1312 | 1312 | $sort_field_id .= '.1'; |
1313 | 1313 | break; |
@@ -1392,7 +1392,7 @@ discard block |
||
1392 | 1392 | */ |
1393 | 1393 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1394 | 1394 | |
1395 | - if ( empty( $single_entry ) ){ |
|
1395 | + if ( empty( $single_entry ) ) { |
|
1396 | 1396 | return false; |
1397 | 1397 | } else { |
1398 | 1398 | return $single_entry; |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | var $is_numeric = true; |
16 | 16 | |
17 | - var $search_operators = array( 'is', 'isnot', 'starts_with', 'ends_with' ); |
|
17 | + var $search_operators = array( 'is', 'isnot', 'starts_with', 'ends_with' ); |
|
18 | 18 | |
19 | 19 | var $group = 'pricing'; |
20 | 20 |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
46 | 46 | |
47 | 47 | // It's not the parent field; it's an input |
48 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
48 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
49 | 49 | |
50 | - if( $this->is_choice_value_enabled() ) { |
|
50 | + if ( $this->is_choice_value_enabled() ) { |
|
51 | 51 | |
52 | 52 | $desc = esc_html__( 'This input has a label and a value. What should be displayed?', 'gravityview' ); |
53 | 53 | $default = 'value'; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ); |
66 | 66 | } |
67 | 67 | |
68 | - $field_options['choice_display'] = array( |
|
68 | + $field_options[ 'choice_display' ] = array( |
|
69 | 69 | 'type' => 'radio', |
70 | 70 | 'class' => 'vertical', |
71 | 71 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -50,12 +50,12 @@ |
||
50 | 50 | |
51 | 51 | /** @var GF_Field_Total $total_field */ |
52 | 52 | foreach ( $Edit_Entry_Render->total_fields as $total_field ) { |
53 | - $entry["{$total_field->id}"] = GFCommon::get_order_total( $form, $Edit_Entry_Render->entry ); |
|
53 | + $entry[ "{$total_field->id}" ] = GFCommon::get_order_total( $form, $Edit_Entry_Render->entry ); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $return_entry = GFAPI::update_entry( $entry ); |
57 | 57 | |
58 | - if( is_wp_error( $return_entry ) ) { |
|
58 | + if ( is_wp_error( $return_entry ) ) { |
|
59 | 59 | do_action( 'gravityview_log_error', __METHOD__ . ': Updating the entry total fields failed', $return_entry ); |
60 | 60 | } else { |
61 | 61 | do_action( 'gravityview_log_debug', __METHOD__ . ': Updating the entry total fields succeeded' ); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function clear_product_info_cache( $form = array(), $entry_id = 0, $Edit_Entry_Render = null ) { |
51 | 51 | |
52 | - if( $this->should_hide_product_fields( $Edit_Entry_Render->entry ) ) { |
|
52 | + if ( $this->should_hide_product_fields( $Edit_Entry_Render->entry ) ) { |
|
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @see GVCommon::entry_has_transaction_data() |
102 | 102 | * @param boolean $hide_product_fields Whether to hide product fields in the editor. Uses $entry data to determine. |
103 | 103 | */ |
104 | - $hide_product_fields = (bool) apply_filters( 'gravityview/edit_entry/hide-product-fields', $has_transaction_data ); |
|
104 | + $hide_product_fields = (bool)apply_filters( 'gravityview/edit_entry/hide-product-fields', $has_transaction_data ); |
|
105 | 105 | |
106 | 106 | return $hide_product_fields; |
107 | 107 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | add_filter( 'icl_ls_languages', array( $this, 'wpml_ls_filter' ) ); |
64 | 64 | |
65 | - add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link') ); |
|
65 | + add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link' ) ); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | $this->remove_url_hooks(); |
153 | 153 | |
154 | - if( $translations ) { |
|
154 | + if ( $translations ) { |
|
155 | 155 | foreach ( $languages as $lang_code => $language ) { |
156 | 156 | |
157 | 157 | $lang_post_id = $translations[ $lang_code ]->element_id; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | break; |
185 | 185 | } |
186 | 186 | |
187 | - $languages[ $lang_code ]['url'] = $entry_link; |
|
187 | + $languages[ $lang_code ][ 'url' ] = $entry_link; |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 |
@@ -2,8 +2,9 @@ |
||
2 | 2 | namespace GV; |
3 | 3 | |
4 | 4 | /** If this file is called directly, abort. */ |
5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
6 | 6 | die(); |
7 | +} |
|
7 | 8 | |
8 | 9 | /** |
9 | 10 | * The Request abstract class. |